package
0.0.0-20190101045657-ce948763b909
Repository: https://github.com/ether1project/go-ipfs.git
Documentation: pkg.go.dev
# README
go-datastore
key-value datastore interfaces
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
# Functions
DiskUsage checks if a Datastore is a PersistentDatastore and returns its DiskUsage(), otherwise returns 0.
EntryKeys.
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.
# Variables
No description provided by the author
ErrInvalidType is returned by Put when a given value is incopatible with the type the datastore supports.
ErrNotFound is returned by Get, Has, and Delete when a datastore does not map the given key to a value.
# Structs
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.
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.
CheckedDatastore 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.
ThreadSafeDatastore is an interface that all threadsafe datastore should implement to leverage type safety checks.
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.
# Type aliases
KeySlice attaches the methods of sort.Interface to []Key, sorting in increasing order.