-
Notifications
You must be signed in to change notification settings - Fork 70
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
Create EquinoxCosmosClient abstraction and simplify Equinox.Cosmos usage #203
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the whole, this feels very good
It does seem like some more juggling of names might be in order before it completely works
Stating the obvious, reformatting/moving of code in a PR like this makes it very hard to see the wood for the trees - I'll likely put some preparatory commits onto the base branch to reduce this a bit
…into client-abstractions
* Add optional compress flag to toggle tip compression
Previously, Equinox was creating its own
CosmosClient
instances, which prevented some testing scenarios as well as made it difficult for consumers to take actions and/or make decisions based on what Equinox was doing (eg, collecting metrics, wrapping calls in resilience policies, etc).In addition, it was cumbersome for a consumer to get started with producing/consuming a stream - a combination of types needed to be initialized such as
Connection
,Gateway
,Context
,BatchingPolicy
andContainers
.This PR aims to solve both of those concerns by abstracting Cosmos operations into a consumer-providable
EquinoxCosmosClient
, and consolidating all operations into just one type - theContext
.Abstracting away base Cosmos operations
CosmosClient
, and will instead have it be provided by consumers through anEquinoxCosmosClient
abstractionEquinoxCosmosClient
is provided which can be used by consumers that don't wish to have their own explicit implementation. All of its members are virtual and can be overridenEquinoxCosmosClientFactory
which consumers can use to build multiple instances of the defaultEquinoxCosmosClient
based on common options. In many ways, it can be considered similar to the previousConnector
type, which no longer existsEquinoxCosmosClientFactory
is an optional type for consumers to use; consumers can choose not to use the factory pattern at all, create their own factory, or inherit from the Equinox-provided type and override its methods and/or create their own methodsSimplifying the consumer surface area
Connection
,Gateway
,BatchingPolicy
andContainers
types are no longer needed to be provided by the consumer; however, they are still available within theEquinox.Cosmos.Internal
namespace for now if an unforeseen need arisesContext
andEquinoxCosmosClient
are the only two types that need to be created by a consumer when using Equinox.Cosmos