Go

UStore for Go

go get github.com/unum-cloud/ustore/golang@main 1.0.0-rc.1 · 084197c4

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/ustore/go.md' | claude -p "How would this fit my code?"

The package binds the C ABI in c/ustore/ through cgo, linking the engine archive libustore_static, and adds no logic of its own beyond two trampolines for callbacks.

Building the engine needs a C++23 compiler: GCC 15, Clang 22 with libstdc++ 15 or libc++ 22, Xcode 26 or VS 2026; CUDA code needs nvcc 13.5. It needs Go 1.24 or newer with cgo enabled, and it starts no goroutines, so a Deferred is waited on from any goroutine or polled through its status. Every verb is a batch, and every blocking verb answers its value beside an error that errors.Is matches against a Status:

  • Database, Transaction and Snapshot: the head, a group of changes, and a point in time.
  • CollectionID and Each: one collection for a whole batch, or one per task.
  • Arena: where outputs land, read through the views a verb answers until its next call.
  • Executor and Deferred: the threads a call runs on, and a call submitted there.

Topics

Installation2The Go package is a cgo layer over the C library, fetched as a module.
Quickstart32The program opens a database in memory, writes a blob, a document and an edge in one transaction, and reads them back.
Collections31Collections are created under a name and the modality they hold, resolved by name once and addressed by CollectionID from then on, and a database holds none until one is created.
Reads and Writes50Keys are []Key, viewed in place, and values are a Tape: bytes end to end around one more offset than values, as Apache Arrow lays them out.
Scans45Scans, samples and measures run one task per collection their Collections names, from a start key, inclusive, towards an end key, exclusive, in a ScanDirection.
Batches and Arenas179Every output whose length scales with the call lands in an Arena, and the verb answers a view over it.
Transactions27A transaction groups reads and writes across collections and modalities, and commits all of them or none.
SnapshotsA snapshot pins the state it was taken at until it is closed, and its verbs read that state; nothing writes through it.
Documents27DocsWrite writes JSON text by default, whole documents or, with Fields, top-level keys and RFC 6901 pointers inside them, and DocsModification chooses between an upsert, an update, an insert, an RFC 6902 patch and an RFC 7386 merge.
Graphs15A graph collection, created with ModalityGraph, indexes every edge from both of its vertices, and an Edge is laid out as the source, target and identifier keys the ABI puts on its tapes, so a slice of edges crosses as three strided columns.
Errors7Every fallible verb answers an error, a *Error carrying the Status the C ABI reported and the static message beside it, so errors.Is matches it against a bare Status and errors.As reaches the message.
Platform Notes11DatabaseInitRam starts an empty database in memory alone, DatabaseOpenRam serves a directory as one image, DatabaseOpenRocksdb, DatabaseOpenLeveldb and DatabaseOpenNvme serve a directory in place, and DatabaseViewRocksdb and DatabaseViewNvme serve one read-only, refusing every change with StatusReadOnly.