Documentation ¶
Index ¶
- func CompareHash(plainPwd, hash string) bool
- func Hash(data string) string
- func Serialize(item interface{}) []byte
- func Unserialize(data []byte, item interface{}) error
- type BadgerStorage
- func (storage *BadgerStorage) Add(key, data []byte) error
- func (storage *BadgerStorage) Close() error
- func (storage *BadgerStorage) Delete(key []byte) error
- func (storage *BadgerStorage) DeleteRange(min, max uint64) error
- func (storage *BadgerStorage) Get(key []byte) ([]byte, error)
- func (storage *BadgerStorage) GetUint64(key []byte) (uint64, error)
- func (storage *BadgerStorage) List(prefixStr string, decoderModel db.DaoInterface) ([]db.DaoInterface, error)
- func (storage *BadgerStorage) PutUniqueKeyValue(key []byte, value []byte) error
- func (storage *BadgerStorage) SetCompositeKey(key []byte, val []byte) error
- func (storage *BadgerStorage) SetRawKey(key []byte, val []byte) error
- func (storage *BadgerStorage) SetUint64(key []byte, val uint64) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareHash ¶
func Unserialize ¶
Types ¶
type BadgerStorage ¶
type BadgerStorage struct {
// contains filtered or unexported fields
}
func NewBadgerStorageGC ¶
func NewBadgerStorageGC(options *Options) (*BadgerStorage, error)
New uses the supplied options to open the Badger badgerdb and prepare it for use as a raft backend.
func NewCollection ¶
func NewCollection(databaseRootPath, name string) (*BadgerStorage, error)
func (*BadgerStorage) Add ¶
func (storage *BadgerStorage) Add(key, data []byte) error
func (*BadgerStorage) Close ¶
func (storage *BadgerStorage) Close() error
Close is used to gracefully close the DB connection.
func (*BadgerStorage) Delete ¶
func (storage *BadgerStorage) Delete(key []byte) error
func (*BadgerStorage) DeleteRange ¶
func (storage *BadgerStorage) DeleteRange(min, max uint64) error
DeleteRange deletes logs within a given range inclusively.
func (*BadgerStorage) Get ¶
func (storage *BadgerStorage) Get(key []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*BadgerStorage) GetUint64 ¶
func (storage *BadgerStorage) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*BadgerStorage) List ¶
func (storage *BadgerStorage) List(prefixStr string, decoderModel db.DaoInterface) ([]db.DaoInterface, error)
func (*BadgerStorage) PutUniqueKeyValue ¶
func (storage *BadgerStorage) PutUniqueKeyValue(key []byte, value []byte) error
func (*BadgerStorage) SetCompositeKey ¶
func (storage *BadgerStorage) SetCompositeKey(key []byte, val []byte) error
type Options ¶
type Options struct { // Path is the directory path to the Badger badgerdb to use. Path string // BadgerOptions contains any specific Badger options you might // want to specify. BadgerOptions *badger.Options // NoSync causes the database to skip fsync calls after each // write to the log. This is unsafe, so it should be used // with caution. NoSync bool // ValueLogGC enables a periodic goroutine that does a garbage // collection of the value log while the underlying Badger is online. ValueLogGC bool // GCInterval is the interval between conditionally running the garbage // collection process, based on the size of the vlog. By default, runs every 1m. GCInterval fastime.Duration // GCInterval is the interval between mandatory running the garbage // collection process. By default, runs every 10m. MandatoryGCInterval fastime.Duration // GCThreshold sets threshold in bytes for the vlog size to be included in the // garbage collection cycle. By default, 1GB. GCThreshold int64 }
Options contains all the configuration used to open the Badger badgerdb
Click to show internal directories.
Click to hide internal directories.