Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move create_collection over to new architecture #279

Merged
merged 3 commits into from
Jun 4, 2021

Conversation

rylev
Copy link
Contributor

@rylev rylev commented Jun 1, 2021

This is an example of how to move a certain operation to the new pipeline based architecture.

We want to do this for all operations.

@@ -1,5 +1,6 @@
pub use crate::etag::Etag;
pub use crate::request_options::*;
pub use crate::{
new_http_client, AddAsHeader, AppendToUrlQuery, HttpClient, RequestId, SessionToken, EMPTY_BODY,
Copy link
Member

Choose a reason for hiding this comment

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

If we expect this to change often, probably best to put them on new lines to make diffs easier to review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually hope this won't change often or at least not after some initial churn.

sdk/cosmos/examples/create_delete_database.rs Show resolved Hide resolved
sdk/cosmos/examples/create_delete_database.rs Show resolved Hide resolved
sdk/cosmos/examples/create_delete_database.rs Outdated Show resolved Hide resolved
DATABASE,
azure_cosmos::operations::create_database::Options::new(),
)
.create_database(Context::new(), DATABASE, create_database::Options::new())
Copy link
Member

Choose a reason for hiding this comment

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

Is this idiomatic to call new(), or should we implement the Default trait? I see that used in quite a few samples, though they are pretty basic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implementing default is probably a good idea for this struct. Other options structs won't have defaults since they might have required options. Creating a collection, for example, requires a partition key (at least for now).

sdk/cosmos/src/clients/database_client.rs Show resolved Hide resolved
sdk/cosmos/src/operations/create_collection.rs Outdated Show resolved Hide resolved
sdk/cosmos/src/operations/create_collection.rs Outdated Show resolved Hide resolved
@rylev
Copy link
Contributor Author

rylev commented Jun 3, 2021

@heaths I think this is good to go.

Copy link
Contributor

@MindFlavor MindFlavor left a comment

Choose a reason for hiding this comment

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

Great work. 👍

I am skeptical about the naming change that made the code much more verbose. Are we sure we want to follow this standard? We will end up with GetContainerACLOptions, GetContainerACLResponse etc... that are painful to read.

What about the previous standard (use modules)? I think is more idiomatic in Rust.

sdk/cosmos/src/clients/cosmos_client.rs Show resolved Hide resolved
sdk/cosmos/src/clients/database_client.rs Show resolved Hide resolved
sdk/cosmos/src/clients/database_client.rs Show resolved Hide resolved
@rylev
Copy link
Contributor Author

rylev commented Jun 4, 2021

@MindFlavor I was also concerned about verbosity, but I'd like to give this way a try. It doesn't seem too bad right now.

@rylev rylev merged commit db60430 into Azure:master Jun 4, 2021
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.

4 participants