Documentation
¶
Index ¶
- Variables
- func NewCredsSvc(ctx context.Context, conf *Config, rc redis.UniversalClient) (*credsSvc, error)
- func NewRegistry(ctx context.Context, creds CredsService, metricsSvc metrics.Service) (*clients, error)
- func StorageTypeFromRequest(r *http.Request) dom.StorageType
- func WithAfter(after string) func(o *commonListOptions)
- func WithPrefix(prefix string) func(o *commonListOptions)
- func WithVersionID(versionID string) func(o *commonObjectOptions)
- func WithVersions() func(o *commonListOptions)
- type Clients
- type Common
- type CommonConfig
- type CommonObjectInfo
- type Config
- type CredsService
- type DynamicCredentialsConfig
- type GenericStorage
- type Storage
- type StorageConfig
- type StoragesConfig
- func (s StoragesConfig[S3Config, SwiftConfig]) Exists(stor, user string) error
- func (s StoragesConfig[S3conf, SwiftConf]) GetMain() GenericStorage[S3conf, SwiftConf]
- func (s StoragesConfig[_, _]) RateLimitConf() map[string]ratelimit.RateLimit
- func (s StoragesConfig[S3conf, SwiftConf]) S3Storages() map[string]S3conf
- func (s StoragesConfig[S3conf, SwiftConf]) SwiftStorages() map[string]SwiftConf
- func (s StoragesConfig[S3Config, SwiftConfig]) Types() map[string]dom.StorageType
- func (s StoragesConfig[_, _]) Validate() error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrBucketDoesntExist = errors.New("bucket doesn't exists")
)
Functions ¶
func NewCredsSvc ¶
func NewRegistry ¶
func NewRegistry(ctx context.Context, creds CredsService, metricsSvc metrics.Service) (*clients, error)
TODO: TODO-DC: todos for dynamic credentials support: - use DynamicCredeintilas Service everywhere instead of using Storage Config directly - use this Clients registry everywhere instead of using providers directly After done, make sure that: - Storage config is used only in this package. Other packages use only DynamicCredentials Service - Storage clients (S3|Swift) not instanitated outside of this package Then: - implement management API for dynamic credentials - add e2e tests
func StorageTypeFromRequest ¶
func StorageTypeFromRequest(r *http.Request) dom.StorageType
StorageTypeFromRequest detects storage type from http request
func WithPrefix ¶ added in v0.7.1
func WithPrefix(prefix string) func(o *commonListOptions)
func WithVersionID ¶ added in v0.7.1
func WithVersionID(versionID string) func(o *commonObjectOptions)
func WithVersions ¶ added in v0.7.1
func WithVersions() func(o *commonListOptions)
Types ¶
type Common ¶
type Common interface {
BucketExists(ctx context.Context, bucket string) (bool, error)
IsBucketVersioned(ctx context.Context, bucket string) (bool, error)
ListBuckets(ctx context.Context) ([]string, error)
CreateBucket(ctx context.Context, bucket string) error
RemoveBucket(ctx context.Context, bucket string) error
EnableBucketVersioning(ctx context.Context, bucket string) error
PutObject(ctx context.Context, bucket string, name string, reader io.Reader, len uint64) error
ObjectInfo(ctx context.Context, bucket string, name string, opts ...func(o *commonObjectOptions)) (*CommonObjectInfo, error)
ObjectExists(ctx context.Context, bucket string, name string, opts ...func(o *commonObjectOptions)) (bool, error)
RemoveObject(ctx context.Context, bucket string, name string, opts ...func(o *commonObjectOptions)) error
RemoveObjects(ctx context.Context, bucket string, names []string) error
ListObjects(ctx context.Context, bucket string, opts ...func(o *commonListOptions)) iter.Seq2[CommonObjectInfo, error]
}
Common - common object storage client interface
func WrapS3common ¶ added in v0.7.1
func WrapSwiftCommon ¶ added in v0.7.1
func WrapSwiftCommon(client *gophercloud.ServiceClient) Common
type CommonConfig ¶
type CommonConfig struct {
Type dom.StorageType `yaml:"type"`
RateLimit ratelimit.RateLimit `yaml:"rateLimit"`
}
type CommonObjectInfo ¶ added in v0.7.1
type CredsService ¶
type CredsService interface {
FindS3Credentials(storage, accessKey string) (user string, cred s3.CredentialsV4, err error)
MainStorage() string
Storages() map[string]dom.StorageType
GetS3Address(storage string) (s3.StorageAddress, error)
GetSwiftAddress(storage string) (swift.StorageAddress, error)
ValidateReplicationID(id entity.UniversalReplicationID) error
HasUser(storage, user string) error
ListUsers(storage string) []string
GetSwiftCredentials(storage, user string) (swift.Credentials, error)
GetS3Credentials(storage, user string) (s3.CredentialsV4, error)
SetSwiftCredentials(ctx context.Context, storage, user string, cred swift.Credentials) error
SetS3Credentials(ctx context.Context, storage, user string, cred s3.CredentialsV4) error
}
type DynamicCredentialsConfig ¶
type DynamicCredentialsConfig struct {
MasterPassword string `yaml:"masterPassword"`
PollInterval time.Duration `yaml:"pollInterval"`
Enabled bool `yaml:"enabled"`
DisableEncryption bool `yaml:"disableEncryption"`
}
func (*DynamicCredentialsConfig) Validate ¶
func (c *DynamicCredentialsConfig) Validate() error
type GenericStorage ¶
type GenericStorage[ S3Config StorageConfig, SwiftConfig StorageConfig, ] struct { S3 S3Config Swift SwiftConfig CommonConfig }
func (GenericStorage[S3conf, SwiftConf]) MarshalYAML ¶
func (a GenericStorage[S3conf, SwiftConf]) MarshalYAML() (any, error)
func (*GenericStorage[S3conf, SwiftConf]) UnmarshalYAML ¶
func (s *GenericStorage[S3conf, SwiftConf]) UnmarshalYAML(node *yaml.Node) error
func (GenericStorage[S3conf, SwiftConf]) UserList ¶
func (a GenericStorage[S3conf, SwiftConf]) UserList() []string
func (GenericStorage[S3Config, SwiftConfig]) Validate ¶
func (s GenericStorage[S3Config, SwiftConfig]) Validate() error
type StorageConfig ¶
type StorageConfig interface {
Validate() error
UserList() []string
HasUser(user string) bool
comparable
}
type StoragesConfig ¶
type StoragesConfig[ S3Config StorageConfig, SwiftConfig StorageConfig, ] struct { Storages map[string]GenericStorage[S3Config, SwiftConfig] `yaml:"storages"` Main string `yaml:"main"` DynamicCredentials DynamicCredentialsConfig `yaml:"dynamicCredentials"` }
func (StoragesConfig[S3Config, SwiftConfig]) Exists ¶
func (s StoragesConfig[S3Config, SwiftConfig]) Exists(stor, user string) error
func (StoragesConfig[S3conf, SwiftConf]) GetMain ¶
func (s StoragesConfig[S3conf, SwiftConf]) GetMain() GenericStorage[S3conf, SwiftConf]
func (StoragesConfig[_, _]) RateLimitConf ¶
func (s StoragesConfig[_, _]) RateLimitConf() map[string]ratelimit.RateLimit
func (StoragesConfig[S3conf, SwiftConf]) S3Storages ¶
func (s StoragesConfig[S3conf, SwiftConf]) S3Storages() map[string]S3conf
func (StoragesConfig[S3conf, SwiftConf]) SwiftStorages ¶
func (s StoragesConfig[S3conf, SwiftConf]) SwiftStorages() map[string]SwiftConf
func (StoragesConfig[S3Config, SwiftConfig]) Types ¶
func (s StoragesConfig[S3Config, SwiftConfig]) Types() map[string]dom.StorageType
func (StoragesConfig[_, _]) Validate ¶
func (s StoragesConfig[_, _]) Validate() error
Click to show internal directories.
Click to hide internal directories.