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
- type Option
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 using WithPebbleOpts or rely on Pebble's defaults. Any pebble options that are not assigned a value are assigned pebble's default value for the option.
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.
type Option ¶ added in v0.4.0
type Option func(*config)
func WithCacheSize ¶ added in v0.4.0
WithCacheSize configures the size of pebble's shared block cache. A value of 0 (the default) uses the default cache size.
func WithPebbleDB ¶ added in v0.4.0
WithPebbleDB is used to configure the Datastore with a custom DB.
func WithPebbleOpts ¶ added in v0.4.0
WithPebbleOpts sets any/all configurable values for pebble. If not set, the default configuration values are used. Any unspecified value in opts is replaced by the default value.