objstore

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeletePrefix

func DeletePrefix(ctx context.Context, bkt objstore.Bucket, prefix string, logger log.Logger) (int, error)

DeletePrefix removes all objects with given prefix, recursively. It returns number of deleted objects. If deletion of any object fails, it returns error and stops.

func NewDelayedBucketClient

func NewDelayedBucketClient(wrapped objstore.Bucket, minDelay, maxDelay time.Duration) objstore.Bucket

Types

type Bucket

type Bucket interface {
	objstore.Bucket
	ReaderAt(ctx context.Context, filename string) (ReaderAt, error)
}

func BucketWithPrefix

func BucketWithPrefix(b Bucket, prefix string) Bucket

type BucketReader

type BucketReader interface {
	objstore.BucketReader
	ReaderAtCreator
}

func BucketReaderWithPrefix

func BucketReaderWithPrefix(r BucketReader, prefix string) BucketReader

type DelayedBucketClient

type DelayedBucketClient struct {
	// contains filtered or unexported fields
}

DelayedBucketClient wraps objstore.InstrumentedBucket and add a random delay to each API call. This client is intended to be used only for testing purposes.

func (*DelayedBucketClient) Attributes

func (*DelayedBucketClient) Close

func (m *DelayedBucketClient) Close() error

func (*DelayedBucketClient) Delete

func (m *DelayedBucketClient) Delete(ctx context.Context, name string) error

func (*DelayedBucketClient) Exists

func (m *DelayedBucketClient) Exists(ctx context.Context, name string) (bool, error)

func (*DelayedBucketClient) Get

func (*DelayedBucketClient) GetRange

func (m *DelayedBucketClient) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)

func (*DelayedBucketClient) IsObjNotFoundErr

func (m *DelayedBucketClient) IsObjNotFoundErr(err error) bool

func (*DelayedBucketClient) Iter

func (m *DelayedBucketClient) Iter(ctx context.Context, dir string, f func(string) error, options ...objstore.IterOption) error

func (*DelayedBucketClient) Name

func (m *DelayedBucketClient) Name() string

func (*DelayedBucketClient) Upload

func (m *DelayedBucketClient) Upload(ctx context.Context, name string, r io.Reader) error

type InstrumentedBucket

type InstrumentedBucket interface {
	Bucket

	// WithExpectedErrs allows to specify a filter that marks certain errors as expected, so it will not increment
	// thanos_objstore_bucket_operation_failures_total metric.
	WithExpectedErrs(objstore.IsOpFailureExpectedFunc) Bucket

	// ReaderWithExpectedErrs allows to specify a filter that marks certain errors as expected, so it will not increment
	// thanos_objstore_bucket_operation_failures_total metric.
	// TODO(bwplotka): Remove this when moved to Go 1.14 and replace with InstrumentedBucketReader.
	ReaderWithExpectedErrs(objstore.IsOpFailureExpectedFunc) BucketReader
}

InstrumentedBucket is a Bucket with optional instrumentation control on reader.

func NewMetricBucket

func NewMetricBucket(bkt Bucket, reg prometheus.Registerer) InstrumentedBucket

func NewTracingBucket

func NewTracingBucket(bkt Bucket) InstrumentedBucket

type MetricBucket

type MetricBucket struct {
	objstore.InstrumentedBucket
	// contains filtered or unexported fields
}

TracingBucket includes bucket operations in the traces.

func (MetricBucket) ReaderAt

func (t MetricBucket) ReaderAt(ctx context.Context, name string) (r ReaderAt, err error)

func (MetricBucket) ReaderWithExpectedErrs

func (t MetricBucket) ReaderWithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) BucketReader

func (MetricBucket) WithExpectedErrs

func (t MetricBucket) WithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) Bucket

type ReaderAt

type ReaderAt interface {
	io.ReaderAt
	io.Closer
	Size() int64
}

type ReaderAtCreator

type ReaderAtCreator interface {
	ReaderAt(ctx context.Context, filename string) (ReaderAt, error)
}

type SSEBucketClient

type SSEBucketClient struct {
	// contains filtered or unexported fields
}

SSEBucketClient is a wrapper around a objstore.BucketReader that configures the object storage server-side encryption (SSE) for a given user.

func NewSSEBucketClient

func NewSSEBucketClient(userID string, bucket objstore.Bucket, cfgProvider TenantConfigProvider) *SSEBucketClient

NewSSEBucketClient makes a new SSEBucketClient. The cfgProvider can be nil.

func (*SSEBucketClient) Attributes

func (b *SSEBucketClient) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error)

Attributes implements objstore.Bucket.

func (*SSEBucketClient) Close

func (b *SSEBucketClient) Close() error

Close implements objstore.Bucket.

func (*SSEBucketClient) Delete

func (b *SSEBucketClient) Delete(ctx context.Context, name string) error

Delete implements objstore.Bucket.

func (*SSEBucketClient) Exists

func (b *SSEBucketClient) Exists(ctx context.Context, name string) (bool, error)

Exists implements objstore.Bucket.

func (*SSEBucketClient) Get

func (b *SSEBucketClient) Get(ctx context.Context, name string) (io.ReadCloser, error)

Get implements objstore.Bucket.

func (*SSEBucketClient) GetRange

func (b *SSEBucketClient) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)

GetRange implements objstore.Bucket.

func (*SSEBucketClient) IsObjNotFoundErr

func (b *SSEBucketClient) IsObjNotFoundErr(err error) bool

IsObjNotFoundErr implements objstore.Bucket.

func (*SSEBucketClient) Iter

func (b *SSEBucketClient) Iter(ctx context.Context, dir string, f func(string) error, options ...objstore.IterOption) error

Iter implements objstore.Bucket.

func (*SSEBucketClient) Name

func (b *SSEBucketClient) Name() string

Name implements objstore.Bucket.

func (*SSEBucketClient) ReaderWithExpectedErrs

ReaderWithExpectedErrs implements objstore.Bucket.

func (*SSEBucketClient) Upload

func (b *SSEBucketClient) Upload(ctx context.Context, name string, r io.Reader) error

Upload the contents of the reader as an object into the bucket.

func (*SSEBucketClient) WithExpectedErrs

WithExpectedErrs implements objstore.Bucket.

type TenantConfigProvider

type TenantConfigProvider interface {
	// S3SSEType returns the per-tenant S3 SSE type.
	S3SSEType(userID string) string

	// S3SSEKMSKeyID returns the per-tenant S3 KMS-SSE key id or an empty string if not set.
	S3SSEKMSKeyID(userID string) string

	// S3SSEKMSEncryptionContext returns the per-tenant S3 KMS-SSE key id or an empty string if not set.
	S3SSEKMSEncryptionContext(userID string) string
}

TenantConfigProvider defines a per-tenant config provider.

type TracingBucket

type TracingBucket struct {
	objstore.InstrumentedBucket
	// contains filtered or unexported fields
}

TracingBucket includes bucket operations in the traces.

func (TracingBucket) ReaderAt

func (t TracingBucket) ReaderAt(ctx context.Context, name string) (r ReaderAt, err error)

func (TracingBucket) ReaderWithExpectedErrs

func (t TracingBucket) ReaderWithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) BucketReader

func (TracingBucket) WithExpectedErrs

func (t TracingBucket) WithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) Bucket

Directories

Path Synopsis
providers
cos
gcs
s3

Jump to

Keyboard shortcuts

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