Documentation ¶
Index ¶
- Variables
- type Datastore
- func (d *Datastore) Batch() (ds.Batch, error)
- func (d *Datastore) Close() error
- func (d *Datastore) CollectGarbage() (err error)
- func (d *Datastore) Delete(key ds.Key) error
- func (d *Datastore) DiskUsage() (uint64, error)
- func (d *Datastore) Get(key ds.Key) (value []byte, err error)
- func (d *Datastore) GetExpiration(key ds.Key) (time.Time, error)
- func (d *Datastore) GetSize(key ds.Key) (size int, err error)
- func (d *Datastore) Has(key ds.Key) (bool, error)
- func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error)
- func (d *Datastore) Put(key ds.Key, value []byte) error
- func (d *Datastore) PutWithTTL(key ds.Key, value []byte, ttl time.Duration) error
- func (d *Datastore) Query(q dsq.Query) (dsq.Results, error)
- func (d *Datastore) SetTTL(key ds.Key, ttl time.Duration) error
- func (d *Datastore) Sync(prefix ds.Key) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("datastore closed")
ErrClosed is an error message returned when the datastore is no longer open
Functions ¶
This section is empty.
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore satisfies the Datastore::Batching interface using badger
func NewDatastore ¶
NewDatastore creates a new badger datastore.
DO NOT set the Dir and/or ValuePath fields of opt, they will be set for you.
func (*Datastore) CollectGarbage ¶
CollectGarbage removes garbage from our underlying datastore
func (*Datastore) DiskUsage ¶
DiskUsage implements the PersistentDatastore interface. It returns the sum of lsm and value log files sizes in bytes.
func (*Datastore) GetExpiration ¶
GetExpiration is used to get the ttl expiration time for the key
func (*Datastore) NewTransaction ¶
NewTransaction starts a new transaction. The resulting transaction object can be mutated without incurring changes to the underlying Datastore until the transaction is Committed.
func (*Datastore) PutWithTTL ¶
PutWithTTL puts the value udner the given key for the specific duration before being GC'd
type Options ¶
type Options struct { // Please refer to the Badger docs to see what this is for GcDiscardRatio float64 // Interval between GC cycles // // If zero, the datastore will perform no automatic garbage collection. GcInterval time.Duration // Sleep time between rounds of a single GC cycle. // // If zero, the datastore will only perform one round of GC per // GcInterval. GcSleep time.Duration badger.Options }
Options are the badger datastore options, reexported here for convenience.
var DefaultOptions Options
DefaultOptions are the default options for the badger datastore.