package autobatch
import "github.com/ipfs/go-datastore/autobatch"
Package autobatch provides a go-datastore implementation that automatically batches together writes by holding puts in memory until a certain threshold is met.
Index ¶
- type Datastore
- func NewAutoBatching(d ds.Batching, size int) *Datastore
- func (d *Datastore) Close() error
- func (d *Datastore) Delete(ctx context.Context, k ds.Key) error
- func (d *Datastore) DiskUsage(ctx context.Context) (uint64, error)
- func (d *Datastore) Flush(ctx context.Context) error
- func (d *Datastore) Get(ctx context.Context, k ds.Key) ([]byte, error)
- func (d *Datastore) GetSize(ctx context.Context, k ds.Key) (int, error)
- func (d *Datastore) Has(ctx context.Context, k ds.Key) (bool, error)
- func (d *Datastore) Put(ctx context.Context, k ds.Key, val []byte) error
- func (d *Datastore) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)
- func (d *Datastore) Sync(ctx context.Context, prefix ds.Key) error
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore implements a go-datastore.
func NewAutoBatching ¶
NewAutoBatching returns a new datastore that automatically batches writes using the given Batching datastore. The size of the memory pool is given by size.
func (*Datastore) Close ¶
func (*Datastore) Delete ¶
Delete deletes a key/value
func (*Datastore) DiskUsage ¶
DiskUsage implements the PersistentDatastore interface.
func (*Datastore) Flush ¶
Flush flushes the current batch to the underlying datastore.
func (*Datastore) Get ¶
Get retrieves a value given a key.
func (*Datastore) GetSize ¶
GetSize implements Datastore.GetSize
func (*Datastore) Has ¶
Has checks if a key is stored.
func (*Datastore) Put ¶
Put stores a key/value.
func (*Datastore) Query ¶
Query performs a query
func (*Datastore) Sync ¶
Sync flushes all operations on keys at or under the prefix from the current batch to the underlying datastore
Source Files ¶
- Version
- v0.8.2 (latest)
- Published
- Mar 4, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 month ago –
Tools for package owners.