# README
go-datastore
key-value datastore interfaces
Lead Maintainer
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).
Based on datastore.py.
Documentation
https://godoc.org/github.com/ipfs/go-datastore
Contribute
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
Want to hack on IPFS?
License
MIT
# 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 keytransform introduces a Datastore Shim that transforms keys before passing them to its child.
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
No description provided by the author
Package trace wraps a datastore where all datastore interactions are traced with open telemetry.
# Functions
DiskUsage checks if a Datastore is a PersistentDatastore and returns its DiskUsage(), otherwise returns 0.
EntryKeys.
FeatureByName returns the feature with the given name, if known.
Features returns a list of all known datastore features.
FeaturesForDatastore returns the features supported by the given datastore.
GetBackedHas provides a default Datastore.Has implementation.
GetBackedSize provides a default Datastore.GetSize implementation.
KeyWithNamespaces constructs a key out of a namespace slice.
NamespaceType is the first component of a namespace.
NamespaceValue returns the last component of a namespace.
No description provided by the author
NewKey constructs a key from string.
NewLogDatastore constructs a log datastore.
NewMapDatastore constructs a MapDatastore.
NewNullDatastore constructs a null datastoe.
RandomKey returns a randomly (uuid) generated key.
RawKey creates a new Key without safety checking the input.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# 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
Feature contains metadata about a datastore Feature.
A Key represents the unique identifier of an object.
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.
No description provided by the author
CheckedDatastore is an interface that should be implemented by datastores which may need checking on-disk data integrity.
No description provided by the author
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.
No description provided by the author
PersistentDatastore is an interface that should be implemented by datastores which can report disk usage.
No description provided by the author
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.
No description provided by the author
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.
No description provided by the author
Write is the write-side of the Datastore interface.
# Type aliases
KeySlice attaches the methods of sort.Interface to []Key, sorting in increasing order.