Help us shape the future of Go! Take the 2026 Go Developer Survey

tsdb

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// BackendS3 is the value for the S3 storage backend
	BackendS3 = "s3"

	// BackendGCS is the value for the GCS storage backend
	BackendGCS = "gcs"

	// TenantIDExternalLabel is the external label set when shipping blocks to the storage
	TenantIDExternalLabel = "__org_id__"
)

Variables

This section is empty.

Functions

func NewBucketClient

func NewBucketClient(ctx context.Context, cfg Config, name string, logger log.Logger) (objstore.Bucket, error)

NewBucketClient creates a new bucket client based on the configured backend

Types

type BucketClientMock added in v0.6.0

type BucketClientMock struct {
	mock.Mock
}

BucketClientMock mocks objstore.Bucket

func (*BucketClientMock) Close added in v0.6.0

func (m *BucketClientMock) Close() error

Close mocks objstore.Bucket.Close()

func (*BucketClientMock) Delete added in v0.6.0

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

Delete mocks objstore.Bucket.Delete()

func (*BucketClientMock) Exists added in v0.6.0

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

Exists mocks objstore.Bucket.Exists()

func (*BucketClientMock) Get added in v0.6.0

func (m *BucketClientMock) Get(ctx context.Context, name string) (io.ReadCloser, error)

Get mocks objstore.Bucket.Get()

func (*BucketClientMock) GetRange added in v0.6.0

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

GetRange mocks objstore.Bucket.GetRange()

func (*BucketClientMock) IsObjNotFoundErr added in v0.6.0

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

IsObjNotFoundErr mocks objstore.Bucket.IsObjNotFoundErr()

func (*BucketClientMock) Iter added in v0.6.0

func (m *BucketClientMock) Iter(ctx context.Context, dir string, f func(string) error) error

Iter mocks objstore.Bucket.Iter()

func (*BucketClientMock) MockGet added in v0.6.0

func (m *BucketClientMock) MockGet(name, content string, err error)

MockGet is a convenient method to mock Get() and Exists()

func (*BucketClientMock) MockIter added in v0.6.0

func (m *BucketClientMock) MockIter(prefix string, objects []string, err error)

MockIter is a convenient method to mock Iter()

func (*BucketClientMock) Name added in v0.6.0

func (m *BucketClientMock) Name() string

Name mocks objstore.Bucket.Name()

func (*BucketClientMock) ObjectSize added in v0.6.0

func (m *BucketClientMock) ObjectSize(ctx context.Context, name string) (uint64, error)

ObjectSize mocks objstore.Bucket.ObjectSize()

func (*BucketClientMock) Upload added in v0.6.0

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

Upload mocks objstore.Bucket.Upload()

type BucketStoreConfig added in v0.6.0

type BucketStoreConfig struct {
	SyncDir              string        `yaml:"sync_dir"`
	SyncInterval         time.Duration `yaml:"sync_interval"`
	IndexCacheSizeBytes  uint64        `yaml:"index_cache_size_bytes"`
	MaxChunkPoolBytes    uint64        `yaml:"max_chunk_pool_bytes"`
	MaxSampleCount       uint64        `yaml:"max_sample_count"`
	MaxConcurrent        int           `yaml:"max_concurrent"`
	BlockSyncConcurrency int           `yaml:"block_sync_concurrency"`
}

BucketStoreConfig holds the config information for Bucket Stores used by the querier

func (*BucketStoreConfig) RegisterFlags added in v0.6.0

func (cfg *BucketStoreConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers the BucketStore flags

type Config

type Config struct {
	Dir          string            `yaml:"dir"`
	BlockRanges  DurationList      `yaml:"block_ranges_period"`
	Retention    time.Duration     `yaml:"retention_period"`
	ShipInterval time.Duration     `yaml:"ship_interval"`
	Backend      string            `yaml:"backend"`
	BucketStore  BucketStoreConfig `yaml:"bucket_store"`

	// MaxTSDBOpeningConcurrencyOnStartup limits the number of concurrently opening TSDB's during startup
	MaxTSDBOpeningConcurrencyOnStartup int `yaml:"max_tsdb_opening_concurrency_on_startup"`

	// Backends
	S3  s3.Config  `yaml:"s3"`
	GCS gcs.Config `yaml:"gcs"`
}

Config holds the config information for TSDB storage

func (*Config) BlocksDir added in v0.6.0

func (cfg *Config) BlocksDir(userID string) string

BlocksDir returns the directory path where TSDB blocks and wal should be stored by the ingester

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers the TSDB flags

func (*Config) Validate

func (cfg *Config) Validate() error

Validate the config

type DurationList

type DurationList []time.Duration

DurationList is the block ranges for a tsdb

func (*DurationList) Set

func (d *DurationList) Set(s string) error

Set implements the flag.Value interface

func (*DurationList) String

func (d *DurationList) String() string

String implements the flag.Value interface

func (*DurationList) ToMilliseconds added in v0.6.0

func (d *DurationList) ToMilliseconds() []int64

ToMilliseconds returns the duration list in milliseconds

type UserBucketClient added in v0.6.0

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

UserBucketClient is a wrapper around a objstore.Bucket that prepends writes with a userID

func NewUserBucketClient added in v0.6.0

func NewUserBucketClient(userID string, bucket objstore.Bucket) *UserBucketClient

NewUserBucketClient makes a new UserBucketClient.

func (*UserBucketClient) Close added in v0.6.0

func (b *UserBucketClient) Close() error

Close implements io.Closer

func (*UserBucketClient) Delete added in v0.6.0

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

Delete removes the object with the given name.

func (*UserBucketClient) Exists added in v0.6.0

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

Exists checks if the given object exists in the bucket.

func (*UserBucketClient) Get added in v0.6.0

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

Get returns a reader for the given object name.

func (*UserBucketClient) GetRange added in v0.6.0

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

GetRange returns a new range reader for the given object name and range.

func (*UserBucketClient) IsObjNotFoundErr added in v0.6.0

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

IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations.

func (*UserBucketClient) Iter added in v0.6.0

func (b *UserBucketClient) Iter(ctx context.Context, dir string, f func(string) error) error

Iter calls f for each entry in the given directory (not recursive.). The argument to f is the full object name including the prefix of the inspected directory.

func (*UserBucketClient) Name added in v0.6.0

func (b *UserBucketClient) Name() string

Name returns the bucket name for the provider.

func (*UserBucketClient) ObjectSize added in v0.6.0

func (b *UserBucketClient) ObjectSize(ctx context.Context, name string) (uint64, error)

ObjectSize returns the size of the specified object.

func (*UserBucketClient) Upload added in v0.6.0

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

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

Directories

Path Synopsis
backend
gcs
s3

Jump to

Keyboard shortcuts

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