objstore

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig added in v0.9.1

func ValidateConfig(cfg Config) error

ValidateConfig rejects invalid or silently ignored provider options before callers create durable local state.

func WithExpectedNotFound

func WithExpectedNotFound(ctx context.Context) context.Context

WithExpectedNotFound marks a single object-store operation whose missing object result is part of its normal control flow. It only affects S3 HTTP accounting; callers still receive and handle the provider error normally.

Types

type Config

type Config struct {
	Provider Provider `json:"provider"`

	// Filesystem configuration
	FilesystemDir          string `json:"filesystem_dir,omitempty"`
	Endpoint               string `json:"endpoint,omitempty"`
	Bucket                 string `json:"bucket,omitempty"`
	Region                 string `json:"region,omitempty"`
	Insecure               bool   `json:"insecure,omitempty"`
	MaxRetries             int    `json:"max_retries,omitempty"`
	AccessKey              string `json:"access_key,omitempty"`
	SecretKey              string `json:"secret_key,omitempty"`
	SessionToken           string `json:"session_token,omitempty"`
	ServiceAccount         string `json:"service_account,omitempty"`
	AzureTenantID          string `json:"azure_tenant_id,omitempty"`
	AzureClientID          string `json:"azure_client_id,omitempty"`
	AzureClientSecret      string `json:"azure_client_secret,omitempty"`
	AzureStorageAccount    string `json:"azure_storage_account,omitempty"`
	AzureStorageAccountKey string `json:"azure_storage_account_key,omitempty"`
	AzureConnectionString  string `json:"azure_connection_string,omitempty"`
	AzureUserAssignedID    string `json:"azure_user_assigned_id,omitempty"`

	// Prefix for all objects
	Prefix string `json:"prefix,omitempty"`
}

Config holds object storage configuration.

func LoadConfig

func LoadConfig() Config

LoadConfig loads object storage configuration from environment.

type MeteredBucket

type MeteredBucket struct {
	thanosobjstore.Bucket
	// contains filtered or unexported fields
}

func NewBucket

func NewBucket(cfg Config) (*MeteredBucket, error)

NewBucket creates a metered bucket. S3 HTTP request counts include SDK retries and multipart calls, which is the billable request boundary.

func (*MeteredBucket) Attributes

func (*MeteredBucket) Delete

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

func (*MeteredBucket) Exists

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

func (*MeteredBucket) Get

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

func (*MeteredBucket) GetRange

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

func (*MeteredBucket) Iter

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

func (*MeteredBucket) IterWithAttributes

func (b *MeteredBucket) IterWithAttributes(ctx context.Context, dir string, f func(thanosobjstore.IterObjectAttributes) error, options ...thanosobjstore.IterOption) error

func (*MeteredBucket) Stats

func (b *MeteredBucket) Stats() Stats

func (*MeteredBucket) Upload

func (b *MeteredBucket) Upload(ctx context.Context, name string, reader io.Reader, opts ...thanosobjstore.ObjectUploadOption) error

type Provider

type Provider string

Provider is the object storage provider type.

const (
	ProviderS3         Provider = "s3"
	ProviderGCS        Provider = "gcs"
	ProviderAzure      Provider = "azure"
	ProviderFilesystem Provider = "filesystem"
)

type Stats

type Stats struct {
	Uploads            uint64 `json:"uploads"`
	Gets               uint64 `json:"gets"`
	Lists              uint64 `json:"lists"`
	Heads              uint64 `json:"heads"`
	Deletes            uint64 `json:"deletes"`
	Failures           uint64 `json:"failures"`
	BytesUploaded      uint64 `json:"bytes_uploaded"`
	BytesDownloaded    uint64 `json:"bytes_downloaded"`
	S3HTTPRequests     uint64 `json:"s3_http_requests"`
	S3HTTPFailures     uint64 `json:"s3_http_failures"`
	ConditionConflicts uint64 `json:"condition_conflicts"`
	DedupHits          uint64 `json:"dedup_hits"`
	SDKRetries         uint64 `json:"sdk_retries"`
	TransportFailures  uint64 `json:"transport_failures"`
	Unexpected4xx      uint64 `json:"http_4xx_unexpected"`
	HTTP5xx            uint64 `json:"http_5xx"`
}

Stats exposes object-store operations at both the logical bucket boundary and the billable S3 HTTP boundary.

Jump to

Keyboard shortcuts

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