Skip to content

Conversation

@lizardoluis
Copy link
Collaborator

@lizardoluis lizardoluis commented Jul 30, 2024

This PR moves the object store configuration structs into the new crate object_store_factory.

@lizardoluis lizardoluis requested review from gruuya and mildbyte and removed request for mildbyte July 30, 2024 11:20
itertools = ">=0.10.0"
object_store = { version = "0.10.2", features = ["aws", "azure", "gcp"] }

serde = "1.0.156"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use this in [dependencies] below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gruuya I get an error if I do not set it here, as I'm inheriting it in the object_store_factory Cargo.toml. Btw, it is also set in the [dependecies].

The error is:

error: failed to load manifest for workspace member `/Users/lizardo/Workspace/seafowl/object_store_factory`
referenced by workspace at `/Users/lizardo/Workspace/seafowl/Cargo.toml`

Caused by:
  failed to parse manifest at `/Users/lizardo/Workspace/seafowl/object_store_factory/Cargo.toml`

Caused by:
  error inheriting `serde` from workspace root manifest's `workspace.dependencies.serde`

Caused by:
  `dependency.serde` was not found in `workspace.dependencies

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, i meant for serde to remain in workspace.dependencies, just to change line 129/131 in this file to inherit from it serde = { workspace = true }.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, got it.

Comment on lines -61 to -63
#[cfg(feature = "object-store-s3")]
S3(S3),
#[cfg(feature = "object-store-gcs")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably get rid of these two features in Cargo.toml (not used in the new configs, and I don't think we ever opt-out of these).

Copy link
Collaborator Author

@lizardoluis lizardoluis Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also purged some occurrences of it in the code.

fn test_parse_config_invalid_s3() {
let error =
load_config_from_string(TEST_CONFIG_INVALID_S3, false, None).unwrap_err();
println!("##### ERROR: {:?}", error.to_string());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println!("##### ERROR: {:?}", error.to_string());

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that

Comment on lines 88 to 97
let prefix = match self.config.clone() {
ObjectStoreConfig::AmazonS3(aws_config) => aws_config.prefix,
ObjectStoreConfig::GoogleCloudStorage(google_config) => google_config.prefix,
_ => None,
};

match prefix {
Some(prefix) => Path::from(format!("{prefix}/{table_prefix}")),
None => Path::from(table_prefix),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems simpler to do it with one pattern match as before?

Suggested change
let prefix = match self.config.clone() {
ObjectStoreConfig::AmazonS3(aws_config) => aws_config.prefix,
ObjectStoreConfig::GoogleCloudStorage(google_config) => google_config.prefix,
_ => None,
};
match prefix {
Some(prefix) => Path::from(format!("{prefix}/{table_prefix}")),
None => Path::from(table_prefix),
}
match self.config.clone() {
ObjectStoreConfig::AmazonS3(S3Config {
prefix: Some(prefix),
..
})
| ObjectStoreConfig::GoogleCloudStorage(GCSConfig {
prefix: Some(prefix),
..
}) => Path::from(format!("{prefix}/{table_prefix}")),
_ => Path::from(table_prefix),
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted, though I think the readability was better with the change.

@lizardoluis lizardoluis self-assigned this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants