Skip to content

Commit abfed1c

Browse files
authored
Merge pull request #196 from JanKaul/fmt
run cargo fmt
2 parents 0eb9a69 + b142941 commit abfed1c

23 files changed

+99
-81
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ jobs:
3737
run: rustup component add clippy
3838
- name: Run Clippy
3939
run: make clippy
40+
- name: Install Format
41+
run: rustup component add rustfmt
42+
- name: Run fmt
43+
run: make fmt

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ test-sql-catalog:
1919
cargo test -p iceberg-sql-catalog --lib && cargo clean -p iceberg-sql-catalog
2020
clippy:
2121
cargo clippy --all-targets --all-features -- -D warnings
22+
fmt:
23+
cargo fmt --all -- --check

catalogs/iceberg-glue-catalog/src/utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ pub(crate) const TABLE_TYPE: &str = "table_type";
77
/// Parameter value `table_type` for `TableInput`
88
pub(crate) const ICEBERG: &str = "ICEBERG";
99

10-
pub(crate) fn get_parameters (metadata_location: &str) -> HashMap<String, String> {
10+
pub(crate) fn get_parameters(metadata_location: &str) -> HashMap<String, String> {
1111
HashMap::from([
1212
(TABLE_TYPE.to_string(), ICEBERG.to_string()),
13-
(METADATA_LOCATION.to_string(), metadata_location.to_string())
13+
(METADATA_LOCATION.to_string(), metadata_location.to_string()),
1414
])
1515
}
16-

catalogs/iceberg-rest-catalog/src/apis/configuration_api_api.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
* Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
55
*
66
* The version of the OpenAPI document: 0.0.1
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

11-
11+
use super::{configuration, Error};
12+
use crate::{apis::ResponseContent, models};
1213
use reqwest;
1314
use serde::{Deserialize, Serialize};
14-
use crate::{apis::ResponseContent, models};
15-
use super::{Error, configuration};
16-
1715

1816
/// struct for typed errors of method [`get_config`]
1917
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -28,9 +26,11 @@ pub enum GetConfigError {
2826
UnknownValue(serde_json::Value),
2927
}
3028

31-
32-
/// All REST clients should first call this route to get catalog configuration properties from the server to configure the catalog and its HTTP client. Configuration from the server consists of two sets of key/value pairs. - defaults - properties that should be used as default configuration; applied before client configuration - overrides - properties that should be used to override client configuration; applied after defaults and client configuration Catalog configuration is constructed by setting the defaults, then client- provided configuration, and finally overrides. The final property set is then used to configure the catalog. For example, a default configuration property might set the size of the client pool, which can be replaced with a client-specific setting. An override might be used to set the warehouse location, which is stored on the server rather than in client configuration. Common catalog configuration settings are documented at https://iceberg.apache.org/docs/latest/configuration/#catalog-properties The catalog configuration also holds an optional `endpoints` field that contains information about the endpoints supported by the server. If a server does not send the `endpoints` field, a default set of endpoints is assumed: - GET /v1/{prefix}/namespaces - POST /v1/{prefix}/namespaces - GET /v1/{prefix}/namespaces/{namespace} - HEAD /v1/{prefix}/namespaces/{namespace} - DELETE /v1/{prefix}/namespaces/{namespace} - POST /v1/{prefix}/namespaces/{namespace}/properties - GET /v1/{prefix}/namespaces/{namespace}/tables - POST /v1/{prefix}/namespaces/{namespace}/tables - GET /v1/{prefix}/namespaces/{namespace}/tables/{table} - HEAD /v1/{prefix}/namespaces/{namespace}/tables/{table} - POST /v1/{prefix}/namespaces/{namespace}/tables/{table} - DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table} - POST /v1/{prefix}/namespaces/{namespace}/register - POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics - POST /v1/{prefix}/tables/rename - POST /v1/{prefix}/transactions/commit
33-
pub async fn get_config(configuration: &configuration::Configuration, warehouse: Option<&str>) -> Result<models::CatalogConfig, Error<GetConfigError>> {
29+
/// All REST clients should first call this route to get catalog configuration properties from the server to configure the catalog and its HTTP client. Configuration from the server consists of two sets of key/value pairs. - defaults - properties that should be used as default configuration; applied before client configuration - overrides - properties that should be used to override client configuration; applied after defaults and client configuration Catalog configuration is constructed by setting the defaults, then client- provided configuration, and finally overrides. The final property set is then used to configure the catalog. For example, a default configuration property might set the size of the client pool, which can be replaced with a client-specific setting. An override might be used to set the warehouse location, which is stored on the server rather than in client configuration. Common catalog configuration settings are documented at https://iceberg.apache.org/docs/latest/configuration/#catalog-properties The catalog configuration also holds an optional `endpoints` field that contains information about the endpoints supported by the server. If a server does not send the `endpoints` field, a default set of endpoints is assumed: - GET /v1/{prefix}/namespaces - POST /v1/{prefix}/namespaces - GET /v1/{prefix}/namespaces/{namespace} - HEAD /v1/{prefix}/namespaces/{namespace} - DELETE /v1/{prefix}/namespaces/{namespace} - POST /v1/{prefix}/namespaces/{namespace}/properties - GET /v1/{prefix}/namespaces/{namespace}/tables - POST /v1/{prefix}/namespaces/{namespace}/tables - GET /v1/{prefix}/namespaces/{namespace}/tables/{table} - HEAD /v1/{prefix}/namespaces/{namespace}/tables/{table} - POST /v1/{prefix}/namespaces/{namespace}/tables/{table} - DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table} - POST /v1/{prefix}/namespaces/{namespace}/register - POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics - POST /v1/{prefix}/tables/rename - POST /v1/{prefix}/transactions/commit
30+
pub async fn get_config(
31+
configuration: &configuration::Configuration,
32+
warehouse: Option<&str>,
33+
) -> Result<models::CatalogConfig, Error<GetConfigError>> {
3434
// add a prefix to parameters to efficiently prevent name collisions
3535
let p_warehouse = warehouse;
3636

@@ -41,17 +41,13 @@ pub async fn get_config(configuration: &configuration::Configuration, warehouse:
4141
req_builder = req_builder.query(&[("warehouse", &param_value.to_string())]);
4242
}
4343
if let Some(ref aws_v4_key) = configuration.aws_v4_key {
44-
let new_headers = match aws_v4_key.sign(
45-
&uri_str,
46-
"GET",
47-
"",
48-
) {
49-
Ok(new_headers) => new_headers,
50-
Err(err) => return Err(Error::AWSV4SignatureError(err)),
51-
};
52-
for (name, value) in new_headers.iter() {
53-
req_builder = req_builder.header(name.as_str(), value.as_str());
54-
}
44+
let new_headers = match aws_v4_key.sign(&uri_str, "GET", "") {
45+
Ok(new_headers) => new_headers,
46+
Err(err) => return Err(Error::AWSV4SignatureError(err)),
47+
};
48+
for (name, value) in new_headers.iter() {
49+
req_builder = req_builder.header(name.as_str(), value.as_str());
50+
}
5551
}
5652
if let Some(ref user_agent) = configuration.user_agent {
5753
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
@@ -74,7 +70,10 @@ pub async fn get_config(configuration: &configuration::Configuration, warehouse:
7470
} else {
7571
let content = resp.text().await?;
7672
let entity: Option<GetConfigError> = serde_json::from_str(&content).ok();
77-
Err(Error::ResponseError(ResponseContent { status, content, entity }))
73+
Err(Error::ResponseError(ResponseContent {
74+
status,
75+
content,
76+
entity,
77+
}))
7878
}
7979
}
80-

catalogs/iceberg-rest-catalog/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
#[macro_use]
55
extern crate serde_derive;
6-
extern crate serde_repr;
76
extern crate reqwest;
87
extern crate serde;
98
extern crate serde_json;
9+
extern crate serde_repr;
1010
extern crate url;
1111

1212
#[allow(clippy::all)]

catalogs/iceberg-rest-catalog/src/models/catalog_config.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
55
*
66
* The version of the OpenAPI document: 0.0.1
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

@@ -27,12 +27,14 @@ pub struct CatalogConfig {
2727

2828
impl CatalogConfig {
2929
/// Server-provided configuration for the catalog.
30-
pub fn new(overrides: std::collections::HashMap<String, String>, defaults: std::collections::HashMap<String, String>) -> CatalogConfig {
30+
pub fn new(
31+
overrides: std::collections::HashMap<String, String>,
32+
defaults: std::collections::HashMap<String, String>,
33+
) -> CatalogConfig {
3134
CatalogConfig {
3235
overrides,
3336
defaults,
3437
endpoints: None,
3538
}
3639
}
3740
}
38-

catalogs/iceberg-rest-catalog/src/models/create_namespace_request.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
55
*
66
* The version of the OpenAPI document: 0.0.1
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

@@ -29,4 +29,3 @@ impl CreateNamespaceRequest {
2929
}
3030
}
3131
}
32-

catalogs/iceberg-rest-catalog/src/models/create_namespace_response.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
55
*
66
* The version of the OpenAPI document: 0.0.1
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

@@ -29,4 +29,3 @@ impl CreateNamespaceResponse {
2929
}
3030
}
3131
}
32-

catalogs/iceberg-rest-catalog/src/models/error_model.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
55
*
66
* The version of the OpenAPI document: 0.0.1
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

@@ -38,4 +38,3 @@ impl ErrorModel {
3838
}
3939
}
4040
}
41-

catalogs/iceberg-rest-catalog/src/models/get_namespace_response.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
55
*
66
* The version of the OpenAPI document: 0.0.1
7-
*
7+
*
88
* Generated by: https://openapi-generator.tech
99
*/
1010

@@ -29,4 +29,3 @@ impl GetNamespaceResponse {
2929
}
3030
}
3131
}
32-

0 commit comments

Comments
 (0)