dspebble

package module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

go-ds-pebble

codecov Build Status

Datastore implementation using github.com/cockroachdb/pebble.

Please be cautious about using this in your code. Although pebble works, there is an explicit warning about using pebble. See the comment from pebble maintainer petermattis for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore struct {
	// contains filtered or unexported fields
}

Datastore implements a pebble backed ipfs datastore

func NewDatastore

func NewDatastore(path string, opts *pebble.Options, withSync bool) (*Datastore, error)

NewDatastore instantiates a new pebble datastore

func (*Datastore) Batch

func (d *Datastore) Batch() (datastore.Batch, error)

Batch returns a batchable datastore useful for combining many operations into one

func (*Datastore) Close

func (d *Datastore) Close() error

Close is used to terminate our datastore connection

func (*Datastore) Delete

func (d *Datastore) Delete(key datastore.Key) error

Delete removes the value for given `key`.

func (*Datastore) DiskUsage

func (d *Datastore) DiskUsage() (uint64, error)

DiskUsage returns the space used by our datastore in bytes it does not include the WAL (Write Ahead Log) size and only includes total size from all the "levels"

func (*Datastore) Get

func (d *Datastore) Get(key datastore.Key) ([]byte, error)

Get is used to return a value named key from our datastore

func (*Datastore) GetSize

func (d *Datastore) GetSize(key datastore.Key) (int, error)

GetSize is used to get the size of a value named key

func (*Datastore) Has

func (d *Datastore) Has(key datastore.Key) (bool, error)

Has is used to check if we have a value named key in our datastore

func (*Datastore) Put

func (d *Datastore) Put(key datastore.Key, value []byte) error

Put is used to store a value named by key

func (*Datastore) Query

func (d *Datastore) Query(q query.Query) (query.Results, error)

Query is used to search a datastore for keys, and optionally values matching a given query

func (*Datastore) Sync added in v0.0.7

func (d *Datastore) Sync(prefix datastore.Key) error

Sync is used to manually trigger syncing db contents to disk. This call is only usable when synchronous writes aren't enabled

func (*Datastore) ToggleWALStats

func (d *Datastore) ToggleWALStats()

ToggleWALStats is used to toggle reporting of WAL statistics when runnning DiskUsage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL