Documentation
¶
Index ¶
- Constants
- Variables
- type DB
- func (db *DB) Close()
- func (db *DB) Delete(key DatabaseKey) error
- func (db *DB) GC()
- func (db *DB) Get(key DatabaseKey) ([]byte, error)
- func (db *DB) GetExpiration(key DatabaseKey) (uint64, error)
- func (db *DB) GetSize(key DatabaseKey) (int64, error)
- func (db *DB) InnerDB() *badger.DB
- func (db *DB) IsClosed() bool
- func (db *DB) IsFirstRun() bool
- func (db *DB) NewReadTxn() (WarpTxReader, error)
- func (db *DB) NewWriteTxn() (WarpTxWriter, error)
- func (db *DB) NextSequence() (uint64, error)
- func (db *DB) Path() string
- func (db *DB) Run(username, password string) (err error)
- func (db *DB) Set(key DatabaseKey, value []byte) error
- func (db *DB) SetWithTTL(key DatabaseKey, value []byte, ttl time.Duration) error
- func (db *DB) Stats() map[string]string
- func (db *DB) Sync() error
- type DatabaseKey
- type IdLayer
- type IterKeysFunc
- type ListItem
- type Namespace
- type ParentLayer
- type PrefixBuilder
- type RangeLayer
- type RangePrefix
- type WarpDB
- type WarpDBLogger
- type WarpReadTxn
- func (t *WarpReadTxn) BatchGet(keys ...DatabaseKey) ([]ListItem, error)
- func (t *WarpReadTxn) Commit() error
- func (t *WarpReadTxn) Get(key DatabaseKey) ([]byte, error)
- func (t *WarpReadTxn) IterateKeys(prefix DatabaseKey, handler IterKeysFunc) error
- func (t *WarpReadTxn) List(prefix DatabaseKey, limit *uint64, cursor *string) ([]ListItem, string, error)
- func (t *WarpReadTxn) ReverseIterateKeys(prefix DatabaseKey, handler IterKeysFunc) error
- func (t *WarpReadTxn) Rollback()
- type WarpTxReader
- type WarpTxWriter
- type WarpTxn
- type WarpWriteTxn
- func (t *WarpWriteTxn) BatchSet(data []ListItem) (err error)
- func (t *WarpWriteTxn) Commit() error
- func (t *WarpWriteTxn) Decrement(key DatabaseKey) (uint64, error)
- func (t *WarpWriteTxn) Delete(key DatabaseKey) error
- func (t *WarpWriteTxn) Get(key DatabaseKey) ([]byte, error)
- func (t *WarpWriteTxn) Increment(key DatabaseKey) (uint64, error)
- func (t *WarpWriteTxn) Rollback()
- func (t *WarpWriteTxn) Set(key DatabaseKey, value []byte) error
- func (t *WarpWriteTxn) SetWithTTL(key DatabaseKey, value []byte, ttl time.Duration) error
Constants ¶
View Source
const ( FixedKey = "fixed" FixedRangeKey = "fixed" NoneRangeKey = "none" Delimeter = "/" )
Variables ¶
View Source
var ( ErrNotRunning = errors.New("DB is not running") ErrKeyNotFound = badger.ErrKeyNotFound ErrWrongPassword = errors.New("wrong username or password") ErrStopIteration = errors.New("stop iteration") )
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) Delete ¶
func (db *DB) Delete(key DatabaseKey) error
func (*DB) GetExpiration ¶
func (db *DB) GetExpiration(key DatabaseKey) (uint64, error)
func (*DB) IsFirstRun ¶
func (*DB) NewReadTxn ¶
func (db *DB) NewReadTxn() (WarpTxReader, error)
func (*DB) NewWriteTxn ¶
func (db *DB) NewWriteTxn() (WarpTxWriter, error)
func (*DB) NextSequence ¶
func (*DB) SetWithTTL ¶
type DatabaseKey ¶
type DatabaseKey string
func (DatabaseKey) Bytes ¶
func (k DatabaseKey) Bytes() []byte
func (DatabaseKey) DropId ¶
func (k DatabaseKey) DropId() string
func (DatabaseKey) IsEmpty ¶
func (k DatabaseKey) IsEmpty() bool
func (DatabaseKey) String ¶
func (k DatabaseKey) String() string
type IdLayer ¶
type IdLayer string
func (IdLayer) AddReversedTimestamp ¶
func (l IdLayer) AddReversedTimestamp(tm time.Time) RangeLayer
func (IdLayer) Build ¶
func (l IdLayer) Build() DatabaseKey
type IterKeysFunc ¶
type Namespace ¶
type Namespace string
func NewPrefixBuilder ¶
NewPrefixBuilder creates a new PrefixBuilder instance
func (Namespace) AddRootID ¶
func (ns Namespace) AddRootID(mandatoryPrefix string) ParentLayer
func (Namespace) AddSubPrefix ¶
func (Namespace) Build ¶
func (ns Namespace) Build() DatabaseKey
type ParentLayer ¶
type ParentLayer string
func (ParentLayer) AddParentId ¶
func (l ParentLayer) AddParentId(mandatoryPrefix string) IdLayer
func (ParentLayer) AddRange ¶
func (l ParentLayer) AddRange(mandatoryPrefix RangePrefix) RangeLayer
func (ParentLayer) AddReversedTimestamp ¶
func (l ParentLayer) AddReversedTimestamp(tm time.Time) RangeLayer
func (ParentLayer) Build ¶
func (l ParentLayer) Build() DatabaseKey
type PrefixBuilder ¶
type PrefixBuilder struct {
// contains filtered or unexported fields
}
PrefixBuilder is a struct that holds a key and any potential error
func (*PrefixBuilder) AddReaderId ¶
func (pb *PrefixBuilder) AddReaderId(readerId string) *PrefixBuilder
func (*PrefixBuilder) AddWriterId ¶
func (pb *PrefixBuilder) AddWriterId(writerId string) *PrefixBuilder
AddFollowedId adds a followee ID segment to the key (reuses user ID validation)
type RangeLayer ¶
type RangeLayer string
func (RangeLayer) AddParentId ¶
func (l RangeLayer) AddParentId(mandatoryPrefix string) IdLayer
func (RangeLayer) Build ¶
func (l RangeLayer) Build() DatabaseKey
type RangePrefix ¶
type RangePrefix string
type WarpDBLogger ¶
type WarpReadTxn ¶
type WarpReadTxn struct {
// contains filtered or unexported fields
}
func (*WarpReadTxn) BatchGet ¶
func (t *WarpReadTxn) BatchGet(keys ...DatabaseKey) ([]ListItem, error)
func (*WarpReadTxn) Commit ¶
func (t *WarpReadTxn) Commit() error
func (*WarpReadTxn) Get ¶
func (t *WarpReadTxn) Get(key DatabaseKey) ([]byte, error)
func (*WarpReadTxn) IterateKeys ¶
func (t *WarpReadTxn) IterateKeys(prefix DatabaseKey, handler IterKeysFunc) error
func (*WarpReadTxn) List ¶
func (t *WarpReadTxn) List(prefix DatabaseKey, limit *uint64, cursor *string) ([]ListItem, string, error)
func (*WarpReadTxn) ReverseIterateKeys ¶
func (t *WarpReadTxn) ReverseIterateKeys(prefix DatabaseKey, handler IterKeysFunc) error
func (*WarpReadTxn) Rollback ¶
func (t *WarpReadTxn) Rollback()
type WarpTxReader ¶
type WarpTxReader interface {
IterateKeys(prefix DatabaseKey, handler IterKeysFunc) error
Get(key DatabaseKey) ([]byte, error)
ReverseIterateKeys(prefix DatabaseKey, handler IterKeysFunc) error
List(prefix DatabaseKey, limit *uint64, cursor *string) ([]ListItem, string, error)
BatchGet(keys ...DatabaseKey) ([]ListItem, error)
Commit() error
Rollback()
}
type WarpTxWriter ¶
type WarpTxWriter interface {
Set(key DatabaseKey, value []byte) error
Get(key DatabaseKey) ([]byte, error)
SetWithTTL(key DatabaseKey, value []byte, ttl time.Duration) error
BatchSet(data []ListItem) (err error)
Delete(key DatabaseKey) error
Increment(key DatabaseKey) (uint64, error)
Decrement(key DatabaseKey) (uint64, error)
Commit() error
Rollback()
}
type WarpWriteTxn ¶
type WarpWriteTxn struct {
// contains filtered or unexported fields
}
func (*WarpWriteTxn) BatchSet ¶
func (t *WarpWriteTxn) BatchSet(data []ListItem) (err error)
func (*WarpWriteTxn) Commit ¶
func (t *WarpWriteTxn) Commit() error
func (*WarpWriteTxn) Decrement ¶
func (t *WarpWriteTxn) Decrement(key DatabaseKey) (uint64, error)
func (*WarpWriteTxn) Delete ¶
func (t *WarpWriteTxn) Delete(key DatabaseKey) error
func (*WarpWriteTxn) Get ¶
func (t *WarpWriteTxn) Get(key DatabaseKey) ([]byte, error)
func (*WarpWriteTxn) Increment ¶
func (t *WarpWriteTxn) Increment(key DatabaseKey) (uint64, error)
func (*WarpWriteTxn) Rollback ¶
func (t *WarpWriteTxn) Rollback()
func (*WarpWriteTxn) Set ¶
func (t *WarpWriteTxn) Set(key DatabaseKey, value []byte) error
func (*WarpWriteTxn) SetWithTTL ¶
func (t *WarpWriteTxn) SetWithTTL(key DatabaseKey, value []byte, ttl time.Duration) error
Click to show internal directories.
Click to hide internal directories.