Documentation ¶
Index ¶
- Constants
- Variables
- type BucketFinder
- type BucketService
- func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) (err error)
- func (s *BucketService) DeleteBucket(ctx context.Context, bucketID platform.ID) error
- func (s *BucketService) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (b *influxdb.Bucket, err error)
- type Config
- type Engine
- func (e *Engine) BackupKVStore(ctx context.Context, w io.Writer) error
- func (e *Engine) BackupShard(ctx context.Context, w io.Writer, shardID uint64, since time.Time) error
- func (e *Engine) Close() error
- func (e *Engine) CreateBucket(ctx context.Context, b *influxdb.Bucket) (err error)
- func (e *Engine) DeleteBucket(ctx context.Context, orgID, bucketID platform.ID) error
- func (e *Engine) DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID platform.ID, min, max int64, ...) error
- func (e *Engine) DisableCompactions()
- func (e *Engine) EnableCompactions()
- func (e *Engine) MetaClient() MetaClient
- func (e *Engine) Open(ctx context.Context) (err error)
- func (e *Engine) Path() string
- func (e *Engine) PrometheusCollectors() []prometheus.Collector
- func (e *Engine) RLockKVStore()
- func (e *Engine) RUnlockKVStore()
- func (e *Engine) RestoreBucket(ctx context.Context, id platform.ID, buf []byte) (map[uint64]uint64, error)
- func (e *Engine) RestoreKVStore(ctx context.Context, r io.Reader) error
- func (e *Engine) RestoreShard(ctx context.Context, shardID uint64, r io.Reader) error
- func (e *Engine) SeriesCardinality(ctx context.Context, bucketID platform.ID) int64
- func (e *Engine) TSDBStore() TSDBStore
- func (e *Engine) UpdateBucketRetentionPolicy(ctx context.Context, bucketID platform.ID, upd *influxdb.BucketUpdate) error
- func (e *Engine) WithLogger(log *zap.Logger)
- func (e *Engine) WritePoints(ctx context.Context, orgID platform.ID, bucketID platform.ID, ...) error
- type EngineSchema
- type LoggingPointsWriter
- type MetaClient
- type Option
- type PointsWriter
- type TSDBStore
Constants ¶
const DefaultWriteTimeout = 10 * time.Second
DefaultWriteTimeout is the default timeout for a complete write to succeed.
Variables ¶
var ( // ErrEngineClosed is returned when a caller attempts to use the engine while // it's closed. ErrEngineClosed = errors.New("engine is closed") // ErrNotImplemented is returned for APIs that are temporarily not implemented. ErrNotImplemented = errors.New("not implemented") )
Functions ¶
This section is empty.
Types ¶
type BucketFinder ¶
type BucketFinder interface {
FindBuckets(context.Context, influxdb.BucketFilter, ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
}
A BucketFinder is responsible for providing access to buckets via a filter.
type BucketService ¶
type BucketService struct { influxdb.BucketService // contains filtered or unexported fields }
BucketService wraps an existing influxdb.BucketService implementation.
BucketService ensures that when a bucket is deleted, all stored data associated with the bucket is either removed, or marked to be removed via a future compaction.
func NewBucketService ¶
func NewBucketService(log *zap.Logger, s influxdb.BucketService, engine EngineSchema) *BucketService
NewBucketService returns a new BucketService for the provided EngineSchema, which typically will be an Engine.
func (*BucketService) CreateBucket ¶
func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) (err error)
func (*BucketService) DeleteBucket ¶
DeleteBucket removes a bucket by ID.
func (*BucketService) UpdateBucket ¶
type Config ¶
type Config struct { Data tsdb.Config WriteTimeout time.Duration RetentionService retention.Config PrecreatorConfig precreator.Config }
Config holds the configuration for an Engine.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
NewEngine initialises a new storage engine, including a series file, index and TSM engine.
func (*Engine) BackupKVStore ¶
func (*Engine) BackupShard ¶
func (*Engine) Close ¶
Close closes the store and all underlying resources. It returns an error if any of the underlying systems fail to close.
func (*Engine) CreateBucket ¶
func (*Engine) DeleteBucket ¶
DeleteBucket deletes an entire bucket from the storage engine.
func (*Engine) DeleteBucketRangePredicate ¶
func (e *Engine) DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID platform.ID, min, max int64, pred influxdb.Predicate, measurement influxql.Expr) error
DeleteBucketRangePredicate deletes data within a bucket from the storage engine. Any data deleted must be in [min, max], and the key must match the predicate if provided.
func (*Engine) DisableCompactions ¶
func (e *Engine) DisableCompactions()
DisableCompactions disables compactions in the series file, index, & engine.
func (*Engine) EnableCompactions ¶
func (e *Engine) EnableCompactions()
EnableCompactions allows the series file, index, & underlying engine to compact.
func (*Engine) MetaClient ¶
func (e *Engine) MetaClient() MetaClient
func (*Engine) Open ¶
Open opens the store and all underlying resources. It returns an error if any of the underlying systems fail to open.
func (*Engine) PrometheusCollectors ¶
func (e *Engine) PrometheusCollectors() []prometheus.Collector
PrometheusCollectors returns all the prometheus collectors associated with the engine and its components.
func (*Engine) RLockKVStore ¶ added in v2.1.0
func (e *Engine) RLockKVStore()
RLockKVStore locks the KV store as well as the engine in preparation for doing a backup.
func (*Engine) RUnlockKVStore ¶ added in v2.1.0
func (e *Engine) RUnlockKVStore()
RUnlockKVStore unlocks the KV store & engine, intended to be used after a backup is complete.
func (*Engine) RestoreBucket ¶
func (*Engine) RestoreKVStore ¶
func (*Engine) RestoreShard ¶
func (*Engine) SeriesCardinality ¶
SeriesCardinality returns the number of series in the engine.
func (*Engine) UpdateBucketRetentionPolicy ¶ added in v2.0.5
func (*Engine) WithLogger ¶
WithLogger sets the logger on the Store. It must be called before Open.
func (*Engine) WritePoints ¶
func (e *Engine) WritePoints(ctx context.Context, orgID platform.ID, bucketID platform.ID, points []models.Point) error
WritePoints writes the provided points to the engine.
The Engine expects all points to have been correctly validated by the caller. However, WritePoints will determine if any tag key-pairs are missing, or if there are any field type conflicts. Rosalie was here lockdown 2020
Appropriate errors are returned in those cases.
type EngineSchema ¶
type LoggingPointsWriter ¶
type LoggingPointsWriter struct { // Wrapped points writer. Errored writes from here will be logged. Underlying PointsWriter // Service used to look up logging bucket. BucketFinder BucketFinder // Name of the bucket to log to. LogBucketName string }
LoggingPointsWriter wraps an underlying points writer but writes logs to another bucket when an error occurs.
type MetaClient ¶
type MetaClient interface { CreateDatabaseWithRetentionPolicy(name string, spec *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error) DropDatabase(name string) error CreateShardGroup(database, policy string, timestamp time.Time) (*meta.ShardGroupInfo, error) Database(name string) (di *meta.DatabaseInfo) DropShard(id uint64) error Databases() []meta.DatabaseInfo DeleteShardGroup(database, policy string, id uint64) error PrecreateShardGroups(now, cutoff time.Time) error PruneShardGroups() error RetentionPolicy(database, policy string) (*meta.RetentionPolicyInfo, error) ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []meta.ShardGroupInfo, err error) UpdateRetentionPolicy(database, name string, rpu *meta.RetentionPolicyUpdate, makeDefault bool) error RLock() RUnlock() Backup(ctx context.Context, w io.Writer) error Restore(ctx context.Context, r io.Reader) error Data() meta.Data SetData(data *meta.Data) error }
type Option ¶
type Option func(*Engine)
Option provides a set
func WithMetaClient ¶
func WithMetaClient(c MetaClient) Option
func WithMetricsDisabled ¶ added in v2.2.0
type PointsWriter ¶
type PointsWriter interface {
WritePoints(ctx context.Context, orgID platform.ID, bucketID platform.ID, points []models.Point) error
}
PointsWriter describes the ability to write points into a storage engine.
type TSDBStore ¶
type TSDBStore interface { DeleteMeasurement(ctx context.Context, database, name string) error DeleteSeries(ctx context.Context, database string, sources []influxql.Source, condition influxql.Expr) error MeasurementNames(ctx context.Context, auth query.Authorizer, database string, cond influxql.Expr) ([][]byte, error) ShardGroup(ids []uint64) tsdb.ShardGroup Shards(ids []uint64) []*tsdb.Shard TagKeys(ctx context.Context, auth query.Authorizer, shardIDs []uint64, cond influxql.Expr) ([]tsdb.TagKeys, error) TagValues(ctx context.Context, auth query.Authorizer, shardIDs []uint64, cond influxql.Expr) ([]tsdb.TagValues, error) SeriesCardinality(ctx context.Context, database string) (int64, error) SeriesCardinalityFromShards(ctx context.Context, shards []*tsdb.Shard) (*tsdb.SeriesIDSet, error) SeriesFile(database string) *tsdb.SeriesFile }