using Connected.Data.Sharding; using Connected.Entities.Storage; using System.Collections.Immutable; namespace Connected.Data.Storage; /// /// This middleware provides one or more connection for the specified arguments. /// /// /// If entity supports sharding (provided by ) it is possible that /// more than one connection will be returned. For the transactions only one connection is tipically returned /// since only one entity at a time is usually performed. For query operations the scenario could be more complex /// because data could reside in more than one shard. In that case one connection for each shhard will be returned. /// public interface IConnectionProvider { /// /// Opens one or more connections for the specified arguments. /// /// The type of the entity on which storage operations will be performed. /// The arguments describing what operation is about to be performed. /// One or more storage connections. One connection if entity does not supports sharding, more if /// it supports it and the operation requires data from more than one shard. Task> Open(StorageContextArgs args); StorageConnectionMode Mode { get; set; } }