An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 6.8% on proxy.golang.org

proxy.golang.org : github.com/cbednarski/datastore

Package datastore provides a simple, embedded database for Go applications that want to store complex types on disk using a binary encoding. datastore is suitable for cases where you don't want to use a complex database like Postgres, don't have the performance needs of LSM or LMDB, and want a serialization format that is more Go-native than JSON. Data stored in a Datastore must implement the Document interface and are stored in Collections. Each Collection may include one type of Document. Each Document is indexed by a uint64 that behaves as an autoincrement primary key field. Datastore supports basic CRUD and Find operations on each Collection. Creating a collection: Adding a new document: When retrieving a document from a collection you must use a Go type assertion: Under the hood datastore encodes structs into a gzipped Gob stream and writes them to a file when you call Flush. Aside from Open and Flush, all other operations are performed in memory, so your dataset (plus some overhead) must not exceed available memory. In addition to decoding stored data, transitory data structures are re-created during the Open call. As mentioned, collections are created based on the type of the data stored in them. There are currently no special facilities provided for migrating data, so take care when renaming types. Gob is designed to handle addition and deletion of fields but renaming a type will likely cause data to be ignored the next time the datastore is opened. You may safely Open a datastore that contains incompatible types but calling Flush will destroy any incompatible type data. datastore is designed to be safe for concurrent use by a single process (with multiple goroutines). Datastore uses an atomic write during Flush, but otherwise does not attempt to be crash-safe. datastore is designed to be small, simple, and safe but is not designed for high performance -- for high performance or high capacity embedded data stores, see any number of embeddable LSM or LMDB derivatives.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/cbednarski/datastore
License: MIT
Latest release: 18 days ago
Namespace: github.com/cbednarski
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 18 days ago