objstore

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCredsSvc

func NewCredsSvc(ctx context.Context, conf *Config, rc redis.UniversalClient) (*credsSvc, error)

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

Types

type Clients

type Clients interface {
	AsS3(ctx context.Context, storage, user string) (s3client.Client, error)
	AsSwift(ctx context.Context, storage, user string) (*gophercloud.ServiceClient, error)
	// contains filtered or unexported methods
}

type Common

type Common interface {
	BucketExists(ctx context.Context, bucket string) (bool, error)
	ListBuckets(ctx context.Context) ([]string, error)
}

Common - common object storage client interface

type CommonConfig

type CommonConfig struct {
	Type      dom.StorageType     `yaml:"type"`
	RateLimit ratelimit.RateLimit `yaml:"rateLimit"`
}

type Config

type Config = StoragesConfig[*s3.Storage, *swift.Storage]

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 Storage

type Storage = GenericStorage[*s3.Storage, *swift.Storage]

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

func (StoragesConfig[S3Config, SwiftConfig]) ViperUnmarshallerHookFunc

func (s StoragesConfig[S3Config, SwiftConfig]) ViperUnmarshallerHookFunc() mapstructure.DecodeHookFuncType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL