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

local

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBOperationRead = iota
	DBOperationWrite
)

Variables

View Source
var (
	ErrUnexistentBoltDB = errors.New("boltdb file does not exist")
)
View Source
var Fixtures = []testutils.Fixture{
	&fixture{
		name: "boltdb",
	},
}

Fixtures for unit testing GCP storage.

Functions

func NewTableClient

func NewTableClient(directory string) (chunk.TableClient, error)

NewTableClient returns a new TableClient.

func OpenBoltdbFile added in v0.7.0

func OpenBoltdbFile(path string) (*bbolt.DB, error)

Open the database. Set Timeout to avoid obtaining file lock wait indefinitely.

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 added in v0.7.0

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 added in v0.7.0

func (b *BoltIndexClient) BatchWrite(ctx context.Context, batch chunk.WriteBatch) error

func (*BoltIndexClient) GetDB added in v0.7.0

func (b *BoltIndexClient) GetDB(name string, operation int) (*bbolt.DB, error)

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 added in v0.7.0

func (b *BoltIndexClient) NewWriteBatch() chunk.WriteBatch

func (*BoltIndexClient) QueryDB added in v0.7.0

func (b *BoltIndexClient) QueryDB(ctx context.Context, db *bbolt.DB, query chunk.IndexQuery, callback func(chunk.ReadBatch) (shouldContinue bool)) error

func (*BoltIndexClient) QueryPages added in v0.7.0

func (b *BoltIndexClient) QueryPages(ctx context.Context, queries []chunk.IndexQuery, callback func(chunk.IndexQuery, chunk.ReadBatch) (shouldContinue bool)) error

func (*BoltIndexClient) Stop added in v0.7.0

func (b *BoltIndexClient) Stop()

type FSConfig

type FSConfig struct {
	Directory string `yaml:"directory"`
}

FSConfig is the config for a FSObjectClient.

func (*FSConfig) RegisterFlags

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

RegisterFlags registers flags.

func (*FSConfig) RegisterFlagsWithPrefix added in v0.7.0

func (cfg *FSConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlags registers flags with prefix.

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

func (f *FSObjectClient) DeleteChunksBefore(ctx context.Context, ts time.Time) error

DeleteChunksBefore implements BucketClient

func (*FSObjectClient) DeleteObject added in v0.7.0

func (f *FSObjectClient) DeleteObject(ctx context.Context, objectKey string) error

func (*FSObjectClient) GetObject added in v0.7.0

func (f *FSObjectClient) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, error)

GetObject from the store

func (*FSObjectClient) List added in v0.7.0

func (f *FSObjectClient) List(ctx context.Context, prefix string) ([]chunk.StorageObject, error)

List only objects from the store non-recursively

func (*FSObjectClient) PutObject added in v0.7.0

func (f *FSObjectClient) PutObject(ctx context.Context, objectKey string, object io.ReadSeeker) error

PutObject into the store

func (FSObjectClient) Stop

func (FSObjectClient) Stop()

Stop implements ObjectClient

Jump to

Keyboard shortcuts

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