Categorygithub.com/daotl/go-datastore
modulepackage
0.5.1
Repository: https://github.com/daotl/go-datastore.git
Documentation: pkg.go.dev

# README

go-datastore

DAOT Labs' fork of ipfs/go-datastore.

standard-readme compliant go.dev reference Build Status

key-value datastore interfaces

Lead Maintainer

Nex

Table of Contents

Background

Datastore is a generic layer of abstraction for data store and database access. It is a simple API with the aim to enable application development in a datastore-agnostic way, allowing datastores to be swapped seamlessly without changing application code. Thus, one can leverage different datastores with different strengths without committing the application to one datastore throughout its lifetime.

In addition, grouped datastores significantly simplify interesting data access patterns (such as caching and sharding).

This fork adds support for bytes-backed keys in addition to original string-backed keys, which could improve performance in some cases by preventing type conversion and reducing key size.

Based on datastore.py.

Install

go get github.com/daotl/go-datastore

Documentation

See API documentation.

Contribute

Feel free to join in. All welcome. Open an issue!

License

MIT

Copyright for portions of this fork are held by [Protocol Labs, 2016] as part of the original go-datastore project.

All other copyright for this fork are held by [DAOT Labs, 2020].

All rights reserved.

# Packages

Package autobatch provides a go-datastore implementation that automatically batches together writes by holding puts in memory until a certain threshold is met.
Package delayed wraps a datastore allowing to artificially delay all operations.
Package fs is a simple Datastore implementation that stores keys as directories and files, mirroring the key.
Package failstore implements a datastore which can produce custom failures on operations by calling a user-provided error function.
Package key provides the Key interface and the KeySlice type, along with some utility functions around key.
Package keytransform introduces a Datastore Shim that transforms keys before passing them to its child.
No description provided by the author
Package mount provides a Datastore that has other Datastores mounted at various key prefixes and is threadsafe.
Package namespace introduces a namespace Datastore Shim, which basically mounts the entire child datastore under a prefix.
No description provided by the author
Package retrystore provides a datastore wrapper which allows to retry operations.
No description provided by the author
No description provided by the author

# Functions

DiskUsage checks if a Datastore is a PersistentDatastore and returns its DiskUsage(), otherwise returns 0.
GetBackedHas provides a default Datastore.Has implementation.
GetBackedSize provides a default Datastore.GetSize implementation.
No description provided by the author
NewLogDatastore constructs a log datastore.
NewMapDatastore constructs a MapDatastore.
NewNullDatastore constructs a null datastoe.

# Variables

ErrBatchUnsupported is returned if the by Batch if the Datastore doesn't actually support batching.
ErrNotFound is returned by Get and GetSize when a datastore does not map the given key to a value.

# Structs

LogBatch logs all accesses through the batch.
LogDatastore logs all accesses through the datastore.
MapDatastore uses a standard Go map for internal storage.
NullDatastore stores nothing, but conforms to the API.

# Interfaces

No description provided by the author
Batching datastores support deferred, grouped updates to the database.
CheckedDatastore is an interface that should be implemented by datastores which may need checking on-disk data integrity.
Datastore represents storage for any key-value pair.
GCDatastore is an interface that should be implemented by datastores which don't free disk space by just removing data from them.
PersistentDatastore is an interface that should be implemented by datastores which can report disk usage.
Read is the read-side of the Datastore interface.
ScrubbedDatastore is an interface that should be implemented by datastores which want to provide a mechanism to check data integrity and/or error correction.
Shim is a datastore which has a child.
TTL encapulates the methods that deal with entries with time-to-live.
TTLDatastore is an interface that should be implemented by datastores that support expiring entries.
Txn extends the Datastore type.
TxnDatastore is an interface that should be implemented by datastores that support transactions.
Write is the write-side of the Datastore interface.