Documentation ¶
Index ¶
- Variables
- func NewAdapter(store *BadgerStore, bucket string, builtinPolicy string) (*adapter, error)
- type BadgerStore
- func (b BadgerStore) ForEach(fn func(namespace []byte, bucket *Bucket) error) error
- func (b *BadgerStore) Restore(reader io.Reader) error
- func (b BadgerStore) Snapshot(writer io.Writer) error
- func (b BadgerStore) Update(fn func(tx *Tx) error) error
- func (b BadgerStore) View(fn func(tx *Tx) error) error
- type Bucket
- func (bucket *Bucket) Delete(key []byte) error
- func (bucket *Bucket) Exist(key []byte) bool
- func (bucket *Bucket) ForEach(fn func(key []byte, value []byte) error) error
- func (bucket *Bucket) List(cursor string, skip int64, limit int64, reverse bool) ([][]string, error)
- func (bucket *Bucket) Put(key []byte, value []byte) error
- type CasbinRule
- type IBoltStore
- type Options
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var (
InvalidRulesLen = errors.New("invalid rule len")
)
Functions ¶
func NewAdapter ¶
func NewAdapter(store *BadgerStore, bucket string, builtinPolicy string) (*adapter, error)
NewAdapter creates a new adapter.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore provides access to Badger for Raft to store and retrieve log entries. It also provides key/value storage, and can be used as a LogStore and StableStore.
func New ¶
func New(options Options) (*BadgerStore, error)
New uses the supplied options to open the Badger db and prepare it for use as a raft backend.
func NewBadgerStore ¶
func NewBadgerStore(path string) (*BadgerStore, error)
NewBadgerStore takes a file path and returns a connected Raft backend.
func (BadgerStore) ForEach ¶
func (b BadgerStore) ForEach(fn func(namespace []byte, bucket *Bucket) error) error
func (*BadgerStore) Restore ¶
func (b *BadgerStore) Restore(reader io.Reader) error
Restore overwrites the local file
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
type IBoltStore ¶
type Options ¶
type Options struct { // Path is the directory path to the Badger db 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 time.Duration // GCInterval is the interval between mandatory running the garbage // collection process. By default, runs every 10m. MandatoryGCInterval time.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 db
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
func (*Tx) CreateBucketIfNotExists ¶
Click to show internal directories.
Click to hide internal directories.