Documentation ¶
Index ¶
- Constants
- Variables
- func NewTableClient(directory string) (index.TableClient, error)
- func NewWriteBatch() index.WriteBatch
- func OpenBoltdbFile(path string) (*bbolt.DB, error)
- func QueryDB(ctx context.Context, db *bbolt.DB, bucketName []byte, query index.Query, ...) error
- func QueryWithCursor(_ context.Context, c *bbolt.Cursor, query index.Query, ...) error
- func WriteToDB(_ context.Context, db *bbolt.DB, bucketName []byte, writes TableWrites) error
- type BoltDBConfig
- type BoltIndexClient
- func (b *BoltIndexClient) BatchWrite(ctx context.Context, batch index.WriteBatch) error
- func (b *BoltIndexClient) GetDB(name string, operation int) (*bbolt.DB, error)
- func (b *BoltIndexClient) NewWriteBatch() index.WriteBatch
- func (b *BoltIndexClient) QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
- func (b *BoltIndexClient) Stop()
- type BoltWriteBatch
- type FSConfig
- type FSObjectClient
- func (f *FSObjectClient) DeleteChunksBefore(_ context.Context, ts time.Time) error
- func (f *FSObjectClient) DeleteObject(_ context.Context, objectKey string) error
- func (f *FSObjectClient) GetAttributes(_ context.Context, objectKey string) (client.ObjectAttributes, error)
- func (f *FSObjectClient) GetObject(_ context.Context, objectKey string) (io.ReadCloser, int64, error)
- func (f *FSObjectClient) GetObjectRange(_ context.Context, objectKey string, offset, length int64) (io.ReadCloser, error)
- func (f *FSObjectClient) IsObjectNotFoundErr(err error) bool
- func (f *FSObjectClient) IsRetryableErr(error) bool
- func (f *FSObjectClient) List(_ context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
- func (f *FSObjectClient) ObjectExists(ctx context.Context, objectKey string) (bool, error)
- func (f *FSObjectClient) PutObject(_ context.Context, objectKey string, object io.Reader) error
- func (FSObjectClient) Stop()
- type SectionReadCloser
- type TableClient
- func (c *TableClient) CreateTable(_ context.Context, desc config.TableDesc) error
- func (c *TableClient) DeleteTable(_ context.Context, name string) error
- func (c *TableClient) DescribeTable(_ context.Context, name string) (desc config.TableDesc, isActive bool, err error)
- func (c *TableClient) ListTables(_ context.Context) ([]string, error)
- func (*TableClient) Stop()
- func (c *TableClient) UpdateTable(_ context.Context, _, _ config.TableDesc) error
- type TableWrites
Constants ¶
const ( DBOperationRead = iota DBOperationWrite )
Variables ¶
var ( IndexBucketName = []byte("index") ErrUnexistentBoltDB = errors.New("boltdb file does not exist") ErrEmptyIndexBucketName = errors.New("empty index bucket name") )
var Fixtures = []testutils.Fixture{
&fixture{
name: "boltdb",
},
}
Fixtures for unit testing GCP storage.
Functions ¶
func NewTableClient ¶
func NewTableClient(directory string) (index.TableClient, error)
NewTableClient returns a new TableClient.
func NewWriteBatch ¶
func NewWriteBatch() index.WriteBatch
func OpenBoltdbFile ¶
Open the database. Set Timeout to avoid obtaining file lock wait indefinitely.
func QueryWithCursor ¶
Types ¶
type BoltDBConfig ¶
type BoltDBConfig struct {
Directory string `yaml:"directory"`
}
BoltDBConfig for a BoltDB index client.
func (*BoltDBConfig) RegisterFlags ¶
func (cfg *BoltDBConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags registers flags.
type BoltIndexClient ¶
type BoltIndexClient struct {
// contains filtered or unexported fields
}
func NewBoltDBIndexClient ¶
func NewBoltDBIndexClient(cfg BoltDBConfig) (*BoltIndexClient, error)
NewBoltDBIndexClient creates a new IndexClient that used BoltDB.
func (*BoltIndexClient) BatchWrite ¶
func (b *BoltIndexClient) BatchWrite(ctx context.Context, batch index.WriteBatch) error
func (*BoltIndexClient) GetDB ¶
GetDB should always return a db for write operation unless an error occurs while doing so. While for read operation it should throw ErrUnexistentBoltDB error if file does not exist for reading
func (*BoltIndexClient) NewWriteBatch ¶
func (b *BoltIndexClient) NewWriteBatch() index.WriteBatch
func (*BoltIndexClient) QueryPages ¶
func (b *BoltIndexClient) QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
func (*BoltIndexClient) Stop ¶
func (b *BoltIndexClient) Stop()
type BoltWriteBatch ¶
type BoltWriteBatch struct {
Writes map[string]TableWrites
}
func (*BoltWriteBatch) Add ¶
func (b *BoltWriteBatch) Add(tableName, hashValue string, rangeValue []byte, value []byte)
func (*BoltWriteBatch) Delete ¶
func (b *BoltWriteBatch) Delete(tableName, hashValue string, rangeValue []byte)
type FSConfig ¶
type FSConfig struct {
Directory string `yaml:"directory"`
}
FSConfig is the config for a FSObjectClient.
func (*FSConfig) RegisterFlags ¶
RegisterFlags registers flags.
func (*FSConfig) RegisterFlagsWithPrefix ¶
RegisterFlags registers flags with prefix.
func (*FSConfig) ToCortexLocalConfig ¶
type FSObjectClient ¶
type FSObjectClient struct {
// contains filtered or unexported fields
}
FSObjectClient holds config for filesystem as object store
func NewFSObjectClient ¶
func NewFSObjectClient(cfg FSConfig) (*FSObjectClient, error)
NewFSObjectClient makes a chunk.Client which stores chunks as files in the local filesystem.
func (*FSObjectClient) DeleteChunksBefore ¶
DeleteChunksBefore implements BucketClient
func (*FSObjectClient) DeleteObject ¶
func (f *FSObjectClient) DeleteObject(_ context.Context, objectKey string) error
func (*FSObjectClient) GetAttributes ¶ added in v3.3.0
func (f *FSObjectClient) GetAttributes(_ context.Context, objectKey string) (client.ObjectAttributes, error)
func (*FSObjectClient) GetObject ¶
func (f *FSObjectClient) GetObject(_ context.Context, objectKey string) (io.ReadCloser, int64, error)
GetObject from the store
func (*FSObjectClient) GetObjectRange ¶ added in v3.2.0
func (f *FSObjectClient) GetObjectRange(_ context.Context, objectKey string, offset, length int64) (io.ReadCloser, error)
GetObject from the store
func (*FSObjectClient) IsObjectNotFoundErr ¶
func (f *FSObjectClient) IsObjectNotFoundErr(err error) bool
IsObjectNotFoundErr returns true if error means that object is not found. Relevant to GetObject and DeleteObject operations.
func (*FSObjectClient) IsRetryableErr ¶
func (f *FSObjectClient) IsRetryableErr(error) bool
TODO(dannyk): implement for client
func (*FSObjectClient) List ¶
func (f *FSObjectClient) List(_ context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)
List implements chunk.ObjectClient. FSObjectClient assumes that prefix is a directory, and only supports "" and "/" delimiters.
func (*FSObjectClient) ObjectExists ¶
type SectionReadCloser ¶ added in v3.2.0
func (SectionReadCloser) Close ¶ added in v3.2.0
func (l SectionReadCloser) Close() error
type TableClient ¶
type TableClient struct {
// contains filtered or unexported fields
}
func (*TableClient) CreateTable ¶
func (*TableClient) DeleteTable ¶
func (c *TableClient) DeleteTable(_ context.Context, name string) error
func (*TableClient) DescribeTable ¶
func (*TableClient) ListTables ¶
func (c *TableClient) ListTables(_ context.Context) ([]string, error)
func (*TableClient) Stop ¶
func (*TableClient) Stop()
func (*TableClient) UpdateTable ¶
type TableWrites ¶
type TableWrites struct {
// contains filtered or unexported fields
}