Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeInt64(b []byte) int64
- func EncodeInt64(n int64) []byte
- func IsNotFoundError(err error) bool
- type Batch
- type Batching
- type CustomTransaction
- type DBError
- type Datastore
- type DatastoreKey
- type Iterator
- type IteratorOptions
- type LocalDatastore
- func (d *LocalDatastore) Batch(ctx context.Context) (Batch, error)
- func (d *LocalDatastore) Close() error
- func (d *LocalDatastore) Delete(ctx context.Context, key DatastoreKey) error
- func (d *LocalDatastore) DiskUsage(ctx context.Context) (uint64, error)
- func (d *LocalDatastore) Get(ctx context.Context, key DatastoreKey) (value []byte, err error)
- func (d *LocalDatastore) GetSize(ctx context.Context, key DatastoreKey) (size int, err error)
- func (d *LocalDatastore) Has(ctx context.Context, key DatastoreKey) (bool, error)
- func (d *LocalDatastore) IsFirstRun() bool
- func (d *LocalDatastore) NewCustomTransaction(ctx context.Context, readOnly bool) (CustomTransaction, error)
- func (d *LocalDatastore) NewDagStore(ctx context.Context) (*dagStore, error)
- func (d *LocalDatastore) NewTransaction(ctx context.Context, readOnly bool) (ds.Txn, error)
- func (d *LocalDatastore) Put(ctx context.Context, key DatastoreKey, value []byte) error
- func (d *LocalDatastore) PutWithTTL(ctx context.Context, key DatastoreKey, value []byte, ttl time.Duration) error
- func (d *LocalDatastore) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)
- func (d *LocalDatastore) Run(username, password string) (err error)
- func (d *LocalDatastore) Stats() map[string]string
- func (d *LocalDatastore) Sync(ctx context.Context, _ DatastoreKey) error
- type Options
Constants ¶
View Source
const ( ErrNotRunning = DBError("DB is not running") ErrWrongPassword = DBError("wrong username or password") PermanentTTL = math.MaxInt64 )
Variables ¶
View Source
var DefaultIteratorOptions = badger.DefaultIteratorOptions
Functions ¶
func DecodeInt64 ¶
func EncodeInt64 ¶
func IsNotFoundError ¶
Types ¶
type CustomTransaction ¶
type CustomTransaction interface {
ds.Txn
NewIterator(opt IteratorOptions) (*Iterator, error)
PutWithTTL(ctx context.Context, key DatastoreKey, value []byte, ttl time.Duration) error
Increment(key DatastoreKey) (uint64, error)
Decrement(key DatastoreKey) (uint64, error)
}
type IteratorOptions ¶
type IteratorOptions = badger.IteratorOptions
type LocalDatastore ¶
type LocalDatastore struct {
// contains filtered or unexported fields
}
func NewLocalDatastore ¶
func NewLocalDatastore(dbPath string, o *Options) (*LocalDatastore, error)
func (*LocalDatastore) Close ¶
func (d *LocalDatastore) Close() error
func (*LocalDatastore) Delete ¶
func (d *LocalDatastore) Delete(ctx context.Context, key DatastoreKey) error
func (*LocalDatastore) DiskUsage ¶
func (d *LocalDatastore) DiskUsage(ctx context.Context) (uint64, error)
func (*LocalDatastore) Get ¶
func (d *LocalDatastore) Get(ctx context.Context, key DatastoreKey) (value []byte, err error)
func (*LocalDatastore) GetSize ¶
func (d *LocalDatastore) GetSize(ctx context.Context, key DatastoreKey) (size int, err error)
func (*LocalDatastore) Has ¶
func (d *LocalDatastore) Has(ctx context.Context, key DatastoreKey) (bool, error)
func (*LocalDatastore) IsFirstRun ¶
func (d *LocalDatastore) IsFirstRun() bool
func (*LocalDatastore) NewCustomTransaction ¶
func (d *LocalDatastore) NewCustomTransaction(ctx context.Context, readOnly bool) (CustomTransaction, error)
func (*LocalDatastore) NewDagStore ¶
func (d *LocalDatastore) NewDagStore(ctx context.Context) (*dagStore, error)
func (*LocalDatastore) NewTransaction ¶
func (*LocalDatastore) Put ¶
func (d *LocalDatastore) Put(ctx context.Context, key DatastoreKey, value []byte) error
func (*LocalDatastore) PutWithTTL ¶
func (d *LocalDatastore) PutWithTTL(ctx context.Context, key DatastoreKey, value []byte, ttl time.Duration) error
func (*LocalDatastore) Run ¶
func (d *LocalDatastore) Run(username, password string) (err error)
func (*LocalDatastore) Stats ¶
func (d *LocalDatastore) Stats() map[string]string
func (*LocalDatastore) Sync ¶
func (d *LocalDatastore) Sync(ctx context.Context, _ DatastoreKey) error
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options
func (Options) WithDiscardRatioGC ¶
func (Options) WithInMemory ¶
Click to show internal directories.
Click to hide internal directories.