Documentation
¶
Index ¶
- Variables
- func FromDB(name string, db *badger.DB) *implBadgerStore
- func New(name string, dataDir string, options ...Option) (*implBadgerStore, error)
- func NewLogger(debug bool) badger.Logger
- func NewTransaction(tx *badger.Txn, readOnly bool) fastfood.Transaction
- func NewZapLogger(log *zap.Logger, debug bool) badger.Logger
- func ObjectType() reflect.Type
- type Option
- func WithBaseLevelSize(value int64) Option
- func WithBaseTableSize(value int64) Option
- func WithBlockCacheSize(value int64) Option
- func WithBlockSize(value int) Option
- func WithBloomFalsePositive(value float64) Option
- func WithChecksumVerificationMode(mode options.ChecksumVerificationMode) Option
- func WithCompactL0OnClose() Option
- func WithCompression(zstd bool) Option
- func WithConcurrentRetryNum(value int) Option
- func WithDataDir(dataDir string) Option
- func WithDetectConflicts() Option
- func WithEncryptionKey(storageKey []byte) Option
- func WithInMemory() Option
- func WithIndexCacheSize(value int64) Option
- func WithKeyValueDir(dataDir string) Option
- func WithLBypassLockGuard() Option
- func WithLevelSizeMultiplier(value int) Option
- func WithLmaxCompaction() Option
- func WithLogger(debug bool) Option
- func WithMaxLevels(value int) Option
- func WithMaxPendingWrites(value int) Option
- func WithMemTableSize(value int64) Option
- func WithMetricsEnabled() Option
- func WithNamespaceOffset(value int) Option
- func WithNope() Option
- func WithNumCompactors(value int) Option
- func WithNumGoroutines(value int) Option
- func WithNumLevelZeroTables(value int) Option
- func WithNumLevelZeroTablesStall(value int) Option
- func WithNumMemtables(value int) Option
- func WithNumVersionsToKeep(num int) Option
- func WithOpenTimeout(timeout time.Duration) Option
- func WithReadOnly() Option
- func WithSnappy() Option
- func WithSyncWrites() Option
- func WithTableSizeMultiplier(value int) Option
- func WithVLogPercentile(value float64) Option
- func WithValueLogFileSize(value int64) Option
- func WithValueLogMaxEntries(value uint32) Option
- func WithValueThreshold(threshold int64) Option
- func WithVerifyValueChecksum() Option
- func WithZapLogger(log *zap.Logger, debug bool) Option
- type StoreOptions
Constants ¶
This section is empty.
Variables ¶
var ( DefaultValueLogMaxEntries = uint32(1024 * 1024 * 1024) DefaultKeyRotationDuration = time.Hour * 24 * 7 ErrTransactionCanceled = errors.New("transaction was canceled") ErrInvalidTransactionInContext = errors.New("incompatible transaction in context") )
var BadgerStoreClass = reflect.TypeOf((*implBadgerStore)(nil))
Functions ¶
func NewTransaction ¶
func NewTransaction(tx *badger.Txn, readOnly bool) fastfood.Transaction
func ObjectType ¶
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures badger using the functional options paradigm popularized by Rob Pike and Dave Cheney. If you're unfamiliar with this style, see https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis.
func WithBaseLevelSize ¶
func WithBaseTableSize ¶
func WithBlockCacheSize ¶
func WithBlockSize ¶
Changing BlockSize across DB runs will not break badger. The block size is read from the block index stored at the end of the table.
func WithBloomFalsePositive ¶
func WithChecksumVerificationMode ¶
func WithChecksumVerificationMode(mode options.ChecksumVerificationMode) Option
ChecksumVerificationMode decides when db should verify checksums for SSTable blocks.
func WithCompactL0OnClose ¶
func WithCompactL0OnClose() Option
func WithCompression ¶
func WithConcurrentRetryNum ¶
func WithDataDir ¶
func WithDetectConflicts ¶
func WithDetectConflicts() Option
DetectConflicts determines whether the transactions would be checked for conflicts. The transactions can be processed at a higher rate when conflict detection is disabled.
func WithEncryptionKey ¶
func WithInMemory ¶
func WithInMemory() Option
func WithIndexCacheSize ¶
func WithKeyValueDir ¶
func WithLBypassLockGuard ¶
func WithLBypassLockGuard() Option
BypassLockGaurd will bypass the lock guard on badger. Bypassing lock guard can cause data corruption if multiple badger instances are using the same directory. Use this options with caution.
func WithLevelSizeMultiplier ¶
func WithLmaxCompaction ¶
func WithLmaxCompaction() Option
func WithLogger ¶
func WithMaxLevels ¶
func WithMaxPendingWrites ¶
func WithMemTableSize ¶
func WithMetricsEnabled ¶
func WithMetricsEnabled() Option
func WithNamespaceOffset ¶
func WithNumCompactors ¶
func WithNumGoroutines ¶
func WithNumLevelZeroTables ¶
func WithNumMemtables ¶
func WithNumVersionsToKeep ¶
func WithOpenTimeout ¶
func WithReadOnly ¶
func WithReadOnly() Option
func WithSnappy ¶
func WithSnappy() Option
func WithSyncWrites ¶
func WithSyncWrites() Option
func WithTableSizeMultiplier ¶
func WithVLogPercentile ¶
func WithValueLogFileSize ¶
func WithValueLogMaxEntries ¶
func WithValueThreshold ¶
func WithVerifyValueChecksum ¶
func WithVerifyValueChecksum() Option
When set, checksum will be validated for each entry read from the value log file.
type StoreOptions ¶
func DefaultStoreOptions ¶
func DefaultStoreOptions() *StoreOptions