Documentation ¶
Index ¶
- Variables
- type BackendResponse
- type BasePicker
- type ClusterStorage
- type ConsistencyShardClient
- type Factory
- type MultiPartRoundTripper
- type NamedShardClient
- type ObjectResponsePicker
- type ReplicationClient
- type RequestDispatcher
- type ShardAuthenticator
- type ShardClient
- type StorageClient
- type Storages
Constants ¶
This section is empty.
Variables ¶
var ErrImpossibleMultipart = errors.New("can't handle multi upload")
ErrImpossibleMultipart is issued if there is no viable backend to store file
var ErrReplicationIndicator = errors.New("replication required")
ErrReplicationIndicator signals backends where object has to be replicated
var ErrRequestCanceled = fmt.Errorf("Request canceled")
ErrRequestCanceled is returned if request was canceled
Functions ¶
This section is empty.
Types ¶
type BackendResponse ¶
BackendResponse is alias of storage.types.BackendResponse
type BasePicker ¶
type BasePicker struct {
// contains filtered or unexported fields
}
BasePicker contains common methods of pickers
type ClusterStorage ¶
type ClusterStorage interface { GetShard(name string) (NamedShardClient, error) MergeShards(name string, clusters ...NamedShardClient) NamedShardClient }
ClusterStorage is basic cluster storage interface
type ConsistencyShardClient ¶
type ConsistencyShardClient struct {
// contains filtered or unexported fields
}
ConsistencyShardClient is a shard that guarantees consistency based on the defined provided consistency level
func (*ConsistencyShardClient) Backends ¶
func (consistencyShard *ConsistencyShardClient) Backends() []*StorageClient
Backends returns the backends of a shard
func (*ConsistencyShardClient) Name ¶
func (consistencyShard *ConsistencyShardClient) Name() string
Name returns the name of the shard
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory creates storages
func NewStoragesFactory ¶
func NewStoragesFactory(transport http.RoundTripper, watchdogConfig *watchdogConfig.WatchdogConfig, watchdog watchdog.ConsistencyWatchdog, watchdogRequestFactory watchdog.ConsistencyRecordFactory) *Factory
NewStoragesFactory creates StoragesFactory
func (*Factory) InitStorages ¶
func (factory *Factory) InitStorages(clustersConf config.ShardsMap, storagesMap config.StoragesMap, ignoredHeaders map[string]bool) (ClusterStorage, error)
InitStorages setups storages
type MultiPartRoundTripper ¶
type MultiPartRoundTripper struct {
// contains filtered or unexported fields
}
MultiPartRoundTripper handles the multipart upload. If multipart upload is detected, it delegates the request to the backend selected using the active backends hash ring, otherwise the cluster round tripper is used to handle the operation in standard fashion
func (MultiPartRoundTripper) Cancel ¶
func (multiPartRoundTripper MultiPartRoundTripper) Cancel() error
Cancel Client interface
func (*MultiPartRoundTripper) Do ¶
func (multiPartRoundTripper *MultiPartRoundTripper) Do(request *http.Request) <-chan BackendResponse
Do performs backend request
type NamedShardClient ¶
type NamedShardClient interface { http.RoundTripper Name() string Backends() []*StorageClient }
NamedShardClient interface
func NewConsistentShard ¶
func NewConsistentShard(shardClient NamedShardClient, consistencyWatchdgo watchdog.ConsistencyWatchdog, recordFactory watchdog.ConsistencyRecordFactory, versionHeaderName string) NamedShardClient
NewConsistentShard wraps the provided shard with ConsistencyShardClient to ensure consistency
func NewShardAuthenticator ¶
func NewShardAuthenticator(shardClient NamedShardClient, ignoredCanonicalizedHeaders map[string]bool) NamedShardClient
NewShardAuthenticator creates an instance of ShardAuthenticator
type ObjectResponsePicker ¶
type ObjectResponsePicker struct {
BasePicker
}
ObjectResponsePicker chooses first successful or one of failure response from chan of `BackendResponse`s
type ReplicationClient ¶
type ReplicationClient struct { Backends []*backend.Backend // contains filtered or unexported fields }
ReplicationClient is multiple endpoints client
func (*ReplicationClient) Cancel ¶
func (rc *ReplicationClient) Cancel() error
Cancel requests in progress
func (*ReplicationClient) Do ¶
func (rc *ReplicationClient) Do(request *http.Request) <-chan BackendResponse
Do send request to all given backends
type RequestDispatcher ¶
type RequestDispatcher struct { Backends []*backend.Backend // contains filtered or unexported fields }
RequestDispatcher passes requests and responses to matching replicators and response pickers
func NewRequestDispatcher ¶
func NewRequestDispatcher( backends []*backend.Backend) *RequestDispatcher
NewRequestDispatcher creates RequestDispatcher instance
type ShardAuthenticator ¶
type ShardAuthenticator struct {
// contains filtered or unexported fields
}
ShardAuthenticator is a delegating NamedSharedClient that checks the requests authorization
func (*ShardAuthenticator) Backends ¶
func (shardAuth *ShardAuthenticator) Backends() []*StorageClient
Backends returns the backends of a shard
func (*ShardAuthenticator) Name ¶
func (shardAuth *ShardAuthenticator) Name() string
Name returns then of the shard
type ShardClient ¶
ShardClient stores information about cluster backends
func (*ShardClient) Backends ¶
func (shardClient *ShardClient) Backends() []*StorageClient
Backends get http.RoundTripper slice
type StorageClient ¶
StorageClient is alias of storage.types.StorageClient
type Storages ¶
type Storages struct { ShardClients map[string]NamedShardClient Backends map[string]*StorageClient // contains filtered or unexported fields }
Storages config
func (*Storages) GetShard ¶
func (st *Storages) GetShard(name string) (NamedShardClient, error)
GetShard gets cluster by name or nil if cluster with given name was not found
func (*Storages) MergeShards ¶
func (st *Storages) MergeShards(name string, clusters ...NamedShardClient) NamedShardClient
MergeShards extends Clusters list of Storages by cluster made of joined clusters backends and returns it. If cluster of given name is already defined returns previously defined cluster instead.