Versions in this module Expand all Collapse all v0 v0.1.5 Nov 22, 2023 Changes in this version + var ErrClosed = errors.New("datastore closed") + type Datastore struct + DB *badger.DB + func NewDatastore(path string, options *Options) (*Datastore, error) + func (d *Datastore) Batch(ctx context.Context) (ds.Batch, error) + func (d *Datastore) Close() error + func (d *Datastore) CollectGarbage(ctx context.Context) (err error) + func (d *Datastore) Delete(ctx context.Context, key ds.Key) error + func (d *Datastore) DiskUsage(ctx context.Context) (uint64, error) + func (d *Datastore) Get(ctx context.Context, key ds.Key) (value []byte, err error) + func (d *Datastore) GetExpiration(ctx context.Context, key ds.Key) (time.Time, error) + func (d *Datastore) GetSize(ctx context.Context, key ds.Key) (size int, err error) + func (d *Datastore) Has(ctx context.Context, key ds.Key) (bool, error) + func (d *Datastore) NewTransaction(ctx context.Context, readOnly bool) (ds.Txn, error) + func (d *Datastore) Put(ctx context.Context, key ds.Key, value []byte) error + func (d *Datastore) PutWithTTL(ctx context.Context, key ds.Key, value []byte, ttl time.Duration) error + func (d *Datastore) Query(ctx context.Context, q dsq.Query) (dsq.Results, error) + func (d *Datastore) SetTTL(ctx context.Context, key ds.Key, ttl time.Duration) error + func (d *Datastore) Sync(ctx context.Context, prefix ds.Key) error + type Options struct + GcDiscardRatio float64 + GcInterval time.Duration + GcSleep time.Duration + TTL time.Duration + var DefaultOptions Options + func (opt Options) WithGcDiscardRatio(ratio float64) Options + func (opt Options) WithGcInterval(interval time.Duration) Options + func (opt Options) WithGcSleep(sleep time.Duration) Options + func (opt Options) WithTTL(ttl time.Duration) Options