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

Simplify ConsistencyLevel and CosmosStruct #88

Merged
merged 3 commits into from
Nov 20, 2020
Merged

Conversation

rylev
Copy link
Contributor

@rylev rylev commented Nov 19, 2020

@thomastaylor312 and I are looking into simplifying the cosmos crate. This PR contains changes to two types that are indicative of the larger changes we would like to make.

In general these changes favor concrete types over traits. Some additional changes I'd like to make include but are not limited to:

  • Remove the CosmosClient trait and and rename CosmosStruct to CosmosClient.
  • Change the hyper_client field of CosmosStruct to client and make it a Box<dyn Client> . This is somewhat dependent on other work to abstract the client usage so implementations are not dependent on a particular http implementation.
  • Consolidate all the clients into one client CosmosClient (aka CosmosStruct)

Comment on lines +51 to +76
//Account name: localhost:<port>
//Account key: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
let auth_token = AuthorizationToken::new_master(
"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove the unwrap? I don't believe we can. Can you explain?

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind, just realized that this was a magic string for the Cosmos DB emulator account key, I thought this was a leftover from debugging. Ignore my silliness 🙃

Small suggestion, feel free to ignore if out of scope for the PR - document and refer to the docs for the emulator. Maybe move that connection string to a const. Might avoid some confusion for the uninitiated like myself.

}

impl CloudLocation {
/// Consumes the location, returning a base URL
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor - but doesn't consume I believe

@MindFlavor
Copy link
Contributor

This is great work ❤️ . I think we probably want to merge #79 first since many modifications are probably going to create conflicts.

@rylev rylev merged commit f8d19e3 into Azure:master Nov 20, 2020
@rylev rylev deleted the cleanup branch November 20, 2020 18:04
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