Documentation ¶
Index ¶
- type Batch
- type Datastore
- func (d *Datastore) Batch(ctx context.Context) (ds.Batch, error)
- func (d *Datastore) Close() 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) GetSize(ctx context.Context, key ds.Key) (size int, _ error)
- func (d *Datastore) Has(ctx context.Context, key ds.Key) (exists bool, _ error)
- func (d *Datastore) Put(ctx context.Context, key ds.Key, value []byte) error
- func (d *Datastore) Query(ctx context.Context, q query.Query) (query.Results, error)
- func (d *Datastore) Sync(ctx context.Context, _ ds.Key) error
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 is a pebble-backed github.com/ipfs/go-datastore.Datastore.
It supports batching. It does not support TTL or transactions, because pebble doesn't have those features.
func NewDatastore ¶
NewDatastore creates a pebble-backed datastore.
Users can provide pebble options or rely on Pebble's defaults. There is one exception though: opts.Comparer.Split is always overwriten, so that lookups can take advantage of bloom filters. This assumes a regular datastore usage where advanced key-versioning and performance features that Pebbles are offers are unused, but instead we care more about responding quickly to Has() and Get() lookups, particularly when keys are not in the datastore.
func (*Datastore) DiskUsage ¶ added in v0.2.0
DiskUsage implements the PersistentDatastore interface and returns current size on disk.
func (*Datastore) Has ¶
Has can be used to check whether a key is stored in the datastore. Has() calls are not cheaper than Get() though. In Pebble, lookups for existing keys will also read the values. Avoid using Has() if you later expect to read the key anyways. Has() calls for non-existing keys should take advantage of bloom filters and avoid reads.