Documentation ¶
Index ¶
- Constants
- Variables
- func NewBucket(ctx context.Context, cfg Config, name string) (phlareobjstore.Bucket, error)
- func ReaderAtBucket(prefix string, b objstore.Bucket, reg prometheus.Registerer) phlareobjstore.InstrumentedBucket
- type ClientMock
- func (m *ClientMock) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error)
- func (m *ClientMock) Close() error
- func (m *ClientMock) Delete(ctx context.Context, name string) error
- func (m *ClientMock) Exists(ctx context.Context, name string) (bool, error)
- func (m *ClientMock) Get(ctx context.Context, name string) (io.ReadCloser, error)
- func (m *ClientMock) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)
- func (m *ClientMock) IsObjNotFoundErr(err error) bool
- func (m *ClientMock) Iter(ctx context.Context, dir string, f func(string) error, ...) error
- func (m *ClientMock) MockDelete(name string, err error)
- func (m *ClientMock) MockExists(name string, exists bool, err error)
- func (m *ClientMock) MockGet(name, content string, err error)
- func (m *ClientMock) MockIter(prefix string, objects []string, err error)
- func (m *ClientMock) MockIterWithCallback(prefix string, objects []string, err error, cb func())
- func (m *ClientMock) MockUpload(name string, err error)
- func (m *ClientMock) Name() string
- func (m *ClientMock) Upload(ctx context.Context, name string, r io.Reader) error
- type Config
- func (cfg *Config) RegisterFlags(f *flag.FlagSet, logger log.Logger)
- func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet, logger log.Logger)
- func (cfg *Config) RegisterFlagsWithPrefixAndDefaultDirectory(prefix, dir string, f *flag.FlagSet, logger log.Logger)
- func (cfg *Config) Validate() error
- type StorageBackendConfig
- func (cfg *StorageBackendConfig) RegisterFlags(f *flag.FlagSet, logger log.Logger)
- func (cfg *StorageBackendConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet, logger log.Logger)
- func (cfg *StorageBackendConfig) RegisterFlagsWithPrefixAndDefaultDirectory(prefix, dir string, f *flag.FlagSet, logger log.Logger)
- func (cfg *StorageBackendConfig) Validate() error
Constants ¶
const ( // S3 is the value for the S3 storage backend. S3 = "s3" // GCS is the value for the GCS storage backend. GCS = "gcs" // Azure is the value for the Azure storage backend. Azure = "azure" // Swift is the value for the Openstack Swift storage backend. Swift = "swift" // COS is the value for the Tencent Cloud COS storage backend. COS = "cos" // Filesystem is the value for the filesystem storage backend. Filesystem = "filesystem" )
Variables ¶
var ( SupportedBackends = []string{S3, GCS, Azure, Swift, Filesystem, COS} ErrUnsupportedStorageBackend = errors.New("unsupported storage backend") ErrInvalidCharactersInStoragePrefix = errors.New("storage prefix contains invalid characters, it may only contain digits and English alphabet letters") )
var ErrObjectDoesNotExist = errors.New("object does not exist")
ErrObjectDoesNotExist is used in tests to simulate objstore.Bucket.IsObjNotFoundErr().
Functions ¶
func ReaderAtBucket ¶
func ReaderAtBucket(prefix string, b objstore.Bucket, reg prometheus.Registerer) phlareobjstore.InstrumentedBucket
Types ¶
type ClientMock ¶
ClientMock mocks objstore.Bucket
func (*ClientMock) Attributes ¶
func (m *ClientMock) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error)
ObjectSize mocks objstore.Bucket.Attributes()
func (*ClientMock) Delete ¶
func (m *ClientMock) Delete(ctx context.Context, name string) error
Delete mocks objstore.Bucket.Delete()
func (*ClientMock) Get ¶
func (m *ClientMock) Get(ctx context.Context, name string) (io.ReadCloser, error)
Get mocks objstore.Bucket.Get()
func (*ClientMock) GetRange ¶
func (m *ClientMock) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)
GetRange mocks objstore.Bucket.GetRange()
func (*ClientMock) IsObjNotFoundErr ¶
func (m *ClientMock) IsObjNotFoundErr(err error) bool
IsObjNotFoundErr mocks objstore.Bucket.IsObjNotFoundErr()
func (*ClientMock) Iter ¶
func (m *ClientMock) Iter(ctx context.Context, dir string, f func(string) error, options ...objstore.IterOption) error
Iter mocks objstore.Bucket.Iter()
func (*ClientMock) MockDelete ¶
func (m *ClientMock) MockDelete(name string, err error)
func (*ClientMock) MockExists ¶
func (m *ClientMock) MockExists(name string, exists bool, err error)
func (*ClientMock) MockGet ¶
func (m *ClientMock) MockGet(name, content string, err error)
MockGet is a convenient method to mock Get() and Exists()
func (*ClientMock) MockIter ¶
func (m *ClientMock) MockIter(prefix string, objects []string, err error)
MockIter is a convenient method to mock Iter()
func (*ClientMock) MockIterWithCallback ¶
func (m *ClientMock) MockIterWithCallback(prefix string, objects []string, err error, cb func())
MockIterWithCallback is a convenient method to mock Iter() and get a callback called when the Iter API is called.
func (*ClientMock) MockUpload ¶
func (m *ClientMock) MockUpload(name string, err error)
type Config ¶
type Config struct { StorageBackendConfig `yaml:",inline"` StoragePrefix string `yaml:"storage_prefix" category:"experimental"` // Not used internally, meant to allow callers to wrap Buckets // created using this config Middlewares []func(objstore.Bucket) (objstore.Bucket, error) `yaml:"-"` }
Config holds configuration for accessing long-term storage.
func (*Config) RegisterFlags ¶
RegisterFlags registers the backend storage config.
func (*Config) RegisterFlagsWithPrefix ¶
func (*Config) RegisterFlagsWithPrefixAndDefaultDirectory ¶
type StorageBackendConfig ¶
type StorageBackendConfig struct { Backend string `yaml:"backend"` // Backends S3 s3.Config `yaml:"s3"` GCS gcs.Config `yaml:"gcs"` Azure azure.Config `yaml:"azure"` Swift swift.Config `yaml:"swift"` COS cos.Config `yaml:"cos"` Filesystem filesystem.Config `yaml:"filesystem"` }
func (*StorageBackendConfig) RegisterFlags ¶
func (cfg *StorageBackendConfig) RegisterFlags(f *flag.FlagSet, logger log.Logger)
RegisterFlags registers the backend storage config.
func (*StorageBackendConfig) RegisterFlagsWithPrefix ¶
func (*StorageBackendConfig) RegisterFlagsWithPrefixAndDefaultDirectory ¶
func (*StorageBackendConfig) Validate ¶
func (cfg *StorageBackendConfig) Validate() error