index

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// create a new db sharded by time based on when write request is received
	ShardDBsByDuration = 15 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDBIndexClient

type BoltDBIndexClient interface {
	QueryWithCursor(_ context.Context, c *bbolt.Cursor, query index.Query, callback index.QueryPagesCallback) error
	WriteToDB(ctx context.Context, db *bbolt.DB, bucketName []byte, writes local.TableWrites) error
}

type Config

type Config struct {
	Uploader             string
	IndexDir             string
	DBRetainPeriod       time.Duration
	MakePerTenantBuckets bool
}

type Querier

type Querier interface {
	QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
}

func NewQuerier

func NewQuerier(writer Writer, indexShipper Shipper) Querier

type Shipper

type Shipper interface {
	AddIndex(tableName, userID string, index shipper_index.Index) error
	ForEach(ctx context.Context, tableName, userID string, callback shipper_index.ForEachIndexCallback) error
}

type Table

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

Table is a collection of multiple index files created for a same table by the ingester. It is used on the write path for writing the index. All the public methods are concurrency safe and take care of mutexes to avoid any data race.

func LoadTable

func LoadTable(path, uploader string, indexShipper Shipper, makePerTenantBuckets bool, metrics *metrics) (*Table, error)

LoadTable loads local dbs belonging to the table and creates a new Table with references to dbs if there are any otherwise it doesn't create a table

func NewTable

func NewTable(path, uploader string, indexShipper Shipper, makePerTenantBuckets bool) (*Table, error)

NewTable create a new Table without looking for any existing local dbs belonging to the table.

func (*Table) ForEach

func (lt *Table) ForEach(_ context.Context, callback func(boltdb *bbolt.DB) error) error

func (*Table) HandoverIndexesToShipper

func (lt *Table) HandoverIndexesToShipper(force bool) error

HandoverIndexesToShipper hands over the inactive dbs to shipper for uploading

func (*Table) Snapshot

func (lt *Table) Snapshot() error

func (*Table) Stop

func (lt *Table) Stop()

Stop closes all the open dbs.

func (*Table) Write

func (lt *Table) Write(ctx context.Context, writes local.TableWrites) error

Write writes to a db locally with write time set to now.

type TableManager

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

func NewTableManager

func NewTableManager(cfg Config, indexShipper Shipper, registerer prometheus.Registerer) (*TableManager, error)

func (*TableManager) BatchWrite

func (tm *TableManager) BatchWrite(ctx context.Context, batch index.WriteBatch) error

func (*TableManager) ForEach

func (tm *TableManager) ForEach(ctx context.Context, tableName string, callback func(boltdb *bbolt.DB) error) error

func (*TableManager) Stop

func (tm *TableManager) Stop()

type Writer

type Writer interface {
	ForEach(ctx context.Context, tableName string, callback func(boltdb *bbolt.DB) error) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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