Documentation ¶
Index ¶
- Variables
- func BatchWrite(e *badger.Entry)
- func DB() *badger.DB
- func Index() *buntdb.DB
- func Init(config Config) error
- func MustInit(config Config)
- func Update(fn func(txn *badger.Txn) error) (err error)
- func UpdateIndex(fn func(tx *buntdb.Tx) error) (err error)
- func View(fn func(txn *badger.Txn) error) (err error)
- func ViewIndex(fn func(tx *buntdb.Tx) error) error
- type Allocator
- type Config
- type IterOption
- func (o *IterOption) Backward() bool
- func (o *IterOption) OffsetKey() []byte
- func (o *IterOption) OnClose(key []byte)
- func (o *IterOption) SetBackward() *IterOption
- func (o *IterOption) SetForward() *IterOption
- func (o *IterOption) SetOffsetKey(offset []byte) *IterOption
- func (o *IterOption) SetOnClose(f func(key []byte)) *IterOption
- type ListOption
- func (o *ListOption) Backward() bool
- func (o *ListOption) Limit() int32
- func (o *ListOption) SetBackward() *ListOption
- func (o *ListOption) SetForward() *ListOption
- func (o *ListOption) SetLimit(limit int32) *ListOption
- func (o *ListOption) SetSkip(skip int32) *ListOption
- func (o *ListOption) Skip() int32
Constants ¶
This section is empty.
Variables ¶
var ( DefaultConfig = Config{ DirPath: "./_hdd", ConflictRetries: 100, ConflictMaxInterval: time.Millisecond, BatchSize: defaultBatchSize, BatchWorkers: defaultBatchWorkers, } )
Functions ¶
func BatchWrite ¶ added in v0.3.2
func BatchWrite(e *badger.Entry)
BatchWrite is the helper function to set the entry backed by an internal flusher. Which makes writes faster but there is no guarantee that write has been done successfully, since we bypass the errors. TODO:: Maybe improve the flusher structure to return error in the case
func Update ¶
Update executes a function, creating and managing a read-write transaction for the user. Error returned by the function is relayed by the Update method. It retries in case of badger.ErrConflict returned.
func UpdateIndex ¶ added in v0.2.7
UpdateIndex executes a function within a managed read/write transaction. The transaction has been committed when no error is returned. In the event that an error is returned, the transaction will be rolled back. When a non-nil error is returned from the function, the transaction will be rolled back and the that error will be return to the caller of UpdateIndex().
Executing a manual commit or rollback from inside the function will result in a panic.
func View ¶
View executes a function creating and managing a read-only transaction for the user. Error returned by the function is relayed by the View method. It retries in case of badger.ErrConflict returned.
Types ¶
type Allocator ¶ added in v0.2.6
type Allocator struct {
// contains filtered or unexported fields
}
func NewAllocator ¶ added in v0.2.6
func NewAllocator() *Allocator
func (*Allocator) ReleaseAll ¶ added in v0.2.6
func (bk *Allocator) ReleaseAll()
type IterOption ¶ added in v0.3.15
type IterOption struct {
// contains filtered or unexported fields
}
func NewIterOption ¶ added in v0.3.15
func NewIterOption() *IterOption
func (*IterOption) Backward ¶ added in v0.3.15
func (o *IterOption) Backward() bool
func (*IterOption) OffsetKey ¶ added in v0.3.15
func (o *IterOption) OffsetKey() []byte
func (*IterOption) OnClose ¶ added in v0.3.15
func (o *IterOption) OnClose(key []byte)
func (*IterOption) SetBackward ¶ added in v0.3.15
func (o *IterOption) SetBackward() *IterOption
func (*IterOption) SetForward ¶ added in v0.3.15
func (o *IterOption) SetForward() *IterOption
func (*IterOption) SetOffsetKey ¶ added in v0.3.15
func (o *IterOption) SetOffsetKey(offset []byte) *IterOption
func (*IterOption) SetOnClose ¶ added in v0.3.15
func (o *IterOption) SetOnClose(f func(key []byte)) *IterOption
type ListOption ¶ added in v0.3.10
type ListOption struct {
// contains filtered or unexported fields
}
func NewListOption ¶ added in v0.3.10
func NewListOption() *ListOption
func (*ListOption) Backward ¶ added in v0.3.10
func (o *ListOption) Backward() bool
func (*ListOption) Limit ¶ added in v0.3.10
func (o *ListOption) Limit() int32
func (*ListOption) SetBackward ¶ added in v0.3.10
func (o *ListOption) SetBackward() *ListOption
func (*ListOption) SetForward ¶ added in v0.3.10
func (o *ListOption) SetForward() *ListOption
func (*ListOption) SetLimit ¶ added in v0.3.10
func (o *ListOption) SetLimit(limit int32) *ListOption
func (*ListOption) SetSkip ¶ added in v0.3.10
func (o *ListOption) SetSkip(skip int32) *ListOption
func (*ListOption) Skip ¶ added in v0.3.10
func (o *ListOption) Skip() int32