# UStore for Go

> Blobs, documents and graphs in one ACID transaction with USearch, on local NVMe through io_uring, SPDK and GPU compaction, from Go

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

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.

## Installation

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

The Go package is a cgo layer over the C library, fetched as a module:

```sh
go get github.com/unum-cloud/ustore/golang@main
```

A commit pins a build instead of `@main`, and Go records it in `go.sum` as a pseudo-version. The package links `libustore_static` and reads the headers from the module’s own `c/`, so the archive must sit on the linker’s path, such as `/usr/local/lib`, or be named through `CGO_LDFLAGS`. `USTORE_MODALITIES`, set when configuring the archive, lists the modalities it compiles beside blobs, `strings;docs;graph;pages` by default, and `Modality.Compiled` reports whether it holds one, while creating a collection of any other answers `StatusUnsupported`. From a checkout of the repository, for the current shell:

```sh
cmake -B build_release -D CMAKE_BUILD_TYPE=Release
cmake --build build_release --target ustore_static
export CGO_LDFLAGS="-L$PWD/build_release"   # or install the archive
```

Then import the package under the `ustore` name the examples below use:

```go
import ustore "github.com/unum-cloud/ustore/golang"
```

### API

#### Functions

##### `Version`

Version reports the major, minor and patch version of the library the program runs against.

[ustore.go:1388 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/ustore.go#L1388)

```go
func Version() (major, minor, patch int)
```

##### `VersionName`

VersionName reports the version of the library the program runs against, pre-release suffix included, such as "1.0.0-rc.1".

[ustore.go:1396 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/ustore.go#L1396)

```go
func VersionName() string
```

## Quickstart

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

The program opens a database in memory, writes a blob, a document and an edge in one transaction, and reads them back. Collections are created by name and modality before a transaction writes into them, and every read lands in an arena.

```go
package main

import (
	"errors"
	"fmt"
	"log"

	ustore "github.com/unum-cloud/ustore/golang"
)

func main() {
	database, err := ustore.DatabaseInitRam(nil)
	if err != nil {
		log.Fatal(err)
	}
	defer database.Close()
	avatar, titanic := ustore.KeyFromUint64(1), ustore.KeyFromUint64(2)
	posters, err := database.CollectionCreate("posters", ustore.ModalityBlobs)
	if err != nil {
		log.Fatal(err)
	}
	movies, err := database.CollectionCreate("movies", ustore.ModalityDocs)
	if err != nil {
		log.Fatal(err)
	}
	similar, err := database.CollectionCreate("similar", ustore.ModalityGraph)
	if err != nil {
		log.Fatal(err)
	}

	// One transaction writes a blob, a document and an edge, and commits all three or none.
	transaction, err := database.TransactionInit()
	if err != nil {
		log.Fatal(err)
	}
	defer transaction.Close()
	err = errors.Join(
		transaction.BlobsWrite(posters, []ustore.Key{avatar}, ustore.TapeOf("\x89PNG"), nil),
		transaction.DocsWrite(movies, []ustore.Key{avatar}, ustore.TapeOf(`{"title":"Avatar","year":2009}`), nil),
		transaction.GraphWriteEdges(similar, []ustore.Edge{{Source: avatar, Target: titanic, ID: ustore.EdgeIDDefault}}, nil),
	)
	if err != nil {
		log.Fatal(err)
	}
	if _, err := transaction.Commit(ustore.DurabilityBuffered); err != nil {
		log.Fatal(err)
	}

	// Reads at the head see the commit: the poster, the year and the one edge leaving Avatar.
	arena, err := ustore.NewArena(nil)
	if err != nil {
		log.Fatal(err)
	}
	defer arena.Close()
	poster, err := database.BlobsRead(posters, []ustore.Key{avatar}, arena, nil)
	if err != nil {
		log.Fatal(err)
	}
	value, _ := poster.Get(0)
	fmt.Printf("%q ", value)
	movie, err := database.DocsRead(movies, []ustore.Key{avatar}, arena, &ustore.DocsReadConfig{Fields: ustore.TapeOf("year")})
	if err != nil {
		log.Fatal(err)
	}
	year, _ := movie.Get(0)
	fmt.Printf("%s ", year)
	edges, err := database.GraphReadEdges(similar, []ustore.Key{avatar}, ustore.VertexRoleSource, arena)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(edges.Edges(0)[0].Target == titanic)
}
```

`golang/example_test.go` compiles and runs this program on every `go test`.

### API

#### Types

##### `DataDirectory`

DataDirectory is a directory a database spreads its files over, with the bytes they may take in it.

[db.go:839 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L839)

```go
type DataDirectory struct {
    Path string
    MaxBytes uint64
}
```

##### Fields

| `Path` | `string` | Path is the directory, which must exist. |
| - | - | - |
| `MaxBytes` | `uint64` | MaxBytes caps the bytes the files may take there, zero being unlimited. |

##### `DatabaseInitRamConfig`

DatabaseInitRamConfig carries the optional arguments of [DatabaseInitRam](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseInitRam) and [DatabaseOpenRam](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseOpenRam).

[db.go:777 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L777)

```go
type DatabaseInitRamConfig struct {
    Executor *Executor
    Isolation Isolation
    CPUClassCeiling CPUClass
    MemoryLimit uint64
    CommitConflictsLimit uint64
}
```

##### Fields

| `Executor` | `*Executor` | Executor runs the open, nil the calling goroutine. |
| - | - | - |
| `Isolation` | `Isolation` | Isolation is how transactions see each other's writes. |
| `CPUClassCeiling` | `CPUClass` | CPUClassCeiling is the newest class the database's kernels may run as; zero sets no ceiling. |
| `MemoryLimit` | `uint64` | MemoryLimit caps the bytes of keys and values the database holds, past which a write answers [StatusCapacityExhausted](https://www.unum.cloud/docs/ustore/go/errors.md#StatusCapacityExhausted); zero takes 16 GiB. |
| `CommitConflictsLimit` | `uint64` | CommitConflictsLimit is the conflicts a commit of the database's own absorbs before it answers [StatusWriteConflict](https://www.unum.cloud/docs/ustore/go/errors.md#StatusWriteConflict); zero derives 12 per logical core. |

##### `DatabaseOpenLeveldbConfig`

DatabaseOpenLeveldbConfig carries the optional arguments of [DatabaseOpenLeveldb](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseOpenLeveldb).

[db.go:923 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L923)

```go
type DatabaseOpenLeveldbConfig struct {
    Executor *Executor
    MemoryLimit uint64
    BackgroundThreads uint64
}
```

##### Fields

| `Executor` | `*Executor` | Executor runs the open, nil the calling goroutine. |
| - | - | - |
| `MemoryLimit` | `uint64` | MemoryLimit caps the host memory the engine caches and buffers in, a quarter for the block cache and a quarter for the write buffer; zero takes 1 GiB. |
| `BackgroundThreads` | `uint64` | BackgroundThreads is zero or one, as LevelDB compacts on one thread, and more answers [StatusUnsupported](https://www.unum.cloud/docs/ustore/go/errors.md#StatusUnsupported). |

##### `DatabaseOpenNvmeConfig`

DatabaseOpenNvmeConfig carries the optional arguments of [DatabaseOpenNvme](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseOpenNvme), where every zero size or count keeps the engine's default.

[db.go:957 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L957)

```go
type DatabaseOpenNvmeConfig struct {
    Executor *Executor
    DataDirectories []DataDirectory
    Compactions *Executor
    MemoryLimit uint64
    TransactionMaxBytes uint64
    TransactionMaxDeltas uint64
    CollectionConcurrencyLimit uint64
    CollectionCacheLimit uint64
    CollectionMemoryRunsMaxBytes uint64
    CollectionMemoryRunsMaxDeltas uint64
    CollectionLevelEnlargeFactor uint64
    CollectionValueSize uint64
    CollectionValueMaxSize uint64
    CPUClassCeiling CPUClass
    CommitConflictsLimit uint64
}
```

##### Fields

| `Executor` | `*Executor` | Executor runs the open, nil the calling goroutine; an NVMe executor moves the bytes. |
| - | - | - |
| `DataDirectories` | `[]DataDirectory` | DataDirectories spread the volumes beyond the directory. |
| `Compactions` | `*Executor` | Compactions is the executor merges run on. |
| `MemoryLimit` | `uint64` | MemoryLimit caps the bytes the engine keeps in memory. |
| `TransactionMaxBytes` | `uint64` | TransactionMaxBytes caps the bytes one transaction buffers. |
| `TransactionMaxDeltas` | `uint64` | TransactionMaxDeltas caps the changes one transaction buffers. |
| `CollectionConcurrencyLimit` | `uint64` | CollectionConcurrencyLimit caps the calls one collection serves at once. |
| `CollectionCacheLimit` | `uint64` | CollectionCacheLimit caps the bytes one collection caches. |
| `CollectionMemoryRunsMaxBytes` | `uint64` | CollectionMemoryRunsMaxBytes caps the bytes of one collection's memory runs. |
| `CollectionMemoryRunsMaxDeltas` | `uint64` | CollectionMemoryRunsMaxDeltas caps the changes of one collection's memory runs. |
| `CollectionLevelEnlargeFactor` | `uint64` | CollectionLevelEnlargeFactor is how much larger each level grows than the one above it. |
| `CollectionValueSize` | `uint64` | CollectionValueSize is the value size the collections are tuned for. |
| `CollectionValueMaxSize` | `uint64` | CollectionValueMaxSize caps the size of one value. |
| `CPUClassCeiling` | `CPUClass` | CPUClassCeiling is the newest class the database's kernels may run as; zero sets no ceiling. |
| `CommitConflictsLimit` | `uint64` | CommitConflictsLimit is the conflicts a commit of the database's own absorbs before it answers [StatusWriteConflict](https://www.unum.cloud/docs/ustore/go/errors.md#StatusWriteConflict); zero derives 12 per logical core. |

##### `DatabaseOpenRocksdbConfig`

DatabaseOpenRocksdbConfig carries the optional arguments of [DatabaseOpenRocksdb](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseOpenRocksdb) and [DatabaseViewRocksdb](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseViewRocksdb).

[db.go:860 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L860)

```go
type DatabaseOpenRocksdbConfig struct {
    Executor *Executor
    DataDirectories []DataDirectory
    MemoryLimit uint64
    BackgroundThreads uint64
}
```

##### Fields

| `Executor` | `*Executor` | Executor runs the open, nil the calling goroutine. |
| - | - | - |
| `DataDirectories` | `[]DataDirectory` | DataDirectories spread the files beyond the directory. |
| `MemoryLimit` | `uint64` | MemoryLimit caps the host memory the engine caches and buffers in, a quarter for one block cache and a quarter for one write buffer manager; zero takes 1 GiB. |
| `BackgroundThreads` | `uint64` | BackgroundThreads sizes the pool the database owns for its flushes and compactions; zero takes 2. |

##### `DatabaseViewNvmeConfig`

DatabaseViewNvmeConfig carries the optional arguments of [DatabaseViewNvme](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseViewNvme), where every zero size keeps the engine's default.

[db.go:1032 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1032)

```go
type DatabaseViewNvmeConfig struct {
    Executor *Executor
    DataDirectories []DataDirectory
    MemoryLimit uint64
    CollectionConcurrencyLimit uint64
    CollectionCacheLimit uint64
    CPUClassCeiling CPUClass
}
```

##### Fields

| `Executor` | `*Executor` | Executor runs the open, nil the calling goroutine; an NVMe executor moves the bytes. |
| - | - | - |
| `DataDirectories` | `[]DataDirectory` | DataDirectories are the volumes beyond the directory, as the database was opened with. |
| `MemoryLimit` | `uint64` | MemoryLimit caps the bytes the engine keeps in memory. |
| `CollectionConcurrencyLimit` | `uint64` | CollectionConcurrencyLimit caps the calls one collection serves at once. |
| `CollectionCacheLimit` | `uint64` | CollectionCacheLimit caps the bytes one collection caches. |
| `CPUClassCeiling` | `CPUClass` | CPUClassCeiling is the newest class the database's kernels may run as; zero sets no ceiling. |

##### `NvmeOptions`

NvmeOptions is how the threads of an NVMe executor move bytes between the drives and memory, where every zero size or count keeps the engine's default.

[db.go:707 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L707)

```go
type NvmeOptions struct {
    Transport Transport
    QueueDepth uint64
    RequestBufferBytes uint64
    RequestBuffersCount uint64
    StreamBufferBytes uint64
    StreamBuffersCount uint64
    Paths []string
}
```

##### Fields

| `Transport` | `Transport` | Transport is how bytes move between the files and memory. |
| - | - | - |
| `QueueDepth` | `uint64` | QueueDepth counts the submissions a channel holds at once. |
| `RequestBufferBytes` | `uint64` | RequestBufferBytes sizes each request buffer of a channel. |
| `RequestBuffersCount` | `uint64` | RequestBuffersCount counts the request buffers of each channel. |
| `StreamBufferBytes` | `uint64` | StreamBufferBytes sizes each streaming buffer of a channel. |
| `StreamBuffersCount` | `uint64` | StreamBuffersCount counts the streaming buffers of each channel. |
| `Paths` | `[]string` | Paths are the data directories, raw media or SPDK namespaces of the databases the executor will open, read only during the call: the memory domain they share places the threads when no memory domain is named, and their fewest hardware queues give the default thread count. |

##### Struct `DatabaseDeferredOn`

DatabaseDeferredOn is the receiver whose verbs submit their calls to an executor and answer a [Deferred](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#Deferred), offering the verbs of [DatabaseOn](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DatabaseOn) with the same arguments.21

[db.go:677 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L677)

```go
type DatabaseDeferredOn struct {
    // contains filtered or unexported fields
}
```

The library reads a deferred call's inputs until the call is final, so the slices a verb is handed must not change until then; the caller keeps its arena until then, as for a blocking verb.

###### `*`

× 4 Clear submits [DatabaseOn.Clear](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#Clear).

[db.go:1141 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1141)

```go
func (on DatabaseDeferredOn) Clear(
    mode DropMode,
) (*Deferred[struct{}], error)
```

| Symbol |
| - |
| `Clear` |
| `Compact` |
| `Describe` |
| `Flush` |

###### `CollectionCreate`

CollectionCreate submits [DatabaseOn.CollectionCreate](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#CollectionCreate).

[db.go:1386 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1386)

```go
func (on DatabaseDeferredOn) CollectionCreate(
    name string,
    modality Modality,
) (*Deferred[CollectionID], error)
```

###### `CollectionDrop`

CollectionDrop submits [DatabaseOn.CollectionDrop](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#CollectionDrop).

[db.go:1420 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1420)

```go
func (on DatabaseDeferredOn) CollectionDrop(
    collection CollectionID,
    mode DropMode,
) (*Deferred[struct{}], error)
```

###### `CompactPlanFinish`

CompactPlanFinish submits [DatabaseOn.CompactPlanFinish](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#CompactPlanFinish).

[db.go:1228 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1228)

```go
func (on DatabaseDeferredOn) CompactPlanFinish(
    plan *CompactPlan,
) (*Deferred[struct{}], error)
```

###### `BlobsRemove`

BlobsRemove submits [DatabaseOn.BlobsRemove](https://www.unum.cloud/docs/ustore/go/transactions.md#BlobsRemove).

[db.go:209 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L209)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) BlobsRemove(
    collections Collections,
    keys []Key,
    config *RemoveConfig,
) (*Deferred[struct{}], error)
```

###### `BlobsWrite`

BlobsWrite submits [DatabaseOn.BlobsWrite](https://www.unum.cloud/docs/ustore/go/transactions.md#BlobsWrite).

[db.go:169 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L169)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) BlobsWrite(
    collections Collections,
    keys []Key,
    values Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `DocsRemove`

DocsRemove submits [DatabaseOn.DocsRemove](https://www.unum.cloud/docs/ustore/go/transactions.md#DocsRemove).

[db.go:194 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L194)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) DocsRemove(
    collections Collections,
    keys []Key,
    config *RemoveConfig,
) (*Deferred[struct{}], error)
```

###### `DocsWrite`

DocsWrite submits [DatabaseOn.DocsWrite](https://www.unum.cloud/docs/ustore/go/transactions.md#DocsWrite).

[db.go:149 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L149)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) DocsWrite(
    collections Collections,
    keys []Key,
    values Tape,
    config *DocsWriteConfig,
) (*Deferred[struct{}], error)
```

###### `GraphRemoveEdges`

GraphRemoveEdges submits [DatabaseOn.GraphRemoveEdges](https://www.unum.cloud/docs/ustore/go/transactions.md#GraphRemoveEdges).

[db.go:261 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L261)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) GraphRemoveEdges(
    collections Collections,
    edges []Edge,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `GraphRemoveVertices`

GraphRemoveVertices submits [DatabaseOn.GraphRemoveVertices](https://www.unum.cloud/docs/ustore/go/transactions.md#GraphRemoveVertices).

[db.go:358 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L358)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) GraphRemoveVertices(
    collections Collections,
    vertices []Key,
    config *GraphRemoveVerticesConfig,
) (*Deferred[struct{}], error)
```

###### `GraphWriteEdges`

GraphWriteEdges submits [DatabaseOn.GraphWriteEdges](https://www.unum.cloud/docs/ustore/go/transactions.md#GraphWriteEdges).

[db.go:219 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L219)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) GraphWriteEdges(
    collections Collections,
    edges []Edge,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `GraphWriteVertices`

GraphWriteVertices submits [DatabaseOn.GraphWriteVertices](https://www.unum.cloud/docs/ustore/go/transactions.md#GraphWriteVertices).

[db.go:307 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L307)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) GraphWriteVertices(
    collections Collections,
    vertices []Key,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `PagesImport`

PagesImport submits [DatabaseOn.PagesImport](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesImport).

[db.go:91 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L91)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesImport(
    collections Collections,
    keys []Key,
    values Tape,
    config *PagesImportConfig,
) (*Deferred[struct{}], error)
```

###### `PagesInsert`

PagesInsert submits [DatabaseOn.PagesInsert](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesInsert).

[db.go:167 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L167)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesInsert(
    collections Collections,
    keys []Key,
    values Tape,
    arena *Arena,
    config *PagesInsertConfig,
) (*Deferred[Inserted], error)
```

###### `PagesMove`

PagesMove submits [DatabaseOn.PagesMove](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesMove).

[db.go:280 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L280)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesMove(
    collections Collections,
    keys, elements []Key,
    config *PagesMoveConfig,
) (*Deferred[struct{}], error)
```

###### `PagesRemove`

PagesRemove submits [DatabaseOn.PagesRemove](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesRemove).

[db.go:227 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L227)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesRemove(
    collections Collections,
    keys []Key,
    config *PagesRemoveConfig,
) (*Deferred[struct{}], error)
```

###### `PagesRemoveAttributes`

PagesRemoveAttributes submits [DatabaseOn.PagesRemoveAttributes](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesRemoveAttributes).

[db.go:408 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L408)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesRemoveAttributes(
    collections Collections,
    keys, elements []Key,
    fields Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `PagesSetAttributes`

PagesSetAttributes submits [DatabaseOn.PagesSetAttributes](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesSetAttributes).

[db.go:366 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L366)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesSetAttributes(
    collections Collections,
    keys, elements []Key,
    fields, values Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `PagesSplice`

PagesSplice submits [DatabaseOn.PagesSplice](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesSplice).

[db.go:323 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L323)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) PagesSplice(
    collections Collections,
    keys, elements []Key,
    textStarts, textLengths []uint64,
    values Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `StringsRemove`

StringsRemove submits [DatabaseOn.StringsRemove](https://www.unum.cloud/docs/ustore/go/transactions.md#StringsRemove).

[db.go:91 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L91)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) StringsRemove(
    collections Collections,
    strings Tape,
    config *StringsRemoveConfig,
) (*Deferred[struct{}], error)
```

###### `StringsWrite`

StringsWrite submits [DatabaseOn.StringsWrite](https://www.unum.cloud/docs/ustore/go/transactions.md#StringsWrite).

[db.go:40 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L40)

Inherited from `deferredWrites[Handle]`

```go
func (on DatabaseDeferredOn) StringsWrite(
    collections Collections,
    strings Tape,
    values []Key,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

##### Enum `Engine`

Engine is the engine serving a database.2

[db.go:366 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L366)

```go
type Engine int32
```

##### Values

| `EngineRam` | | EngineRam keeps everything in memory, imaged into a directory on demand. |
| - | - | - |
| `EngineRocksDB` | | EngineRocksDB serves a RocksDB directory. |
| `EngineLevelDB` | | EngineLevelDB serves a LevelDB directory. |
| `EngineNvme` | | EngineNvme is the in-tree NVMe engine. |

###### `EngineFromName`

EngineFromName reads an engine back from the spelling [Engine.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:385 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L385)

```go
func EngineFromName(name string) (Engine, error)
```

###### `String`

String renders the engine as the library spells it.

[db.go:380 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L380)

```go
func (engine Engine) String() string
```

## Collections

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

Collections 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. A name starting with `_` is refused with `StatusInvalidArgument`, as the engines keep their own system collections there. `CollectionFind` answers the identifier and modality of every name in a batch, and `CollectionList` every collection with its name. `CollectionDrop` empties a collection of its pairs or values with `DropPairs` or `DropValues`, or drops it whole with `DropCollection`. Every batch verb takes a `Collections`: a bare `CollectionID` serves every task, and `Each` names one per task.

```go
people, err := database.CollectionCreate("people", ustore.ModalityBlobs)
found, err := database.CollectionFind(ustore.TapeOf("people", "places"), arena)
id, modality, ok := found.Get(0)
values, err := database.BlobsRead(ustore.Each{people, places}, []ustore.Key{ada, ada}, arena, nil)
err = database.CollectionDrop(people, ustore.DropCollection)
```

### API

#### Types

##### `ArenaDescription`

ArenaDescription is where an arena's outputs live, which decides whether Go code may read them, laid out as ustore_arena_description_t.

[db.go:924 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L924)

```go
type ArenaDescription struct {
    Residency Residency
    Device int32
    Vendor GPUVendor
    VendorOrdinal int32
    HostAccess HostAccess
}
```

##### Fields

| `Residency` | `Residency` | Residency is [ResidencyRam](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#ResidencyRam) for host pages and [ResidencyVram](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#ResidencyVram) for one device's memory. |
| - | - | - |
| `Device` | `int32` | Device is the ordinal of the GPU holding the outputs, as [GPUDevices](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#GPUDevices) lists it, or -1 for host pages. |
| `Vendor` | `GPUVendor` | Vendor is the vendor whose memory it is, as [GPUDevices](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#GPUDevices) reports it, [GPUVendorUnknown](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#GPUVendorUnknown) for host pages. |
| `VendorOrdinal` | `int32` | VendorOrdinal is the vendor's own device number, which Arrow and DLPack name, or -1 for host pages. |
| `HostAccess` | `HostAccess` | HostAccess is whether Go code may read the outputs, as it may host, pinned, managed and Apple's shared memory. |

##### `Capabilities`

Capabilities is the set of features an engine reports, one bit each.

[db.go:332 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L332)

```go
type Capabilities int32
```

##### Values

| `CapabilitiesTransactions` | | CapabilitiesTransactions means the engine supports transactions. |
| - | - | - |
| `CapabilitiesSnapshots` | | CapabilitiesSnapshots means the engine supports snapshots. |
| `CapabilitiesSavesSnapshots` | | CapabilitiesSavesSnapshots means the engine writes a snapshot out as a database of its own. |

##### `Collections`

Collections names the collection of every task in a batch: a [CollectionID](#CollectionID) the whole batch shares, or [Each](https://www.unum.cloud/docs/ustore/go/scans.md#Each), one per task.

[db.go:149 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L149)

```go
type Collections interface {
    // contains filtered or unexported methods
}
```

##### `CompactConfig`

CompactConfig carries the optional arguments of [DatabaseOn.Compact](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#Compact).

[db.go:1173 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1173)

```go
type CompactConfig struct {
    Plan *CompactPlan
    Progress ProgressCallback
}
```

##### Fields

| `Plan` | `*CompactPlan` | Plan keeps a compaction live across calls on an executor; nil runs it to its end. |
| - | - | - |
| `Progress` | `ProgressCallback` | Progress is called at every barrier of every phase, and may cancel at that barrier. |

##### `CompactPlan`

CompactPlan is a compaction kept live across calls: the handle the library opens on the first call naming it, and where the last such call stopped.

[db.go:1166 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1166)

```go
type CompactPlan struct {
    Phase PhaseProgress
    // contains filtered or unexported fields
}
```

It opens only on an executor, and continues or finishes on any host executor, while its database stays open until the finish.

##### Fields

| `Phase` | `PhaseProgress` | Phase is where the last call naming the plan stopped, [PhaseDone](#PhaseDone) once the compaction ended. |
| - | - | - |

##### `DatabaseDescription`

DatabaseDescription is what [DatabaseOn.Describe](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#Describe) reports, laid out as ustore_database_description_t.

[db.go:1077 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1077)

```go
type DatabaseDescription struct {
    Capabilities Capabilities
    Engine Engine
    Isolation Isolation
    CPUClass CPUClass
    Keys uint64
    MemoryBytes uint64
    DiskBytes uint64
    UnpinnedStagingBytes uint64
    RequestsAcrossRegisteredSlots uint64
    CommitConflictsLimit uint64
}
```

##### Fields

| `Capabilities` | `Capabilities` | Capabilities are the features the engine supports. |
| - | - | - |
| `Engine` | `Engine` | Engine is the engine serving the database. |
| `Isolation` | `Isolation` | Isolation is how transactions see each other. |
| `CPUClass` | `CPUClass` | CPUClass is the class the engine's calls run as, picked at open. |
| `Keys` | `uint64` | Keys counts the keys across every collection. |
| `MemoryBytes` | `uint64` | MemoryBytes is the memory the engine holds for the data. |
| `DiskBytes` | `uint64` | DiskBytes is what the files of the database take on disk. |
| `UnpinnedStagingBytes` | `uint64` | UnpinnedStagingBytes is the NVMe engine's io_uring arena the locked-memory cap refused to pin, so each request pins its own. |
| `RequestsAcrossRegisteredSlots` | `uint64` | RequestsAcrossRegisteredSlots counts the requests the NVMe engine sent unpinned while its arena was pinned, as each crossed a gibibyte of it. |
| `CommitConflictsLimit` | `uint64` | CommitConflictsLimit is the conflicts a commit of the database's own absorbs before it fails, as its open named or derived them, on the RAM and NVMe engines, and zero elsewhere. |

##### Type `CollectionID`

CollectionID identifies a collection: a UUIDv7 its create mints once and never reuses.1

[db.go:123 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L123)

```go
type CollectionID [16]byte
```

The zero value names none.

###### `String`

String renders the identifier as a lowercase dashed UUID.

[db.go:126 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L126)

```go
func (collection CollectionID) String() string
```

##### Struct `CollectionList`

CollectionList is every collection a call listed into its arena, readable until the arena serves another call.4

[db.go:1445 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1445)

```go
type CollectionList struct {
    // contains filtered or unexported fields
}
```

###### `ID`

ID reports the identifier of collection index.

[db.go:1457 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1457)

```go
func (list CollectionList) ID(index uint) CollectionID
```

###### `Len`

Len reports how many collections the call listed.

[db.go:1454 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1454)

```go
func (list CollectionList) Len() uint
```

###### `Modality`

Modality reports what collection index holds.

[db.go:1464 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1464)

```go
func (list CollectionList) Modality(index uint) Modality
```

###### `Name`

Name views the name of collection index in the arena.

[db.go:1471 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1471)

```go
func (list CollectionList) Name(index uint) []byte
```

##### Enum `DropMode`

DropMode is what a drop or a clear removes.2

[db.go:308 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L308)

```go
type DropMode int32
```

##### Values

| `DropCollection` | | DropCollection removes the collection with everything it holds. |
| - | - | - |
| `DropPairs` | | DropPairs removes every key and value, keeping the collection. |
| `DropValues` | | DropValues empties every value, keeping its key. |

###### `DropModeFromName`

DropModeFromName reads a drop mode back from the spelling [DropMode.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:325 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L325)

```go
func DropModeFromName(name string) (DropMode, error)
```

###### `String`

String renders the drop mode as the library spells it.

[db.go:320 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L320)

```go
func (mode DropMode) String() string
```

##### Struct `FoundCollections`

FoundCollections is what a lookup of names found, in the order of the names, readable until the arena serves another call.2

[db.go:1514 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1514)

```go
type FoundCollections struct {
    // contains filtered or unexported fields
}
```

###### `Get`

Get reports the collection name index addresses and what it holds, and false when no collection carries the name.

[db.go:1527 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1527)

```go
func (found FoundCollections) Get(
    index uint,
) (CollectionID, Modality, bool)
```

###### `Len`

Len reports how many names the call looked up.

[db.go:1523 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1523)

```go
func (found FoundCollections) Len() uint
```

##### Type `Key`

Key identifies a value within one collection: sixteen bytes, ordered as their bytes.3

[db.go:101 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L101)

```go
type Key [16]byte
```

An integer spells as its 128-bit big-endian bytes, so keys made from integers order as the integers.

###### `KeyFromUint64`

KeyFromUint64 spells an integer as its 128-bit big-endian bytes.

[db.go:112 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L112)

```go
func KeyFromUint64(value uint64) Key
```

###### `KeysViewFromArrow`

KeysViewFromArrow views the 16-byte keys of a fixed_size_binary(16) column in place, tagged arrow\.uuid or not, viewing the column's buffers.

[db.go:71 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L71)

```go
func KeysViewFromArrow(
    schema *ArrowSchema,
    array *ArrowArray,
) ([]Key, error)
```

###### `String`

String renders the key as a lowercase dashed UUID.

[db.go:119 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L119)

```go
func (key Key) String() string
```

##### Enum `Modality`

Modality is what a collection holds, recorded beside its name so that a verb of another kind is refused.3

[db.go:186 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L186)

```go
type Modality int32
```

##### Values

| `ModalityBlobs` | | ModalityBlobs holds binary values of blobs.h. |
| - | - | - |
| `ModalityDocs` | | ModalityDocs holds JSON documents of docs.h. |
| `ModalityGraph` | | ModalityGraph holds vertices and their edges of graph.h. |
| `ModalityStrings` | | ModalityStrings holds values keyed by strings of strings.h. |
| `ModalityPages` | | ModalityPages holds structured pages of pages.h. |

###### `ModalityFromName`

ModalityFromName reads a modality back from the spelling [Modality.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:213 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L213)

```go
func ModalityFromName(name string) (Modality, error)
```

###### `Compiled`

Compiled reports whether this build serves collections of the modality; creating one it omits answers [StatusUnsupported](https://www.unum.cloud/docs/ustore/go/errors.md#StatusUnsupported).

[db.go:208 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L208)

```go
func (modality Modality) Compiled() bool
```

###### `String`

String renders the modality as the library spells it.

[db.go:202 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L202)

```go
func (modality Modality) String() string
```

##### Enum `Phase`

Phase is the kind of work a plan is doing, shared by every long operation.2

[types.go:193 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L193)

```go
type Phase int32
```

##### Values

| `PhaseNone` | | PhaseNone means no plan, or one that has not started. |
| - | - | - |
| `PhaseFlush` | | PhaseFlush writes what memory holds to storage. |
| `PhaseMerge` | | PhaseMerge merges or vacuums the stored versions one unit at a time. |
| `PhaseReclaim` | | PhaseReclaim frees what no reader reaches any more. |
| `PhaseDone` | | PhaseDone means the plan ran to its end, and nothing is pending. |

###### `PhaseFromName`

PhaseFromName reads a phase back from the spelling [Phase.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:212 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L212)

```go
func PhaseFromName(name string) (Phase, error)
```

###### `String`

String renders the phase as the library spells it.

[types.go:209 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L209)

```go
func (phase Phase) String() string
```

#### Constants

##### `KeyUnknown`

KeyUnknown is the key that stands for no key, every bit of it set, the start of a descending walk over a whole collection.

[db.go:105 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L105)

```go
var KeyUnknown = Key{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
```

## Reads and Writes

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

Keys 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. `TapeOf` packs strings or byte slices into a fresh tape, while `U32Tape` and `U64Tape` view bytes and offsets the caller already holds, without a copy. A read answers `Values`, which addresses the tape in the arena rather than copying out of it, reports a missing key as absent, and passes the whole batch back through `Values.Tape`, so a tape a read wrote is written again as it is. Since every result views the arena as Go slices, a verb into an arena whose `Describe` reports `HostAccessRefused` fails with `StatusDevice` before it runs, while managed memory and Apple’s shared memory read in place. A write carries values and nothing else, so an empty value is still a value, and `BlobsRemove` removes keys, or ranges given end keys.

```go
ada, grace, kent := ustore.KeyFromUint64(1), ustore.KeyFromUint64(2), ustore.KeyFromUint64(3)
err := database.BlobsWrite(people, []ustore.Key{ada, grace}, ustore.TapeOf("Ada", "Grace"), nil)

values, err := database.BlobsRead(people, []ustore.Key{ada, grace, kent}, arena, nil)
name, ok := values.Get(0)    // "Ada", true
_, ok = values.Get(2)        // false
headers, err := database.BlobsRead(people, []ustore.Key{ada}, arena, &ustore.BlobsReadConfig{Limits: []uint64{2}})
err = database.BlobsRemove(people, []ustore.Key{grace}, nil)
```

### API

#### Types

##### `ArrowArray`

ArrowArray is the Arrow C data interface's array of one column, laid out as struct ArrowArray.

[db.go:32 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L32)

```go
type ArrowArray C.struct_ArrowArray
```

##### `BlobsReadConfig`

BlobsReadConfig carries the optional arguments of [DatabaseOn.BlobsRead](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#BlobsRead).

[db.go:246 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L246)

```go
type BlobsReadConfig struct {
    Offsets []uint64
    Limits []uint64
}
```

##### Fields

| `Offsets` | `[]uint64` | Offsets are the byte offsets into every value the read starts at, one per key, or whole values when empty. |
| - | - | - |
| `Limits` | `[]uint64` | Limits cap the bytes read of every value from its offset, one per key, or the rest when empty. |

##### `BlobsScanConfig`

BlobsScanConfig carries the optional arguments of [DatabaseOn.BlobsScan](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#BlobsScan).

[db.go:302 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L302)

```go
type BlobsScanConfig struct {
    StartKeys []Key
    EndKeys []Key
    Direction ScanDirection
    Patterns Patterns
    Predicate Admitter
    Mode ScanMode
    Progress ProgressCallback
}
```

##### Fields

| `StartKeys` | `[]Key` | StartKeys are the inclusive starts of the scans, one per task, or the first key in Direction when empty. |
| - | - | - |
| `EndKeys` | `[]Key` | EndKeys are the keys every scan stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every scan goes from its start. |
| `Patterns` | `Patterns` | Patterns keep the keys whose values match, shared by every scan. |
| `Predicate` | `Admitter` | Predicate admits or passes over the listed keys. |
| `Mode` | `ScanMode` | Mode is in what order the keys come. |
| `Progress` | `ProgressCallback` | Progress reports the scans finished, and may cancel the call. |

##### `IngestRows`

IngestRows is one batch of rows: keys and values for blobs, documents and pages, values as the strings and keys as what they map onto for strings, and sources, targets and optional edge identifiers for graphs.

[db.go:2014 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L2014)

```go
type IngestRows struct {
    Keys []Key
    Values Tape
    Sources []Key
    Targets []Key
    Edges []Key
}
```

##### Fields

| `Keys` | `[]Key` | Keys are the keys of blobs, documents and pages, or the keys strings map onto. |
| - | - | - |
| `Values` | `Tape` | Values are the values of blobs, JSON documents and XML pages, or the strings of a strings collection. |
| `Sources` | `[]Key` | Sources are the sources of edges. |
| `Targets` | `[]Key` | Targets are the targets of edges. |
| `Edges` | `[]Key` | Edges are the identifiers of edges, or nothing for the default identifier of each. |

##### `RemoveConfig`

RemoveConfig carries the optional arguments of a removal by key or by range.

[db.go:39 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L39)

```go
type RemoveConfig struct {
    EndKeys []Key
    Durability Durability
}
```

##### Fields

| `EndKeys` | `[]Key` | EndKeys turns every key into the inclusive start of a range ending before its end key, one per task, or removes the keys alone when empty. |
| - | - | - |
| `Durability` | `Durability` | Durability is how durable the removals are once the call finishes at the head. |

##### `StringsCursorConfig`

StringsCursorConfig carries the optional arguments of [DatabaseOn.StringsCursorInit](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#StringsCursorInit).

[db.go:319 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L319)

```go
type StringsCursorConfig struct {
    Prefix string
    StartString string
    EndString string
    Direction ScanDirection
    Patterns Patterns
    Predicate Admitter
}
```

##### Fields

| `Prefix` | `string` | Prefix is what every string the walk returns starts with, or nothing to match every string. |
| - | - | - |
| `StartString` | `string` | StartString is where the walk starts, inclusive, or the first string of the prefix in Direction when empty. |
| `EndString` | `string` | EndString is the string the walk stops before, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way the walk goes from its start. |
| `Patterns` | `Patterns` | Patterns keep the strings matching, compiled once. |
| `Predicate` | `Admitter` | Predicate admits or passes over the keys of every page. |

##### `StringsLayout`

StringsLayout is the layout a tape of strings exports as.

[db.go:52 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L52)

```go
type StringsLayout int32
```

##### Values

| `StringsU32Tape` | | StringsU32Tape is Arrow's binary layout, with 32-bit offsets. |
| - | - | - |
| `StringsU64Tape` | | StringsU64Tape is Arrow's large binary layout, with 64-bit offsets. |

##### `StringsMeasureConfig`

StringsMeasureConfig carries the optional arguments of [DatabaseOn.StringsMeasure](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#StringsMeasure).

[db.go:520 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L520)

```go
type StringsMeasureConfig struct {
    StartStrings Tape
    EndStrings Tape
    Direction ScanDirection
}
```

##### Fields

| `StartStrings` | `Tape` | StartStrings are the inclusive starts of the ranges, one per task, or the first string in Direction when empty. |
| - | - | - |
| `EndStrings` | `Tape` | EndStrings are the strings every range stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every range goes from its start. |

##### `StringsRemoveConfig`

StringsRemoveConfig carries the optional arguments of [DatabaseOn.StringsRemove](https://www.unum.cloud/docs/ustore/go/transactions.md#StringsRemove).

[db.go:74 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L74)

```go
type StringsRemoveConfig struct {
    EndStrings Tape
    Durability Durability
}
```

##### Fields

| `EndStrings` | `Tape` | EndStrings turns every string into the inclusive start of a range ending before its end string, one per task, or removes the strings alone when empty. |
| - | - | - |
| `Durability` | `Durability` | Durability is how durable the removals are once the call finishes at the head. |

##### `StringsScanConfig`

StringsScanConfig carries the optional arguments of [DatabaseOn.StringsScan](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#StringsScan).

[db.go:235 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L235)

```go
type StringsScanConfig struct {
    Prefixes Tape
    StartStrings Tape
    EndStrings Tape
    Direction ScanDirection
    Patterns Patterns
    Predicate Admitter
    Mode ScanMode
    Progress ProgressCallback
}
```

##### Fields

| `Prefixes` | `Tape` | Prefixes every scan matches, one per task, or every string when empty. |
| - | - | - |
| `StartStrings` | `Tape` | StartStrings are the inclusive starts of the scans, one per task, or the first string in Direction when empty. |
| `EndStrings` | `Tape` | EndStrings are the strings every scan stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every scan goes from its start. |
| `Patterns` | `Patterns` | Patterns keep the strings matching, shared by every scan. |
| `Predicate` | `Admitter` | Predicate admits or passes over the keys the listed strings map onto. |
| `Mode` | `ScanMode` | Mode is in what order the strings come. |
| `Progress` | `ProgressCallback` | Progress reports the scans finished, and may cancel the call. |

##### `WriteConfig`

WriteConfig carries the optional arguments of a write that takes nothing else.

[db.go:33 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L33)

```go
type WriteConfig struct {
    Durability Durability
}
```

##### Fields

| `Durability` | `Durability` | Durability is how durable the writes are once the call finishes at the head. |
| - | - | - |

##### Type `ArrowDeviceArray`

ArrowDeviceArray is an [ArrowArray](#ArrowArray) beside the device its buffers live on, laid out as struct ArrowDeviceArray.2

[arrow.go:36 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/arrow.go#L36)

```go
type ArrowDeviceArray C.struct_ArrowDeviceArray
```

###### `Array`

Array reports the column itself, which the converters read as they read a host array.

[arrow.go:47 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/arrow.go#L47)

```go
func (array *ArrowDeviceArray) Array() *ArrowArray
```

###### `Release`

Release hands the array back to its producer, once; a released array is safe to release again.

[arrow.go:42 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/arrow.go#L42)

```go
func (array *ArrowDeviceArray) Release()
```

##### Type `ArrowSchema`

ArrowSchema is the Arrow C data interface's schema of one column, laid out as struct ArrowSchema, so any Arrow library reads it through its address.1

[arrow.go:29 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/arrow.go#L29)

```go
type ArrowSchema C.struct_ArrowSchema
```

###### `Release`

Release hands the schema back to its producer, once; a released schema is safe to release again.

[arrow.go:39 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/arrow.go#L39)

```go
func (schema *ArrowSchema) Release()
```

##### Enum `Durability`

Durability is how durable a write at the head is once the call finishes; a transaction's commit decides its own.2

[db.go:221 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L221)

```go
type Durability int32
```

##### Values

| `DurabilityBuffered` | | DurabilityBuffered is visible on return and durable at the next flush. |
| - | - | - |
| `DurabilityFlushed` | | DurabilityFlushed is durable on return. |

###### `DurabilityFromName`

DurabilityFromName reads a durability back from the spelling [Durability.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:236 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L236)

```go
func DurabilityFromName(name string) (Durability, error)
```

###### `String`

String renders the durability as the library spells it.

[db.go:231 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L231)

```go
func (durability Durability) String() string
```

##### Enum `IngestOrder`

IngestOrder is in what order an ingest's rows arrive.2

[db.go:416 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L416)

```go
type IngestOrder int32
```

##### Values

| `IngestSorted` | | IngestSorted takes keys strictly ascending across every append. |
| - | - | - |
| `IngestUnsorted` | | IngestUnsorted takes keys in any order, the last row of a key winning. |

###### `IngestOrderFromName`

IngestOrderFromName reads an ingest order back from the spelling [IngestOrder.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:431 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L431)

```go
func IngestOrderFromName(name string) (IngestOrder, error)
```

###### `String`

String renders the order as the library spells it.

[db.go:426 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L426)

```go
func (order IngestOrder) String() string
```

##### Struct `Listing`

Listing is what a batch of string scans or samples wrote into its arena, strings scan after scan, readable until the arena serves another call.4

[strings.go:197 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L197)

```go
type Listing struct {
    // contains filtered or unexported fields
}
```

###### `Count`

Count reports how many strings scan task found.

[strings.go:209 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L209)

```go
func (listing Listing) Count(task uint) uint
```

###### `Get`

Get views string index of scan task in the arena; index must be below [Listing.Count](#Count).

[strings.go:216 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L216)

```go
func (listing Listing) Get(task, index uint) []byte
```

###### `Len`

Len reports how many scans or samples the call ran.

[strings.go:206 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L206)

```go
func (listing Listing) Len() uint
```

###### `Scores`

Scores views the BM25 score of every string scan task found, and nothing unless the patterns carried weights.

[strings.go:224 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L224)

```go
func (listing Listing) Scores(task uint) []float32
```

##### Struct `Mapped`

Mapped is the key every string a read looked up maps onto, in the order of the strings, readable until the arena serves another call.2

[strings.go:130 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L130)

```go
type Mapped struct {
    // contains filtered or unexported fields
}
```

###### `Get`

Get reports the key string index maps onto, and false for a missing string.

[strings.go:141 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L141)

```go
func (mapped Mapped) Get(index uint) (Key, bool)
```

###### `Len`

Len reports how many strings the call looked up.

[strings.go:138 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L138)

```go
func (mapped Mapped) Len() uint
```

##### Struct `Strings`

Strings is a ragged batch a call wrote into its arena as a tape, readable until the arena serves another call.3

[types.go:565 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L565)

```go
type Strings struct {
    // contains filtered or unexported fields
}
```

###### `Get`

Get views string index in the arena; index must be below [Strings.Len](https://www.unum.cloud/docs/ustore/go/graphs.md#Len).

[types.go:585 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L585)

```go
func (strings Strings) Get(index uint) []byte
```

###### `Len`

Len reports how many strings the call wrote.

[types.go:571 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L571)

```go
func (strings Strings) Len() uint
```

###### `Tape`

Tape passes the strings back as an input, so a tape one call wrote is written again as it is, valid while the arena holds it.

[types.go:605 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L605)

```go
func (strings Strings) Tape() Tape
```

##### Struct `StringsPage`

StringsPage is one pull of a strings walk, written into its arena and readable until the arena serves another call.3

[strings.go:396 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L396)

```go
type StringsPage struct {
    // contains filtered or unexported fields
}
```

###### `Len`

Len reports how many strings the pull handed out; fewer than wanted exhausts the walk for good.

[strings.go:404 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L404)

```go
func (page StringsPage) Len() uint
```

###### `Strings`

Strings views the strings of the page in the arena.

[strings.go:407 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L407)

```go
func (page StringsPage) Strings() Strings
```

###### `Values`

Values views the key every string maps onto, and is empty after a [StringsCursor.NextStrings](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#NextStrings) pull.

[strings.go:415 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L415)

```go
func (page StringsPage) Values() []Key
```

##### Struct `Tape`

Tape passes a ragged batch of byte strings as Apache Arrow lays one out: the bytes end to end, and one more offset than strings around them, string i spanning offsets\[i] up to offsets\[i+1].5

[types.go:495 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L495)

```go
type Tape struct {
    // contains filtered or unexported fields
}
```

A Tape views and never owns, and the binding pins both slices until each call it crosses is final. The zero Tape is the empty batch, which a verb reads as its input's default.

###### `StringsViewFromArrow`

StringsViewFromArrow views the byte strings of a binary, utf8, large binary or large utf8 column in place as a [Tape](#Tape), viewing the column's buffers.

[types.go:82 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L82)

```go
func StringsViewFromArrow(
    schema *ArrowSchema,
    array *ArrowArray,
) (Tape, error)
```

###### `TapeOf`

TapeOf packs strings end to end into a fresh Tape, one entry apiece, with 32-bit offsets while the bytes fit in 4 GiB and 64-bit beyond.

[types.go:524 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L524)

```go
func TapeOf[Text ~string | ~[]byte](texts ...Text) Tape
```

###### `U32Tape`

U32Tape views bytes end to end around len(offsets) - 1 strings, in Arrow's binary layout.

[types.go:505 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L505)

```go
func U32Tape(data []byte, offsets []uint32) Tape
```

Panics when the offsets overrun the bytes, which names a caller's arithmetic mistake rather than a condition the library could report.

###### `U64Tape`

U64Tape views bytes end to end around len(offsets) - 1 strings, in Arrow's large binary layout.

[types.go:515 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L515)

```go
func U64Tape(data []byte, offsets []uint64) Tape
```

Panics when the offsets overrun the bytes.

###### `Len`

Len reports how many strings the tape spans.

[types.go:547 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L547)

```go
func (tape Tape) Len() uint
```

##### Struct `Values`

Values is a batch of values a read wrote into its arena, in the order of its keys, readable until the arena serves another call.3

[blobs.go:49 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L49)

```go
type Values struct {
    // contains filtered or unexported fields
}
```

###### `Get`

Get views value index in the arena, and false for a missing key.

[blobs.go:60 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L60)

```go
func (values Values) Get(index uint) ([]byte, bool)
```

###### `Len`

Len reports how many values the call read.

[blobs.go:57 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L57)

```go
func (values Values) Len() uint
```

###### `Tape`

Tape passes every value back as an input, a missing key as an empty value, so a read's tape is written again as it is.

[blobs.go:71 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L71)

```go
func (read Values) Tape() Tape
```

#### Functions

##### `KeysViewToArrow`

KeysViewToArrow exports keys a call wrote into arena as one fixed_size_binary(16) column tagged arrow\.uuid, in place; until both outputs are released, the arena's next call and Close answer [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended), so release them after reading.

[ustore.go:95 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/ustore.go#L95)

```go
func KeysViewToArrow(
    keys []Key,
    arena *Arena,
    schema *ArrowSchema,
    array *ArrowDeviceArray,
) error
```

##### `StringsViewToArrow`

StringsViewToArrow exports strings a call wrote into arena as one binary or large binary column, in place when the tape already has layout; until both outputs are released, the arena's next call and Close answer [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended).

[ustore.go:107 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/ustore.go#L107)

```go
func StringsViewToArrow(
    strings Strings,
    layout StringsLayout,
    arena *Arena,
    schema *ArrowSchema,
    array *ArrowDeviceArray,
) error
```

## Scans

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

Scans, samples and measures run one task per collection their `Collections` names, from a start key, inclusive, towards an end key, exclusive, in a `ScanDirection`. `BlobsScan` lists up to the count it wants, `BlobsSample` draws keys at random, and `BlobsMeasure` bounds the keys and bytes a range holds without walking it; `DocsScan`, `PagesScan`, `StringsScan` and `GraphScanVertices` serve the other modalities. A start key of `Key{}` walks up from the first key, and `KeyUnknown` walks down from the last. A cursor walks one collection page by page, each pull resuming past the last key the one before it handed out, and a page shorter than wanted exhausts it for good. `ChangesCursorInit` opens a feed of the changes committed after a `CommitStamp`, oldest first, pinning that stamp as a snapshot does. A cursor keeps no executor: `cursor.NextPairs(..)` pulls on the calling goroutine, and `cursor.On(executor).NextPairs(..)` blocks on the executor named for that pull. A `DocsCursor` gathers the `Fields` of its config into typed columns, and its `Next` answers `DocsBatches`, one batch of keys and columns per executor task that found rows, none once the walk is exhausted.

```go
first, err := database.BlobsScan(people, 100, arena, nil)
measured, err := database.BlobsMeasure(people, arena, &ustore.MeasureConfig{StartKeys: []ustore.Key{ada}, EndKeys: []ustore.Key{kent}})
last, err := database.BlobsScan(people, 10, arena, &ustore.BlobsScanConfig{
	StartKeys: []ustore.Key{ustore.KeyUnknown}, Direction: ustore.ScanDescending,
})

cursor, err := database.On(executor).BlobsCursorInit(people, ustore.Key{}, nil)
defer cursor.Close()
for {
	page, err := cursor.On(executor).NextPairs(1024, arena)
	if err != nil || page.Len() < 1024 {
		break
	}
}

ages, err := database.DocsCursorInit(people, ustore.Key{}, &ustore.DocsCursorConfig{
	Fields: ustore.TapeOf("age"), ColumnsTypes: []ustore.DocsFieldType{ustore.DocsFieldTypeU64},
})
defer ages.Close()
batches, err := ages.On(executor).Next(1024, arena) // batches.Keys(i) and batches.Columns(i) per batch
```

#### Progress and Cancellation

The configs of `Compact`, `Save`, `PagesImport` and the scans carry an optional `ProgressCallback`, called with the units finished and the units in all, never on two threads at once and never after the call is final. Answering false cancels the call, which fails with `StatusCancelled` and publishes nothing, a cancelled save removing what it wrote. A handler must not panic, since unwinding through the library’s C frames aborts the process.

```go
deadline := time.Now().Add(30 * time.Second)
beforeTheDeadline := func(finished, total uint64) bool { return time.Now().Before(deadline) }
err := snapshot.Save("/var/lib/people-copy", beforeTheDeadline)
if errors.Is(err, ustore.StatusCancelled) {
	fmt.Println("the copy was removed")
}
```

The `Predicate` field of a scan or cursor config admits or passes over the keys it lists, asked on the host, and its type tells the library what one call costs:

- `ustore.Predicate` answers one key at a time, asked before patterns or filters read any value.
- `ustore.BatchPredicate` answers a page of keys at once, asked about the keys patterns and filters kept, for handlers that pay per call.
- `ustore.CheapBatchPredicate` answers a page of keys at once, asked before patterns or filters read any value.

```go
odd := ustore.Predicate(func(key ustore.Key) bool { return key[15]%2 == 1 })
found, err := database.BlobsScan(people, 10, arena, &ustore.BlobsScanConfig{Predicate: odd})

moderated := ustore.BatchPredicate(func(keys []ustore.Key, admissions []ustore.Admission) {
	for position, allowed := range moderation.Check(keys) { // one round trip for the whole page
		if allowed {
			admissions[position] = ustore.Admit
		}
	}
})
found, err = database.BlobsScan(people, 10, arena, &ustore.BlobsScanConfig{Predicate: moderated})
```

Admissions start as `ustore.Reject`, and both slices live only until the handler returns.

### API

#### Types

##### `Admission`

Admission is whether a predicate keeps a listed key or passes over it.

[db.go:465 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L465)

```go
type Admission int32
```

##### Values

| `Reject` | | Reject passes over the key. |
| - | - | - |
| `Admit` | | Admit keeps the key among the listed ones. |

##### `Admitter`

Admitter is the predicate a scan or a cursor asks about the keys it lists: a [Predicate](#Predicate), a [BatchPredicate](#BatchPredicate) or a [CheapBatchPredicate](#CheapBatchPredicate), whose type tells the library what one call costs.

[db.go:443 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L443)

```go
type Admitter interface {
    // contains filtered or unexported methods
}
```

##### `BatchPredicate`

BatchPredicate writes an Admission for every key into admissions, which start as Reject, for handlers that pay per call: it is asked once per page about every key patterns and filters kept.

[db.go:458 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L458)

```go
type BatchPredicate func(keys []Key, admissions []Admission)
```

Both slices live only until it returns. The executor's threads may ask it at once, so it must be safe to call from several goroutines concurrently, and it must not panic.

##### `BlobsCursorConfig`

BlobsCursorConfig carries the optional arguments of [DatabaseOn.BlobsCursorInit](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#BlobsCursorInit).

[db.go:383 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L383)

```go
type BlobsCursorConfig struct {
    EndKey *Key
    Direction ScanDirection
    Patterns Patterns
    Predicate Admitter
}
```

##### Fields

| `EndKey` | `*Key` | EndKey is the key the walk stops before, or nil for no bound. |
| - | - | - |
| `Direction` | `ScanDirection` | Direction is which way the walk goes from its start. |
| `Patterns` | `Patterns` | Patterns keep the keys whose values match, compiled once. |
| `Predicate` | `Admitter` | Predicate admits or passes over the keys of every page. |

##### `CheapBatchPredicate`

CheapBatchPredicate is a [BatchPredicate](#BatchPredicate) asked once per page before patterns or filters read any value, so it narrows those reads.

[db.go:462 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L462)

```go
type CheapBatchPredicate func(keys []Key, admissions []Admission)
```

##### `DocsCursorConfig`

DocsCursorConfig carries the optional arguments of [DatabaseOn.DocsCursorInit](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DocsCursorInit).

[db.go:548 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L548)

```go
type DocsCursorConfig struct {
    EndKey *Key
    Direction ScanDirection
    Filter string
    Predicate Admitter
    Fields Tape
    ColumnsTypes []DocsFieldType
}
```

##### Fields

| `EndKey` | `*Key` | EndKey is the key the walk stops before, or nil for no bound. |
| - | - | - |
| `Direction` | `ScanDirection` | Direction is which way the walk goes from its start. |
| `Filter` | `string` | Filter is a JSONPath every document the walk hands out matches, compiled once. |
| `Predicate` | `Admitter` | Predicate admits or passes over the keys of every page. |
| `Fields` | `Tape` | Fields are the fields every pull gathers into the columns of its batches, the empty field being the whole document, or none for keys alone. |
| `ColumnsTypes` | `[]DocsFieldType` | ColumnsTypes holds the type every field converts into, one per field. |

##### `DocsScanConfig`

DocsScanConfig carries the optional arguments of [DatabaseOn.DocsScan](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DocsScan).

[db.go:473 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L473)

```go
type DocsScanConfig struct {
    StartKeys []Key
    EndKeys []Key
    Direction ScanDirection
    Filter string
    Predicate Admitter
    Mode ScanMode
    Progress ProgressCallback
}
```

##### Fields

| `StartKeys` | `[]Key` | StartKeys are the inclusive starts of the scans, one per task, or the first key in Direction when empty. |
| - | - | - |
| `EndKeys` | `[]Key` | EndKeys are the keys every scan stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every scan goes from its start. |
| `Filter` | `string` | Filter is a JSONPath, or a bare root filter such as ?@.age>30, every listed document matches. |
| `Predicate` | `Admitter` | Predicate admits or passes over the listed keys. |
| `Mode` | `ScanMode` | Mode is in what order the keys come. |
| `Progress` | `ProgressCallback` | Progress reports the scans finished, and may cancel the call. |

##### `Each`

Each names one collection per task of a batch.

[db.go:154 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L154)

```go
type Each []CollectionID
```

##### `MeasureConfig`

MeasureConfig carries the optional arguments of a measure.

[db.go:110 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L110)

```go
type MeasureConfig struct {
    StartKeys []Key
    EndKeys []Key
    Direction ScanDirection
}
```

##### Fields

| `StartKeys` | `[]Key` | StartKeys are the inclusive starts of the ranges, one per task, or the first key in Direction when empty. |
| - | - | - |
| `EndKeys` | `[]Key` | EndKeys are the keys every range stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every range goes from its start. |

##### `Measured`

Measured is the bounds on the entries and the space one range holds.

[db.go:134 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L134)

```go
type Measured struct {
    MinCardinality, MaxCardinality uint64
    MinValueBytes, MaxValueBytes   uint64
    MinSpaceUsage, MaxSpaceUsage   uint64
}
```

##### `PagesCursorConfig`

PagesCursorConfig carries the optional arguments of [DatabaseOn.PagesCursorInit](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#PagesCursorInit).

[db.go:577 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L577)

```go
type PagesCursorConfig struct {
    EndKey *Key
    Direction ScanDirection
    Filter string
    Predicate Admitter
}
```

##### Fields

| `EndKey` | `*Key` | EndKey is the key the walk stops before, or nil for no bound. |
| - | - | - |
| `Direction` | `ScanDirection` | Direction is which way the walk goes from its start. |
| `Filter` | `string` | Filter is the expression every page the walk hands out matches, compiled once. |
| `Predicate` | `Admitter` | Predicate admits or passes over the keys of every page. |

##### `Patterns`

Patterns keeps the values or strings a scan or a walk lists to the ones matching, shared by every task of the call; the zero value matches everything.

[db.go:620 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L620)

```go
type Patterns struct {
    Patterns Tape
    Kind PatternKind
    Sensitivity CaseSensitivity
    Weights []float32
}
```

##### Fields

| `Patterns` | `Tape` | Patterns are the expressions or substrings to match. |
| - | - | - |
| `Kind` | `PatternKind` | Kind is what the patterns are matched as. |
| `Sensitivity` | `CaseSensitivity` | Sensitivity is whether matching folds case. |
| `Weights` | `[]float32` | Weights holds one weight per substring pattern, which turns on BM25 scores, or nothing. |

##### `Predicate`

Predicate admits one listed key into a scan or a walk, or passes over it, asked once per page before patterns or filters read any value.

[db.go:452 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L452)

```go
type Predicate func(key Key) bool
```

The executor's threads may ask it at once, so it must be safe to call from several goroutines concurrently, and it must not panic.

##### Enum `CaseSensitivity`

CaseSensitivity is whether patterns compare bytes as they are or after Unicode case folding.2

[types.go:257 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L257)

```go
type CaseSensitivity int32
```

##### Values

| `Cased` | | Cased compares bytes as they are. |
| - | - | - |
| `Uncased` | | Uncased folds the case of both the patterns and the values. |

###### `CaseSensitivityFromName`

CaseSensitivityFromName reads a case sensitivity back from the spelling [CaseSensitivity.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:273 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L273)

```go
func CaseSensitivityFromName(name string) (CaseSensitivity, error)
```

###### `String`

String renders the case sensitivity as the library spells it.

[types.go:267 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L267)

```go
func (sensitivity CaseSensitivity) String() string
```

##### Enum `ChangeKind`

ChangeKind is what one committed change did to its key.2

[db.go:392 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L392)

```go
type ChangeKind int32
```

##### Values

| `ChangeWrite` | | ChangeWrite wrote the whole value. |
| - | - | - |
| `ChangeRemoval` | | ChangeRemoval removed the key. |
| `ChangeChange` | | ChangeChange changed part of the value, as a document patch or a page edit does. |

###### `ChangeKindFromName`

ChangeKindFromName reads a change kind back from the spelling [ChangeKind.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:409 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L409)

```go
func ChangeKindFromName(name string) (ChangeKind, error)
```

###### `String`

String renders the change kind as the library spells it.

[db.go:404 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L404)

```go
func (kind ChangeKind) String() string
```

##### Struct `Changes`

Changes is one pull of a feed, written into its arena and readable until the arena serves another call.5

[db.go:1858 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1858)

```go
type Changes struct {
    // contains filtered or unexported fields
}
```

###### `Key`

Key reports the key change index touched.

[db.go:1871 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1871)

```go
func (changes Changes) Key(index uint) Key
```

###### `Kind`

Kind reports what change index did to its key.

[db.go:1885 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1885)

```go
func (changes Changes) Kind(index uint) ChangeKind
```

###### `Len`

Len reports how many changes the pull yielded, zero at the newest commit.

[db.go:1868 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1868)

```go
func (changes Changes) Len() uint
```

###### `Stamp`

Stamp reports the commit change index landed at.

[db.go:1878 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1878)

```go
func (changes Changes) Stamp(index uint) CommitStamp
```

###### `Value`

Value views the bytes change index carries in the arena, empty for a removal and for a pull through [ChangesCursor.NextKeys](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#NextKeys).

[db.go:1893 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1893)

```go
func (changes Changes) Value(index uint) []byte
```

##### Struct `Measurement`

Measurement is the bounds a measure estimated, one per range, readable until the arena serves another call.2

[blobs.go:122 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L122)

```go
type Measurement struct {
    // contains filtered or unexported fields
}
```

###### `Get`

Get reports the bounds of range index.

[blobs.go:144 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L144)

```go
func (measurement Measurement) Get(index uint) Measured
```

###### `Len`

Len reports how many ranges the call measured.

[blobs.go:141 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L141)

```go
func (measurement Measurement) Len() uint
```

##### Struct `Page`

Page is one pull of a walk, written into its arena and readable until the arena serves another call.3

[db.go:1780 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1780)

```go
type Page struct {
    // contains filtered or unexported fields
}
```

###### `Keys`

Keys views the keys of the page in the arena.

[db.go:1791 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1791)

```go
func (page Page) Keys() []Key
```

###### `Len`

Len reports how many keys the pull handed out; fewer than wanted exhausts the walk for good.

[db.go:1788 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1788)

```go
func (page Page) Len() uint
```

###### `Values`

Values views the values of the page in the arena, one per key, empty for a keys-only pull.

[db.go:1798 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1798)

```go
func (page Page) Values() Strings
```

##### Enum `PatternKind`

PatternKind is what the strings of [Patterns](#Patterns) are matched as.2

[types.go:235 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L235)

```go
type PatternKind int32
```

##### Values

| `PatternRegex` | | PatternRegex matches regular expressions, of which a value matches at least one somewhere. |
| - | - | - |
| `PatternSubstrings` | | PatternSubstrings matches literal substrings, found together through Aho-Corasick. |

###### `PatternKindFromName`

PatternKindFromName reads a pattern kind back from the spelling [PatternKind.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:250 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L250)

```go
func PatternKindFromName(name string) (PatternKind, error)
```

###### `String`

String renders the pattern kind as the library spells it.

[types.go:245 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L245)

```go
func (kind PatternKind) String() string
```

##### Enum `ScanDirection`

ScanDirection is which way a scan, a walk or a measure goes from its start key.2

[db.go:286 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L286)

```go
type ScanDirection int32
```

##### Values

| `ScanAscending` | | ScanAscending walks up from the start key, the default. |
| - | - | - |
| `ScanDescending` | | ScanDescending walks down from the start key. |

###### `ScanDirectionFromName`

ScanDirectionFromName reads a direction back from the spelling [ScanDirection.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:301 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L301)

```go
func ScanDirectionFromName(name string) (ScanDirection, error)
```

###### `String`

String renders the direction as the library spells it.

[db.go:296 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L296)

```go
func (direction ScanDirection) String() string
```

##### Enum `ScanMode`

ScanMode is in what order a scan hands its keys over.2

[db.go:264 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L264)

```go
type ScanMode int32
```

##### Values

| `ScanOrdered` | | ScanOrdered hands keys over in their order. |
| - | - | - |
| `ScanUnordered` | | ScanUnordered hands keys over in any order, as fast as the engine finds them. |

###### `ScanModeFromName`

ScanModeFromName reads a scan mode back from the spelling [ScanMode.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:279 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L279)

```go
func ScanModeFromName(name string) (ScanMode, error)
```

###### `String`

String renders the scan mode as the library spells it.

[db.go:274 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L274)

```go
func (mode ScanMode) String() string
```

##### Struct `Scanned`

Scanned is what a batch of scans or samples wrote into its arena, keys scan after scan, readable until the arena serves another call.3

[blobs.go:79 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L79)

```go
type Scanned struct {
    // contains filtered or unexported fields
}
```

###### `Keys`

Keys views the keys scan task found in the arena.

[blobs.go:91 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L91)

```go
func (scanned Scanned) Keys(task uint) []Key
```

###### `Len`

Len reports how many scans or samples the call ran.

[blobs.go:88 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L88)

```go
func (scanned Scanned) Len() uint
```

###### `Scores`

Scores views the BM25 score of every key scan task found, and nothing unless the patterns carried weights.

[blobs.go:99 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L99)

```go
func (scanned Scanned) Scores(task uint) []float32
```

## Batches and Arenas

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

Every output whose length scales with the call lands in an `Arena`, and the verb answers a view over it. `NewArena(executor)` places one where that executor computes, and `NewArena(nil)` on host pages, and a call rewinds it, keeping its high-water mark, so a steady loop allocates once. A view read after a later call took its arena fails as `Contended`. A slice or segment an accessor returned is valid only until the arena’s next call. A result kept past the next call needs the next call to take another arena. An input lying inside the arena a call rewinds is refused with `StatusInvalidArgument`. A `Key` is sixteen bytes ordered as their bytes, and `KeyFromUint64` spells an integer big-endian, so integer keys order as integers.

```go
found, err := ustore.NewArena(nil)
fetched, err := ustore.NewArena(nil)
scanned, err := database.BlobsScan(people, 100, found, nil)
for _, key := range scanned.Keys(0) {
	values, err := database.BlobsRead(people, []ustore.Key{key}, fetched, nil) // rewinds fetched, never found
	consume(values, err)
}
```

#### Receivers & Deferred Calls

The receiver a verb is called on chooses what it sees, where it runs and how it completes, while the verb and its arguments stay. A `Database`, a `Transaction`, a `Snapshot` and a cursor run their verbs on the calling goroutine, `On(executor)` blocks on an executor, and `Deferred(executor)`, which cursors lack, answers a `*Deferred` once the call is submitted, or the refusal the binding or the library made before anything ran. A deferred call reads its slices and writes its arena until it is final, so neither may change until `Wait` returns. `Wait` blocks in `ustore_outcome_wait`, `Status` polls through `ustore_outcome_status`, and a `Deferred` dropped without either is released by the collector once its call is final.

```go
deferred := database.Deferred(executor)
writing, err := deferred.BlobsWrite(people, []ustore.Key{ada, grace}, ustore.TapeOf("Ada", "Grace"), nil)
if err != nil {
	return err
}
_, err = writing.Wait()

reading, err := deferred.BlobsRead(people, []ustore.Key{ada, grace}, arena, nil)
values, err := reading.Wait() // or poll reading.Status() until it leaves ustore.StatusDeferred
committing, err := transaction.Deferred(executor).Commit(ustore.DurabilityBuffered)
```

#### Executors

An `Executor` is the threads that run calls, shared by any number of databases and receivers, serving one call at a time, so a call submitted while another holds it answers `StatusContended`. `ExecutorForRam` spawns threads near the NUMA nodes it names, every node for an empty list, where zero threads take seven eighths of their cores, and a nonzero scratch limit caps each thread’s scratch. `ExecutorForNvme` spawns the NVMe engine’s rings near the memory domains it names or the media under its `Paths`, and `ExecutorForVram` drives the GPUs of one vendor, their positions in `GPUDevices` or every one for none, one stream each, which it creates and destroys or adopts from the caller and destroys. Opening a database blocks, on the executor its config names or the calling goroutine, and closing an executor waits for the call holding it. An arena never outlives the executor that made it, so `defer executor.Close()` comes before `defer arena.Close()`, and an arena from `NewArena(nil)` lives until it is closed.

```go
executor, err := ustore.ExecutorForRam([]int32{0}, 8, ustore.CPUClassUnknown, 0)
defer executor.Close()
people, err := ustore.DatabaseOpenRocksdb("/var/lib/people", &ustore.DatabaseOpenRocksdbConfig{Executor: executor})
arena, err := ustore.NewArena(executor)
defer arena.Close()
found, err := people.On(executor).CollectionFind(ustore.TapeOf("names"), arena)
err = executor.Drain(ustore.MoodParked)
```

#### Apache Arrow

The converters of `c/ustore/arrow.h` view an Arrow column as a call’s input in place, and export what a call wrote into an arena as a column in place, and until the column is released the arena’s next call and `Close` answer `StatusContended`:

```go
scanned, err := database.BlobsScan(people, 100, found, nil)
var schema ustore.ArrowSchema
var array ustore.ArrowDeviceArray
if err := ustore.KeysViewToArrow(scanned.Keys(0), found, &schema, &array); err != nil {
	return err
}
defer schema.Release()
defer array.Release()

keys, err := ustore.KeysViewFromArrow(&schema, array.Array()) // the same keys, in place
columns, err := database.DocsGather(movies, keys, ustore.TapeOf("title"), []ustore.DocsFieldType{ustore.DocsFieldTypeString}, fetched)
var titles ustore.ArrowSchema
var column ustore.ArrowDeviceArray
err = ustore.DocsColumnViewToArrow(columns.Column(0), ustore.DocsFieldTypeString, fetched, &titles, &column)
defer titles.Release()
defer column.Release()

tape, err := ustore.StringsViewFromArrow(&titles, column.Array()) // the same strings, as a Tape
err = database.BlobsWrite(people, keys, tape, nil)
```

`KeysViewFromArrow` and `StringsViewFromArrow` read keys and strings, and `KeysViewToArrow`, `StringsViewToArrow` and `DocsColumnViewToArrow` write keys, strings and gathered columns.

### API

#### Types

##### `PhaseProgress`

PhaseProgress is where a plan stands: its phase, that phase's position in the plan, and its own count, laid out as ustore_phase_progress_t.

[db.go:220 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L220)

```go
type PhaseProgress struct {
    Phase Phase
    Ordinal uint64
    Completed uint64
    Total uint64
}
```

##### Fields

| `Phase` | `Phase` | Phase is the kind of work in hand. |
| - | - | - |
| `Ordinal` | `uint64` | Ordinal is this phase's position among the ones the plan runs, from zero. |
| `Completed` | `uint64` | Completed counts the units of this phase done. |
| `Total` | `uint64` | Total counts the units of this phase in all. |

##### `ProgressCallback`

ProgressCallback is called with the units a long call finished so far and the units it finishes if it runs to the end; false stops it, which then fails with [StatusCancelled](https://www.unum.cloud/docs/ustore/go/errors.md#StatusCancelled) and publishes nothing.

[db.go:646 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L646)

```go
type ProgressCallback func(finished, total uint64) bool
```

It never runs on two threads at once, and it must not panic.

##### `Residency`

Residency is where an arena's outputs live.

[db.go:458 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L458)

```go
type Residency int32
```

##### Values

| `ResidencyUnknown` | | ResidencyUnknown is no residency, which only a zeroed description reads as. |
| - | - | - |
| `ResidencyRam` | | ResidencyRam is host pages, which Go code reads in place. |
| `ResidencyVram` | | ResidencyVram is one device's memory, which Go code reads only where its [HostAccess](#HostAccess) is [HostAccessReadable](#HostAccessReadable). |

##### Struct `Arena`

Arena is memory the library writes every output whose length scales with a call into, reused so a steady loop allocates once.3

[types.go:893 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L893)

```go
type Arena struct {
    // contains filtered or unexported fields
}
```

Every call given an arena rewinds and refills it, so the views of its previous call end there, as they do once it is closed: their accessors panic with [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended), as a slice bound does, while a slice already handed out is plain memory the next call overwrites, so it is valid only until then. To keep one call's views past the next, give that call another arena. An arena serves one call at a time, and a second overlapping it fails with [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended). Deferred verbs view it as blocking ones do, since Close waits for every deferred call naming it.

###### `NewArena`

NewArena makes an empty arena where executor computes, host pages or the memory of its GPU, decided once; a nil executor makes host pages for calls on the calling goroutine.

[types.go:902 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L902)

```go
func NewArena(executor *Executor) (*Arena, error)
```

Nothing is allocated until a call writes into it. An arena must not outlive the executor that made it, so [Arena.Close](#Close) comes before [Executor.Close](#Close); one made with a nil executor lives until it is closed.

###### `Close`

Close releases the memory, waiting for every deferred call naming the arena, and ends every view over it; it comes before the Close of the executor that made the arena.

[types.go:1281 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L1281)

```go
func (arena *Arena) Close() error
```

While an Arrow export of its outputs is unreleased it fails with [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended) and frees nothing, so a later Close retries. It is idempotent, and a closed arena must not be used again.

###### `Describe`

Describe reports where the arena's outputs live, as the executor that made it decided.

[types.go:954 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L954)

```go
func (arena *Arena) Describe() (ArenaDescription, error)
```

##### Struct `BlobsCursor`

BlobsCursor walks the keys of one collection page by page, every pull resuming past the last key the pull before it handed out.4

[blobs.go:397 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L397)

```go
type BlobsCursor struct {
    BlobsCursorOn
    // contains filtered or unexported fields
}
```

It holds its database open, and the transaction or snapshot it reads through, until [BlobsCursor.Close](#Close).

###### `*Close`

× 5 Close frees the walk, giving back the holds it kept.

[blobs.go:497 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L497)

```go
func (cursor *BlobsCursor) Close() error
```

It is idempotent.

###### `Next*NextKeys`

× 2 NextKeys pulls up to wanted keys of the walk into arena.

[blobs.go:453 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L453)

Inherited from `BlobsCursorOn`

```go
func (on BlobsCursor) NextNextKeys(
    wanted uint,
    arena *Arena,
) (Page, error)
```

###### `Next*NextPairs`

× 2 NextPairs pulls up to wanted keys of the walk with their values into arena, in one call.

[blobs.go:464 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L464)

Inherited from `BlobsCursorOn`

```go
func (on BlobsCursor) NextNextPairs(
    wanted uint,
    arena *Arena,
) (Page, error)
```

###### `*On`

× 12 On is the receiver whose pulls block on executor.

[blobs.go:410 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L410)

Inherited from `BlobsCursorOn`

```go
func (on BlobsCursor) On(executor *Executor) BlobsCursorOn
```

##### Struct `BlobsCursorOn`

BlobsCursorOn is the receiver whose pulls block until their call is final: on the calling goroutine when embedded in a [BlobsCursor](#BlobsCursor), and on an executor when [BlobsCursorOn.On](#On) makes it.

[blobs.go:405 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/blobs.go#L405)

```go
type BlobsCursorOn struct {
    // contains filtered or unexported fields
}
```

##### Enum `CPUClass`

CPUClass is the CPU generation a database or an executor confines itself to; the zero value sets no ceiling.2

[types.go:301 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L301)

```go
type CPUClass int32
```

##### Values

| `CPUClassUnknown` | | CPUClassUnknown picks the newest class this machine runs. |
| - | - | - |
| `CPUClassSerial` | | CPUClassSerial is the portable floor every CPU runs. |
| `CPUClassMonoversioned` | | CPUClassMonoversioned is the one class of a monoversioned build. |
| `CPUClassIntelHaswell` | | CPUClassIntelHaswell is x86 from Intel Haswell on. |
| `CPUClassIntelSierra` | | CPUClassIntelSierra is x86 efficiency cores from Intel Sierra Forest on. |
| `CPUClassIntelSkylake` | | CPUClassIntelSkylake is x86 server cores from Intel Skylake on. |
| `CPUClassIntelIcelake` | | CPUClassIntelIcelake is x86 server cores from Intel Ice Lake on. |
| `CPUClassAWSG2` | | CPUClassAWSG2 is Arm from AWS Graviton 2 on. |
| `CPUClassAppleM2` | | CPUClassAppleM2 is Arm from Apple M2 on. |
| `CPUClassAWSG5` | | CPUClassAWSG5 is Arm server cores from AWS Graviton 5 on. |
| `CPUClassAlibabaC930` | | CPUClassAlibabaC930 is RISC-V with RVV, Zawrs and Zacas, from Alibaba's C930 on. |
| `CPUClassIBMPower10` | | CPUClassIBMPower10 is Power from POWER10 on. |

###### `CPUClassFromName`

CPUClassFromName reads a CPU class back from the spelling [CPUClass.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:336 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L336)

```go
func CPUClassFromName(name string) (CPUClass, error)
```

###### `String`

String renders the class as the library spells it, such as "intel-haswell".

[types.go:331 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L331)

```go
func (class CPUClass) String() string
```

##### Struct `ChangesCursor`

ChangesCursor is a feed of the changes committed to one collection after a stamp, oldest first, pinning that stamp as a snapshot does until [ChangesCursor.Close](#Close).3

[db.go:1810 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1810)

```go
type ChangesCursor struct {
    ChangesCursorOn
    // contains filtered or unexported fields
}
```

###### `Close`

Close releases the feed and the stamp it pins.

[db.go:1949 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1949)

```go
func (cursor *ChangesCursor) Close() error
```

It is idempotent.

###### `Next*NextKeys`

× 2 NextKeys pulls up to wanted changes into arena: their keys, stamps and kinds.

[db.go:1904 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1904)

Inherited from `ChangesCursorOn`

```go
func (on ChangesCursor) NextNextKeys(
    wanted uint,
    arena *Arena,
) (Changes, error)
```

###### `Next*NextPairs`

× 2 NextPairs pulls up to wanted changes into arena with the bytes every change carries.

[db.go:1915 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1915)

Inherited from `ChangesCursorOn`

```go
func (on ChangesCursor) NextNextPairs(
    wanted uint,
    arena *Arena,
) (Changes, error)
```

##### Struct `ChangesCursorOn`

ChangesCursorOn is the receiver whose pulls block until their call is final: on the calling goroutine when embedded in a [ChangesCursor](#ChangesCursor), or on an executor that [ChangesCursorOn.On](#On) picks.

[db.go:1819 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1819)

```go
type ChangesCursorOn struct {
    // contains filtered or unexported fields
}
```

##### Struct `Database`

Database is an open database, safe to share across goroutines from open until [Database.Close](#Close).38

[db.go:748 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L748)

```go
type Database struct {
    DatabaseOn
    // contains filtered or unexported fields
}
```

Its own verbs read and write the head on the calling goroutine; [DatabaseOn.On](#On) and [DatabaseOn.Deferred](#Deferred) pick an executor.

###### `DatabaseInitRam`

DatabaseInitRam starts an empty database in memory alone.

[db.go:793 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L793)

```go
func DatabaseInitRam(
    config *DatabaseInitRamConfig,
) (*Database, error)
```

###### `DatabaseOpenLeveldb`

DatabaseOpenLeveldb serves a LevelDB directory in place, creating it if absent.

[db.go:935 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L935)

```go
func DatabaseOpenLeveldb(
    directory string,
    config *DatabaseOpenLeveldbConfig,
) (*Database, error)
```

###### `DatabaseOpenNvme`

DatabaseOpenNvme serves a directory through the in-tree NVMe engine.

[db.go:992 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L992)

```go
func DatabaseOpenNvme(
    directory string,
    config *DatabaseOpenNvmeConfig,
) (*Database, error)
```

###### `DatabaseOpenRam`

DatabaseOpenRam serves directory as one in-memory image, loading it if present.

[db.go:815 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L815)

```go
func DatabaseOpenRam(
    directory string,
    config *DatabaseInitRamConfig,
) (*Database, error)
```

###### `DatabaseOpenRocksdb`

DatabaseOpenRocksdb serves a RocksDB directory in place, creating it if absent.

[db.go:874 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L874)

```go
func DatabaseOpenRocksdb(
    directory string,
    config *DatabaseOpenRocksdbConfig,
) (*Database, error)
```

###### `DatabaseViewNvme`

DatabaseViewNvme serves the database a manifest names through the in-tree NVMe engine, read-only, writing nothing to its data directories and refusing every change with [StatusReadOnly](https://www.unum.cloud/docs/ustore/go/errors.md#StatusReadOnly).

[db.go:1050 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1050)

```go
func DatabaseViewNvme(
    directory string,
    config *DatabaseViewNvmeConfig,
) (*Database, error)
```

###### `DatabaseViewRocksdb`

DatabaseViewRocksdb serves a RocksDB directory read-only, refusing every change with [StatusReadOnly](https://www.unum.cloud/docs/ustore/go/errors.md#StatusReadOnly).

[db.go:899 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L899)

```go
func DatabaseViewRocksdb(
    directory string,
    config *DatabaseOpenRocksdbConfig,
) (*Database, error)
```

###### `Close`

Close releases the database once every transaction, snapshot, cursor and ingest holding it is closed, waiting for every deferred call naming it.

[db.go:767 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L767)

```go
func (database *Database) Close() error
```

It never flushes: commits made with [DurabilityBuffered](https://www.unum.cloud/docs/ustore/go/reads-and-writes.md#DurabilityBuffered) and not yet flushed are not on disk, so call [DatabaseOn.Flush](#Flush) first. It is idempotent, and a closed database must not be used again.

###### `Blobs*BlobsRemove`

× 4 BlobsRemove removes keys with their values, or every key of a range per task given end keys.

[db.go:202 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L202)

Inherited from `writes[Handle]`

```go
func (on Database) BlobsBlobsRemove(
    collections Collections,
    keys []Key,
    config *RemoveConfig,
) error
```

###### `Blobs*BlobsWrite`

× 4 BlobsWrite upserts one value per key, an empty value still being a value.

[db.go:162 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L162)

Inherited from `writes[Handle]`

```go
func (on Database) BlobsBlobsWrite(
    collections Collections,
    keys []Key,
    values Tape,
    config *WriteConfig,
) error
```

###### `ChangesCursor*ChangesCursorInit`

× 2 ChangesCursorInit opens a feed of collection's changes committed after since, reading nothing yet and blocking whatever receiver it is called on; every pull names its own executor through On.

[db.go:1831 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1831)

Inherited from `DatabaseOn`

```go
func (on Database) ChangesCursorChangesCursorInit(
    collection CollectionID,
    since CommitStamp,
) (*ChangesCursor, error)
```

###### `*Clear`

× 2 Clear empties every collection at once, as mode says, answering [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended) for a drop of the collections as [DatabaseOn.CollectionDrop](#CollectionDrop) does.

[db.go:1134 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1134)

Inherited from `DatabaseOn`

```go
func (on Database) Clear(mode DropMode) error
```

###### `Collection*CollectionCreate`

× 2 CollectionCreate creates a collection under name holding modality; a name starting with an underscore is refused, as the engines keep their own collections there.

[db.go:1380 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1380)

Inherited from `DatabaseOn`

```go
func (on Database) CollectionCollectionCreate(
    name string,
    modality Modality,
) (CollectionID, error)
```

###### `Collection*CollectionDrop`

× 2 CollectionDrop empties a collection of its pairs or values, or drops it whole, as mode says.

[db.go:1413 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1413)

Inherited from `DatabaseOn`

```go
func (on Database) CollectionCollectionDrop(
    collection CollectionID,
    mode DropMode,
) error
```

A whole drop answers [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended) while a snapshot is open, or on NVMe while a snapshot or a transaction is open.

###### `*Compact`

× 2 Compact reclaims the space that overwritten and removed data still takes, through the phases its engine runs.

[db.go:1182 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1182)

Inherited from `DatabaseOn`

```go
func (on Database) Compact(config *CompactConfig) error
```

###### `CompactPlan*CompactPlanFinish`

× 2 CompactPlanFinish frees a plan whatever the call answers, so another compaction may open on the database, leaving the plan fresh.

[db.go:1221 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1221)

Inherited from `DatabaseOn`

```go
func (on Database) CompactPlanCompactPlanFinish(plan *CompactPlan) error
```

###### `*Deferred`

× 4 Deferred is the receiver whose verbs submit their calls to executor.

[db.go:688 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L688)

Inherited from `DatabaseOn`

```go
func (on Database) Deferred(executor *Executor) DatabaseDeferredOn
```

###### `*Describe`

× 2 Describe reports the engine's capabilities, isolation, CPU class and the sizes it estimates.

[db.go:1104 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1104)

Inherited from `DatabaseOn`

```go
func (on Database) Describe() (DatabaseDescription, error)
```

###### `Docs*DocsRemove`

× 4 DocsRemove removes whole documents, or every document of a range per task given end keys.

[db.go:187 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L187)

Inherited from `writes[Handle]`

```go
func (on Database) DocsDocsRemove(
    collections Collections,
    keys []Key,
    config *RemoveConfig,
) error
```

###### `Docs*DocsWrite`

× 4 DocsWrite writes one document or field per value, keyed by keys or, without them, by the [DocsWriteConfig](https://www.unum.cloud/docs/ustore/go/documents.md#DocsWriteConfig) IDField of every document.

[db.go:142 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L142)

Inherited from `writes[Handle]`

```go
func (on Database) DocsDocsWrite(
    collections Collections,
    keys []Key,
    values Tape,
    config *DocsWriteConfig,
) error
```

###### `*Flush`

× 2 Flush makes every buffered write durable.

[db.go:1255 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1255)

Inherited from `DatabaseOn`

```go
func (on Database) Flush() error
```

###### `GraphRemove*GraphRemoveEdges`

× 4 GraphRemoveEdges removes edges, keeping their vertices.

[db.go:254 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L254)

Inherited from `writes[Handle]`

```go
func (on Database) GraphRemoveGraphRemoveEdges(
    collections Collections,
    edges []Edge,
    config *WriteConfig,
) error
```

###### `GraphRemove*GraphRemoveVertices`

× 4 GraphRemoveVertices removes vertices with every edge they connect to, or every vertex of a range per task given end vertices.

[db.go:351 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L351)

Inherited from `writes[Handle]`

```go
func (on Database) GraphRemoveGraphRemoveVertices(
    collections Collections,
    vertices []Key,
    config *GraphRemoveVerticesConfig,
) error
```

###### `GraphWrite*GraphWriteEdges`

× 4 GraphWriteEdges inserts edges, and their vertices where missing.

[db.go:212 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L212)

Inherited from `writes[Handle]`

```go
func (on Database) GraphWriteGraphWriteEdges(
    collections Collections,
    edges []Edge,
    config *WriteConfig,
) error
```

###### `GraphWrite*GraphWriteVertices`

× 4 GraphWriteVertices inserts vertices unless present.

[db.go:300 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L300)

Inherited from `writes[Handle]`

```go
func (on Database) GraphWriteGraphWriteVertices(
    collections Collections,
    vertices []Key,
    config *WriteConfig,
) error
```

###### `Ingest*IngestInit`

× 2 IngestInit opens an ingest into collection, whose rows arrive in order, blocking on the receiver's executor, whose memory domain holds the ingest.

[db.go:1985 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1985)

Inherited from `DatabaseOn`

```go
func (on Database) IngestIngestInit(
    collection CollectionID,
    order IngestOrder,
) (*Ingest, error)
```

###### `*On`

× 4 On is the receiver whose verbs block on executor.

[db.go:682 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L682)

Inherited from `DatabaseOn`

```go
func (on Database) On(executor *Executor) DatabaseOn
```

###### `Pages*PagesImport`

× 4 PagesImport replaces whole pages, one per key, with parsed markup.

[db.go:84 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L84)

Inherited from `writes[Handle]`

```go
func (on Database) PagesPagesImport(
    collections Collections,
    keys []Key,
    values Tape,
    config *PagesImportConfig,
) error
```

###### `Pages*PagesInsert`

× 4 PagesInsert parses one fragment per task into elements of the page keys names, reporting the key every element ended up with into arena.

[db.go:161 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L161)

Inherited from `writes[Handle]`

```go
func (on Database) PagesPagesInsert(
    collections Collections,
    keys []Key,
    values Tape,
    arena *Arena,
    config *PagesInsertConfig,
) (Inserted, error)
```

###### `Pages*PagesMove`

× 4 PagesMove moves elements with their subtrees under parents after anchors.

[db.go:273 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L273)

Inherited from `writes[Handle]`

```go
func (on Database) PagesPagesMove(
    collections Collections,
    keys, elements []Key,
    config *PagesMoveConfig,
) error
```

###### `Pages*PagesRemove`

× 4 PagesRemove removes elements with their subtrees, or whole pages of a range per task given end keys.

[db.go:220 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L220)

Inherited from `writes[Handle]`

```go
func (on Database) PagesPagesRemove(
    collections Collections,
    keys []Key,
    config *PagesRemoveConfig,
) error
```

###### `PagesRemove*PagesRemoveAttributes`

× 4 PagesRemoveAttributes removes one attribute of an element per task.

[db.go:401 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L401)

Inherited from `writes[Handle]`

```go
func (on Database) PagesRemovePagesRemoveAttributes(
    collections Collections,
    keys, elements []Key,
    fields Tape,
    config *WriteConfig,
) error
```

###### `PagesSet*PagesSetAttributes`

× 4 PagesSetAttributes sets one attribute of an element per task.

[db.go:359 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L359)

Inherited from `writes[Handle]`

```go
func (on Database) PagesSetPagesSetAttributes(
    collections Collections,
    keys, elements []Key,
    fields, values Tape,
    config *WriteConfig,
) error
```

###### `Pages*PagesSplice`

× 4 PagesSplice replaces textLengths bytes of the text of every element from textStarts with values, where a zero length only inserts and an empty value only removes.

[db.go:316 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L316)

Inherited from `writes[Handle]`

```go
func (on Database) PagesPagesSplice(
    collections Collections,
    keys, elements []Key,
    textStarts, textLengths []uint64,
    values Tape,
    config *WriteConfig,
) error
```

###### `Snapshot*SnapshotInit`

× 2 SnapshotInit pins the head as it stands, blocking whatever receiver it is called on.

[db.go:1302 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1302)

Inherited from `DatabaseOn`

```go
func (on Database) SnapshotSnapshotInit() (*Snapshot, error)
```

###### `Strings*StringsRemove`

× 4 StringsRemove removes strings with the keys they map onto, or every string of a range per task given end strings.

[db.go:84 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L84)

Inherited from `writes[Handle]`

```go
func (on Database) StringsStringsRemove(
    collections Collections,
    strings Tape,
    config *StringsRemoveConfig,
) error
```

###### `Strings*StringsWrite`

× 4 StringsWrite maps every string onto one key, its value.

[db.go:33 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L33)

Inherited from `writes[Handle]`

```go
func (on Database) StringsStringsWrite(
    collections Collections,
    strings Tape,
    values []Key,
    config *WriteConfig,
) error
```

###### `Transaction*TransactionInit`

× 2 TransactionInit begins a transaction on the head, blocking whatever receiver it is called on.

[db.go:1587 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1587)

Inherited from `DatabaseOn`

```go
func (on Database) TransactionTransactionInit() (*Transaction, error)
```

##### Struct `DatabaseOn`

DatabaseOn is the receiver whose verbs block until their call is final, reading and writing the head: on the calling goroutine when embedded in a [Database](#Database), and on an executor when [DatabaseOn.On](#On) makes it.

[db.go:668 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L668)

```go
type DatabaseOn struct {
    // contains filtered or unexported fields
}
```

##### Struct `Deferred`

Deferred is a submitted call, which holds its outcome and inputs until it is final, owned by the one goroutine that polls or waits on it.3

[types.go:1123 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L1123)

```go
type Deferred[Result any] struct {
    // contains filtered or unexported fields
}
```

Status polls without blocking, Wait blocks until the call is final and hands back its result, and Close waits the same way and drops it. A Deferred dropped without Wait or Close is released by the collector once the call is final, never blocking on it: until then every later collection checks it again.

###### `Close`

Close blocks until the call is final, releases its pins, and reports the call's failure.

[types.go:1160 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L1160)

```go
func (deferred *Deferred[Result]) Close() error
```

It is idempotent and safe after Wait.

###### `Status`

Status reports StatusDeferred until the call is final, then its final status, without blocking.

[types.go:1149 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L1149)

```go
func (deferred *Deferred[Result]) Status() Status
```

###### `Wait`

Wait blocks until the call is final, releases its pins, then hands back its result, the same every time it is asked.

[types.go:1153 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L1153)

```go
func (deferred *Deferred[Result]) Wait() (Result, error)
```

##### Struct `DocsCursor`

DocsCursor walks the documents of one collection in batches of rows, every pull resuming past the last key the pull before it handed out.1

[docs.go:566 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L566)

```go
type DocsCursor struct {
    DocsCursorOn
    // contains filtered or unexported fields
}
```

###### `*Next`

× 2 Next pulls batches of up to wanted rows in all into arena, each row a key and a cell of every column the cursor gathers.

[docs.go:661 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L661)

Inherited from `DocsCursorOn`

```go
func (on DocsCursor) Next(
    wanted uint,
    arena *Arena,
) (DocsBatches, error)
```

##### Struct `DocsCursorOn`

DocsCursorOn is the receiver whose pulls block until their call is final: on the calling goroutine when embedded in a [DocsCursor](#DocsCursor), and on an executor when [DocsCursorOn.On](#On) makes it.

[docs.go:574 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L574)

```go
type DocsCursorOn struct {
    // contains filtered or unexported fields
}
```

##### Struct `Executor`

Executor owns the host threads, I/O rings or device stream calls run on, shared by any number of databases.5

[types.go:681 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L681)

```go
type Executor struct {
    // contains filtered or unexported fields
}
```

A nil \*Executor is the null executor: it owns nothing, and every call handed it runs on the calling goroutine. An executor serves one call at a time, while databases stay freely concurrent; a second call finding it held finishes [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended), and nothing queues.

###### `ExecutorForNvme`

ExecutorForNvme spawns threads for the NVMe engine, each submitting and polling its own I/O ring, placed with their staging on memoryDomains, the first placing the threads, or on the domain nvme.Paths share for an empty list.

[types.go:730 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L730)

```go
func ExecutorForNvme(
    memoryDomains []int32,
    nvme NvmeOptions,
    threads uint,
    cpuClassCeiling CPUClass,
    scratchLimit uint64,
) (*Executor, error)
```

Zero threads takes the fewest hardware queues of the disks under the paths, capped by the cores, and a zero scratchLimit takes 16 GiB per thread.

###### `ExecutorForRam`

ExecutorForRam spawns host threads for the RAM, RocksDB and LevelDB engines, interleaved across the compute domains local to memoryDomains, every domain the process may allocate on for an empty list.

[types.go:690 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L690)

```go
func ExecutorForRam(
    memoryDomains []int32,
    threads uint,
    cpuClassCeiling CPUClass,
    scratchLimit uint64,
) (*Executor, error)
```

Zero threads takes seven eighths of the cores those domains carry, and a cpuClassCeiling the CPU lacks narrows the pick rather than refusing it. Every call's staging carves from each thread's scratch, capped at scratchLimit, where zero takes 16 GiB.

###### `ExecutorForVram`

ExecutorForVram opens one non-blocking stream on every named device, its position in the listing of [GPUDevices](#GPUDevices), all of one vendor, created with the executor and destroyed when it closes, all of them driven by the one goroutine that calls the verbs, so that a deferred call on it is final once it returns.

[types.go:771 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L771)

```go
func ExecutorForVram(
    devices []int32,
    gpuClassCeiling GPUClass,
    streams []unsafe.Pointer,
    scratchLimit uint64,
    gds Gds,
) (*Executor, error)
```

Empty devices take every listed device of the first vendor with a known class. Arenas live on the first device, where every call computes but a filtered scan, which deals its pages across every device.

Streams are empty, or one per device in devices order, a cudaStream_t, hipStream_t or id\<MTLCommandQueue> on that device, which the executor adopts: on success a CUDA or HIP stream becomes the executor's, which synchronizes and destroys it when it closes, while a Metal queue is retained, the executor releasing its own reference and the caller keeping theirs; on failure every stream stays the caller's. A nil or default stream, a device named twice beside streams, or streams beside empty devices answer [StatusInvalidArgument](https://www.unum.cloud/docs/ustore/go/errors.md#StatusInvalidArgument), and a stream on another device than its entry names answers [StatusConfigMismatch](https://www.unum.cloud/docs/ustore/go/errors.md#StatusConfigMismatch). Zero scratchLimit lets each device's scratch grow, gds is how reads and compactions move bytes between the drives and the devices, and a gpuClassCeiling some named device loads nothing under answers [StatusUnsupported](https://www.unum.cloud/docs/ustore/go/errors.md#StatusUnsupported).

###### `Close`

Close waits out the call holding the executor, then releases its threads, rings or streams; every arena it made must be closed first, or it fails with [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended) and frees nothing, so a later Close retries.

[types.go:1210 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L1210)

```go
func (executor *Executor) Close() error
```

It is idempotent; a closed executor must not be used again.

###### `Drain`

Drain waits until no call holds the executor, then adopts mood until its next call; it only waits and never runs a call itself.

[types.go:803 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L803)

```go
func (executor *Executor) Drain(mood Mood) error
```

A failure is the executor's own, never one of a drained call.

##### Enum `GPUClass`

GPUClass is a GPU generation UStore tells apart; a class implies its vendor, and the zero value sets no ceiling.2

[types.go:416 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L416)

```go
type GPUClass int32
```

##### Values

| `GPUClassUnknown` | | GPUClassUnknown is no class. |
| - | - | - |
| `GPUClassNVIDIAAmpere` | | GPUClassNVIDIAAmpere is Ampere-class NVIDIA, and every later GPU that compiles its PTX. |
| `GPUClassNVIDIAAda` | | GPUClassNVIDIAAda is Ada-class NVIDIA. |
| `GPUClassNVIDIAHopper` | | GPUClassNVIDIAHopper is Hopper-class NVIDIA. |
| `GPUClassNVIDIABlackwell` | | GPUClassNVIDIABlackwell is Blackwell-class NVIDIA. |
| `GPUClassNVIDIABlackwellRTX` | | GPUClassNVIDIABlackwellRTX is consumer Blackwell NVIDIA. |
| `GPUClassAMDCDNA3` | | GPUClassAMDCDNA3 is CDNA3 AMD, gfx942. |
| `GPUClassAMDCDNA4` | | GPUClassAMDCDNA4 is CDNA4 AMD, gfx950. |
| `GPUClassAMDCDNA5` | | GPUClassAMDCDNA5 is CDNA5 AMD, gfx1250. |
| `GPUClassAppleMetal7` | | GPUClassAppleMetal7 is Apple7-family GPUs, and every Apple GPU without a class of its own. |
| `GPUClassAppleMetal9` | | GPUClassAppleMetal9 is Apple9-family GPUs. |
| `GPUClassAppleMetal10` | | GPUClassAppleMetal10 is Apple10-family GPUs. |

###### `GPUClassFromName`

GPUClassFromName reads a GPU class back from the spelling [GPUClass.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:451 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L451)

```go
func GPUClassFromName(name string) (GPUClass, error)
```

###### `String`

String renders the class as the library spells it, such as "amd-cdna3".

[types.go:446 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L446)

```go
func (class GPUClass) String() string
```

##### Struct `GPUDevice`

GPUDevice is one GPU as UStore numbers it: its position in [GPUDevices](#GPUDevices) is the ordinal [ExecutorForVram](#ExecutorForVram) names it by.1

[types.go:822 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L822)

```go
type GPUDevice struct {
    Vendor GPUVendor
    VendorOrdinal uint32
    GPUClass GPUClass
    ComputeUnits uint32
    MemoryBytes uint64
    Name string
}
```

##### Fields

| `Vendor` | `GPUVendor` | Vendor is the vendor whose runtime drives the device. |
| - | - | - |
| `VendorOrdinal` | `uint32` | VendorOrdinal is the device's ordinal in its vendor's runtime. |
| `GPUClass` | `GPUClass` | GPUClass is the newest class this build compiled code for that runs on the device. |
| `ComputeUnits` | `uint32` | ComputeUnits counts streaming multiprocessors, compute units or GPU cores. |
| `MemoryBytes` | `uint64` | MemoryBytes is the device memory, or the working set Metal recommends for unified memory. |
| `Name` | `string` | Name is the vendor's own name for the device. |

###### `GPUDevices`

GPUDevices lists every GPU this process can drive, NVIDIA devices first, then AMD, then Apple, and nothing on a machine without GPUs.

[types.go:839 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L839)

```go
func GPUDevices() ([]GPUDevice, error)
```

##### Enum `GPUVendor`

GPUVendor is a GPU vendor one binary drives, each through a runtime opened on first use.1

[types.go:396 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L396)

```go
type GPUVendor int32
```

##### Values

| `GPUVendorUnknown` | | GPUVendorUnknown names no vendor. |
| - | - | - |
| `GPUVendorNVIDIA` | | GPUVendorNVIDIA drives NVIDIA devices through the CUDA driver. |
| `GPUVendorAMD` | | GPUVendorAMD drives AMD devices through the HIP runtime. |
| `GPUVendorApple` | | GPUVendorApple drives Apple devices through Metal. |

###### `String`

String renders the vendor as the library spells it.

[types.go:410 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L410)

```go
func (vendor GPUVendor) String() string
```

##### Enum `Gds`

Gds is how a VRAM executor moves bytes through GPUDirect Storage, between the drives and its device.2

[types.go:373 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L373)

```go
type Gds int32
```

##### Values

| `GdsAutomatic` | | GdsAutomatic transfers directly where the driver is loaded, and through cuFile's compatibility mode elsewhere. |
| - | - | - |
| `GdsDirect` | | GdsDirect transfers directly, refused with [StatusDevice](https://www.unum.cloud/docs/ustore/go/errors.md#StatusDevice) where the driver is absent. |
| `GdsCompatibility` | | GdsCompatibility bounces through host pages cuFile manages. |

###### `GdsFromName`

GdsFromName reads a GPUDirect Storage mode back from the spelling [Gds.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:389 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L389)

```go
func GdsFromName(name string) (Gds, error)
```

###### `String`

String renders the mode as the library spells it.

[types.go:386 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L386)

```go
func (gds Gds) String() string
```

##### Struct `GraphVerticesCursor`

GraphVerticesCursor walks the vertices of one graph collection page by page, every pull resuming past the last vertex the pull before it handed out.1

[graph.go:479 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L479)

```go
type GraphVerticesCursor struct {
    GraphVerticesCursorOn
    // contains filtered or unexported fields
}
```

###### `Next*NextKeys`

× 2 NextKeys pulls up to wanted vertices of the walk into arena.

[graph.go:532 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L532)

Inherited from `GraphVerticesCursorOn`

```go
func (on GraphVerticesCursor) NextNextKeys(
    wanted uint,
    arena *Arena,
) (Page, error)
```

##### Struct `GraphVerticesCursorOn`

GraphVerticesCursorOn is the receiver whose pulls block until their call is final: on the calling goroutine when embedded in a [GraphVerticesCursor](#GraphVerticesCursor), or on an executor when [GraphVerticesCursorOn.On](#On) makes it.

[graph.go:488 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L488)

```go
type GraphVerticesCursorOn struct {
    // contains filtered or unexported fields
}
```

##### Enum `HostAccess`

HostAccess is whether Go code may read an arena's outputs, which every verb checks before it views them as Go slices.1

[types.go:472 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L472)

```go
type HostAccess int32
```

##### Values

| `HostAccessRefused` | | HostAccessRefused is memory host code must not read. |
| - | - | - |
| `HostAccessReadable` | | HostAccessReadable is host, pinned, managed and Apple's shared memory, read in place. |

###### `String`

String renders the host access as the library spells it.

[types.go:482 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L482)

```go
func (access HostAccess) String() string
```

##### Struct `Ingest`

Ingest lands every row appended to it into one collection as one commit of its own, joining no transaction; its calls run one at a time, on the calling goroutine, or on an executor through [IngestOn.On](#On).4

[db.go:1966 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1966)

```go
type Ingest struct {
    IngestOn
    // contains filtered or unexported fields
}
```

###### `Close`

Close frees the ingest, dropping every row of an unfinished one.

[db.go:2080 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L2080)

```go
func (ingest *Ingest) Close() error
```

It is idempotent.

###### `*Append`

× 2 Append hands the ingest one batch of rows, copied or written before it returns, parsing values over the executor's threads.

[db.go:2030 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L2030)

Inherited from `IngestOn`

```go
func (on Ingest) Append(rows IngestRows) error
```

###### `*Finish`

× 2 Finish lands every row appended as one commit and ends the ingest, answering the one stamp every row landed at.

[db.go:2060 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L2060)

Inherited from `IngestOn`

```go
func (on Ingest) Finish(
    durability Durability,
) (CommitStamp, error)
```

###### `*On`

× 2 On is the receiver whose calls block on executor.

[db.go:1978 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1978)

Inherited from `IngestOn`

```go
func (on Ingest) On(executor *Executor) IngestOn
```

##### Struct `IngestOn`

IngestOn is the receiver whose appends and finish block until their call is final: on the calling goroutine when embedded in an [Ingest](#Ingest), and on an executor when [IngestOn.On](#On) makes it.

[db.go:1973 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1973)

```go
type IngestOn struct {
    // contains filtered or unexported fields
}
```

##### Enum `Mood`

Mood is what an executor's threads do between a drain and its next call.2

[types.go:280 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L280)

```go
type Mood int32
```

##### Values

| `MoodParked` | | MoodParked sleeps in the kernel until the next call, freeing the cores. |
| - | - | - |
| `MoodSpinning` | | MoodSpinning keeps polling, trading the cores for the lowest wake-up latency. |

###### `MoodFromName`

MoodFromName reads a mood back from the spelling [Mood.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:293 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L293)

```go
func MoodFromName(name string) (Mood, error)
```

###### `String`

String renders the mood as the library spells it.

[types.go:290 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L290)

```go
func (mood Mood) String() string
```

##### Struct `PagesCursor`

PagesCursor walks the pages of one collection page by page, every pull resuming past the last key the pull before it handed out.2

[pages.go:590 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L590)

```go
type PagesCursor struct {
    PagesCursorOn
    // contains filtered or unexported fields
}
```

###### `Next*NextKeys`

× 2 NextKeys pulls up to wanted page keys of the walk into arena.

[pages.go:643 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L643)

Inherited from `PagesCursorOn`

```go
func (on PagesCursor) NextNextKeys(
    wanted uint,
    arena *Arena,
) (Page, error)
```

###### `Next*NextPairs`

× 2 NextPairs pulls up to wanted page keys of the walk with their pages rendered as outputsEncoding into arena.

[pages.go:655 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L655)

Inherited from `PagesCursorOn`

```go
func (on PagesCursor) NextNextPairs(
    wanted uint,
    outputsEncoding PageEncoding,
    arena *Arena,
) (Page, error)
```

##### Struct `PagesCursorOn`

PagesCursorOn is the receiver whose pulls block until their call is final: on the calling goroutine when embedded in a [PagesCursor](#PagesCursor), and on an executor when [PagesCursorOn.On](#On) makes it.

[pages.go:598 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L598)

```go
type PagesCursorOn struct {
    // contains filtered or unexported fields
}
```

##### Struct `Snapshot`

Snapshot pins the state it was taken at until [Snapshot.Close](#Close), and its own verbs read that state on the calling goroutine; nothing writes through it.32

[db.go:1289 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1289)

```go
type Snapshot struct {
    SnapshotOn
    // contains filtered or unexported fields
}
```

###### `Close`

Close releases the snapshot once every deferred call naming it is final, unpinning the versions only it kept.

[db.go:1331 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1331)

```go
func (snapshot *Snapshot) Close() error
```

It is idempotent.

###### `ReadStamp`

ReadStamp reports the stamp the snapshot reads at, which every commit at or below it shows.

[db.go:1327 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1327)

```go
func (snapshot *Snapshot) ReadStamp() ReadStamp
```

###### `BlobsCursor*BlobsCursorInit`

× 2 BlobsCursorInit opens a walk over collection from startKey, reading nothing until its first pull and blocking whatever receiver it is called on; every pull names its own executor through On.

[db.go:417 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L417)

Inherited from `reads[Handle]`

```go
func (on Snapshot) BlobsCursorBlobsCursorInit(
    collection CollectionID,
    startKey Key,
    config *BlobsCursorConfig,
) (*BlobsCursor, error)
```

###### `Blobs*BlobsMeasure`

× 2 BlobsMeasure estimates the entries and the space inside a range per task into arena, one task per collection collections names, without walking them.

[db.go:552 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L552)

Inherited from `reads[Handle]`

```go
func (on Snapshot) BlobsBlobsMeasure(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (Measurement, error)
```

###### `Blobs*BlobsRead`

× 2 BlobsRead reads one value per key into arena, a missing key reading as absent.

[db.go:255 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L255)

Inherited from `reads[Handle]`

```go
func (on Snapshot) BlobsBlobsRead(
    collections Collections,
    keys []Key,
    arena *Arena,
    config *BlobsReadConfig,
) (Values, error)
```

###### `Blobs*BlobsSample`

× 2 BlobsSample draws up to wanted keys uniformly at random into arena, one task per collection collections names.

[db.go:513 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L513)

Inherited from `reads[Handle]`

```go
func (on Snapshot) BlobsBlobsSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (Scanned, error)
```

###### `Blobs*BlobsScan`

× 2 BlobsScan lists up to wanted keys of a range per task into arena, one task per collection collections names.

[db.go:322 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L322)

Inherited from `reads[Handle]`

```go
func (on Snapshot) BlobsBlobsScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *BlobsScanConfig,
) (Scanned, error)
```

###### `Collection*CollectionFind`

× 2 CollectionFind resolves a batch of names into the collections they address, into arena.

[db.go:1537 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1537)

Inherited from `reads[Handle]`

```go
func (on Snapshot) CollectionCollectionFind(
    names Tape,
    arena *Arena,
) (FoundCollections, error)
```

###### `Collection*CollectionList`

× 2 CollectionList lists every collection the receiver sees, with its modality and name, into arena.

[db.go:1478 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1478)

Inherited from `reads[Handle]`

```go
func (on Snapshot) CollectionCollectionList(
    arena *Arena,
) (CollectionList, error)
```

###### `DocsCursor*DocsCursorInit`

× 2 DocsCursorInit opens a walk over collection from startKey, reading nothing until its first pull and blocking whatever receiver it is called on.

[db.go:587 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L587)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsCursorDocsCursorInit(
    collection CollectionID,
    startKey Key,
    config *DocsCursorConfig,
) (*DocsCursor, error)
```

###### `Docs*DocsGather`

× 2 DocsGather reads, type-checks and converts one column per field of the documents keys name into arena, converting field i into outputsTypes\[i].

[db.go:424 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L424)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsDocsGather(
    collections Collections,
    keys []Key,
    fields Tape,
    outputsTypes []DocsFieldType,
    arena *Arena,
) (Columns, error)
```

###### `Docs*DocsGist`

× 2 DocsGist lists the unique paths to the leaves of the documents keys name into arena.

[db.go:301 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L301)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsDocsGist(
    collections Collections,
    keys []Key,
    arena *Arena,
) (Paths, error)
```

###### `Docs*DocsMeasure`

× 2 DocsMeasure estimates the documents and the space inside a range per task into arena, one task per collection collections names.

[db.go:740 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L740)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsDocsMeasure(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (Measurement, error)
```

###### `Docs*DocsRead`

× 2 DocsRead reads whole documents or fields inside them into arena, a missing one reading as absent.

[db.go:240 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L240)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsDocsRead(
    collections Collections,
    keys []Key,
    arena *Arena,
    config *DocsReadConfig,
) (Values, error)
```

###### `Docs*DocsSample`

× 2 DocsSample draws up to wanted document keys uniformly at random into arena, one task per collection collections names.

[db.go:701 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L701)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsDocsSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (Scanned, error)
```

###### `Docs*DocsScan`

× 2 DocsScan lists up to wanted document keys of a range per task into arena, one task per collection collections names.

[db.go:493 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L493)

Inherited from `reads[Handle]`

```go
func (on Snapshot) DocsDocsScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *DocsScanConfig,
) (Scanned, error)
```

###### `GraphMeasure*GraphMeasureVertices`

× 2 GraphMeasureVertices estimates the vertices and the space inside a range per task into arena, one task per collection collections names.

[db.go:609 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L609)

Inherited from `reads[Handle]`

```go
func (on Snapshot) GraphMeasureGraphMeasureVertices(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (Measurement, error)
```

###### `GraphRead*GraphReadEdges`

× 2 GraphReadEdges reads the degree and the edges of every vertex in its roles into arena.

[db.go:170 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L170)

Inherited from `reads[Handle]`

```go
func (on Snapshot) GraphReadGraphReadEdges(
    collections Collections,
    vertices []Key,
    roles Roles,
    arena *Arena,
) (Neighborhoods, error)
```

###### `GraphSample*GraphSampleVertices`

× 2 GraphSampleVertices draws up to wanted vertices uniformly at random into arena, one task per collection collections names.

[db.go:570 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L570)

Inherited from `reads[Handle]`

```go
func (on Snapshot) GraphSampleGraphSampleVertices(
    collections Collections,
    wanted uint,
    arena *Arena,
) (Scanned, error)
```

###### `GraphScan*GraphScanVertices`

× 2 GraphScanVertices lists up to wanted vertices of a range per task into arena, one task per collection collections names.

[db.go:414 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L414)

Inherited from `reads[Handle]`

```go
func (on Snapshot) GraphScanGraphScanVertices(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *GraphScanConfig,
) (Scanned, error)
```

###### `GraphVerticesCursor*GraphVerticesCursorInit`

× 2 GraphVerticesCursorInit opens a walk over the vertices of collection from startKey, reading nothing until its first pull and blocking whatever receiver it is called on.

[db.go:500 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L500)

Inherited from `reads[Handle]`

```go
func (on Snapshot) GraphVerticesCursorGraphVerticesCursorInit(
    collection CollectionID,
    startKey Key,
    config *GraphVerticesCursorConfig,
) (*GraphVerticesCursor, error)
```

###### `PagesCursor*PagesCursorInit`

× 2 PagesCursorInit opens a walk over collection from startKey, reading nothing until its first pull and blocking whatever receiver it is called on.

[db.go:610 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L610)

Inherited from `reads[Handle]`

```go
func (on Snapshot) PagesCursorPagesCursorInit(
    collection CollectionID,
    startKey Key,
    config *PagesCursorConfig,
) (*PagesCursor, error)
```

###### `Pages*PagesMeasure`

× 2 PagesMeasure estimates the pages and the space inside a range per task into arena, one task per collection collections names.

[db.go:744 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L744)

Inherited from `reads[Handle]`

```go
func (on Snapshot) PagesPagesMeasure(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (Measurement, error)
```

###### `Pages*PagesRead`

× 2 PagesRead renders whole pages or subtrees into arena, a missing one reading as absent.

[db.go:455 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L455)

Inherited from `reads[Handle]`

```go
func (on Snapshot) PagesPagesRead(
    collections Collections,
    keys []Key,
    arena *Arena,
    config *PagesReadConfig,
) (Values, error)
```

###### `Pages*PagesSample`

× 2 PagesSample draws up to wanted page keys uniformly at random into arena, one task per collection collections names.

[db.go:705 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L705)

Inherited from `reads[Handle]`

```go
func (on Snapshot) PagesPagesSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (Scanned, error)
```

###### `Pages*PagesScan`

× 2 PagesScan lists up to wanted page keys of a range per task into arena, one task per collection collections names.

[db.go:522 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L522)

Inherited from `reads[Handle]`

```go
func (on Snapshot) PagesPagesScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *PagesScanConfig,
) (Scanned, error)
```

###### `*Save`

× 2 Save writes the snapshot out as a new database of the same engine at path, holding exactly the collections and names it records; a cancelled save removes what it wrote.

[db.go:1342 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1342)

Inherited from `SnapshotOn`

```go
func (on Snapshot) Save(
    path string,
    progress ProgressCallback,
) error
```

###### `StringsCursor*StringsCursorInit`

× 2 StringsCursorInit opens a walk over collection, copying its prefix and bounds, reading nothing until its first pull and blocking whatever receiver it is called on.

[db.go:358 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L358)

Inherited from `reads[Handle]`

```go
func (on Snapshot) StringsCursorStringsCursorInit(
    collection CollectionID,
    config *StringsCursorConfig,
) (*StringsCursor, error)
```

###### `Strings*StringsMeasure`

× 2 StringsMeasure estimates the entries and the space inside a range of strings per task into arena, one task per collection collections names.

[db.go:532 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L532)

Inherited from `reads[Handle]`

```go
func (on Snapshot) StringsStringsMeasure(
    collections Collections,
    arena *Arena,
    config *StringsMeasureConfig,
) (Measurement, error)
```

###### `Strings*StringsRead`

× 2 StringsRead looks up the key every string maps onto into arena.

[db.go:151 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L151)

Inherited from `reads[Handle]`

```go
func (on Snapshot) StringsStringsRead(
    collections Collections,
    strings Tape,
    arena *Arena,
) (Mapped, error)
```

###### `Strings*StringsSample`

× 2 StringsSample draws up to wanted strings uniformly at random into arena, one task per collection collections names.

[db.go:482 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L482)

Inherited from `reads[Handle]`

```go
func (on Snapshot) StringsStringsSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (Listing, error)
```

###### `Strings*StringsScan`

× 2 StringsScan lists up to wanted strings per task into arena, one task per collection collections names.

[db.go:257 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L257)

Inherited from `reads[Handle]`

```go
func (on Snapshot) StringsStringsScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *StringsScanConfig,
) (Listing, error)
```

##### Struct `SnapshotDeferredOn`

SnapshotDeferredOn is the receiver whose verbs submit their calls to an executor, offering the verbs of [SnapshotOn](#SnapshotOn) with the same arguments.25

[db.go:725 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L725)

```go
type SnapshotDeferredOn struct {
    // contains filtered or unexported fields
}
```

###### `Save`

Save submits [SnapshotOn.Save](#Save).

[db.go:1349 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1349)

```go
func (on SnapshotDeferredOn) Save(
    path string,
    progress ProgressCallback,
) (*Deferred[struct{}], error)
```

###### `BlobsMeasure`

BlobsMeasure submits [DatabaseOn.BlobsMeasure](#BlobsMeasure).

[db.go:558 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L558)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) BlobsMeasure(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (*Deferred[Measurement], error)
```

###### `BlobsRead`

BlobsRead submits [DatabaseOn.BlobsRead](#BlobsRead).

[db.go:261 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L261)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) BlobsRead(
    collections Collections,
    keys []Key,
    arena *Arena,
    config *BlobsReadConfig,
) (*Deferred[Values], error)
```

###### `BlobsSample`

BlobsSample submits [DatabaseOn.BlobsSample](#BlobsSample).

[db.go:519 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L519)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) BlobsSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (*Deferred[Scanned], error)
```

###### `BlobsScan`

BlobsScan submits [DatabaseOn.BlobsScan](#BlobsScan).

[db.go:328 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L328)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) BlobsScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *BlobsScanConfig,
) (*Deferred[Scanned], error)
```

###### `CollectionFind`

CollectionFind submits [DatabaseOn.CollectionFind](#CollectionFind).

[db.go:1543 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1543)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) CollectionFind(
    names Tape,
    arena *Arena,
) (*Deferred[FoundCollections], error)
```

###### `CollectionList`

CollectionList submits [DatabaseOn.CollectionList](#CollectionList).

[db.go:1484 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1484)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) CollectionList(
    arena *Arena,
) (*Deferred[CollectionList], error)
```

###### `DocsGather`

DocsGather submits [DatabaseOn.DocsGather](#DocsGather).

[db.go:430 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L430)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) DocsGather(
    collections Collections,
    keys []Key,
    fields Tape,
    outputsTypes []DocsFieldType,
    arena *Arena,
) (*Deferred[Columns], error)
```

###### `DocsGist`

DocsGist submits [DatabaseOn.DocsGist](#DocsGist).

[db.go:307 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L307)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) DocsGist(
    collections Collections,
    keys []Key,
    arena *Arena,
) (*Deferred[Paths], error)
```

###### `DocsMeasure`

DocsMeasure submits [DatabaseOn.DocsMeasure](#DocsMeasure).

[db.go:746 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L746)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) DocsMeasure(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (*Deferred[Measurement], error)
```

###### `DocsRead`

DocsRead submits [DatabaseOn.DocsRead](#DocsRead).

[db.go:246 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L246)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) DocsRead(
    collections Collections,
    keys []Key,
    arena *Arena,
    config *DocsReadConfig,
) (*Deferred[Values], error)
```

###### `DocsSample`

DocsSample submits [DatabaseOn.DocsSample](#DocsSample).

[db.go:707 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L707)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) DocsSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (*Deferred[Scanned], error)
```

###### `DocsScan`

DocsScan submits [DatabaseOn.DocsScan](#DocsScan).

[db.go:499 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L499)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) DocsScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *DocsScanConfig,
) (*Deferred[Scanned], error)
```

###### `GraphMeasureVertices`

GraphMeasureVertices submits [DatabaseOn.GraphMeasureVertices](#GraphMeasureVertices).

[db.go:615 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L615)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) GraphMeasureVertices(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (*Deferred[Measurement], error)
```

###### `GraphReadEdges`

GraphReadEdges submits [DatabaseOn.GraphReadEdges](#GraphReadEdges).

[db.go:176 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L176)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) GraphReadEdges(
    collections Collections,
    vertices []Key,
    roles Roles,
    arena *Arena,
) (*Deferred[Neighborhoods], error)
```

###### `GraphSampleVertices`

GraphSampleVertices submits [DatabaseOn.GraphSampleVertices](#GraphSampleVertices).

[db.go:576 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L576)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) GraphSampleVertices(
    collections Collections,
    wanted uint,
    arena *Arena,
) (*Deferred[Scanned], error)
```

###### `GraphScanVertices`

GraphScanVertices submits [DatabaseOn.GraphScanVertices](#GraphScanVertices).

[db.go:420 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L420)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) GraphScanVertices(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *GraphScanConfig,
) (*Deferred[Scanned], error)
```

###### `PagesMeasure`

PagesMeasure submits [DatabaseOn.PagesMeasure](#PagesMeasure).

[db.go:750 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L750)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) PagesMeasure(
    collections Collections,
    arena *Arena,
    config *MeasureConfig,
) (*Deferred[Measurement], error)
```

###### `PagesRead`

PagesRead submits [DatabaseOn.PagesRead](#PagesRead).

[db.go:461 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L461)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) PagesRead(
    collections Collections,
    keys []Key,
    arena *Arena,
    config *PagesReadConfig,
) (*Deferred[Values], error)
```

###### `PagesSample`

PagesSample submits [DatabaseOn.PagesSample](#PagesSample).

[db.go:711 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L711)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) PagesSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (*Deferred[Scanned], error)
```

###### `PagesScan`

PagesScan submits [DatabaseOn.PagesScan](#PagesScan).

[db.go:528 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L528)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) PagesScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *PagesScanConfig,
) (*Deferred[Scanned], error)
```

###### `StringsMeasure`

StringsMeasure submits [DatabaseOn.StringsMeasure](#StringsMeasure).

[db.go:538 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L538)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) StringsMeasure(
    collections Collections,
    arena *Arena,
    config *StringsMeasureConfig,
) (*Deferred[Measurement], error)
```

###### `StringsRead`

StringsRead submits [DatabaseOn.StringsRead](#StringsRead).

[db.go:157 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L157)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) StringsRead(
    collections Collections,
    strings Tape,
    arena *Arena,
) (*Deferred[Mapped], error)
```

###### `StringsSample`

StringsSample submits [DatabaseOn.StringsSample](#StringsSample).

[db.go:488 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L488)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) StringsSample(
    collections Collections,
    wanted uint,
    arena *Arena,
) (*Deferred[Listing], error)
```

###### `StringsScan`

StringsScan submits [DatabaseOn.StringsScan](#StringsScan).

[db.go:263 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L263)

Inherited from `deferredReads[Handle]`

```go
func (on SnapshotDeferredOn) StringsScan(
    collections Collections,
    wanted uint,
    arena *Arena,
    config *StringsScanConfig,
) (*Deferred[Listing], error)
```

##### Struct `SnapshotOn`

SnapshotOn is the receiver whose verbs block until their call is final, reading the state a snapshot pinned; nothing writes through it.

[db.go:719 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L719)

```go
type SnapshotOn struct {
    // contains filtered or unexported fields
}
```

##### Struct `StringsCursor`

StringsCursor walks the strings of one collection page by page, in the order of their text, every pull resuming past the last string the pull before it handed out.2

[strings.go:337 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L337)

```go
type StringsCursor struct {
    StringsCursorOn
    // contains filtered or unexported fields
}
```

###### `Next*NextPairs`

× 2 NextPairs pulls up to wanted strings of the walk with the keys they map onto into arena.

[strings.go:433 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L433)

Inherited from `StringsCursorOn`

```go
func (on StringsCursor) NextNextPairs(
    wanted uint,
    arena *Arena,
) (StringsPage, error)
```

###### `Next*NextStrings`

× 2 NextStrings pulls up to wanted strings of the walk into arena.

[strings.go:422 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L422)

Inherited from `StringsCursorOn`

```go
func (on StringsCursor) NextNextStrings(
    wanted uint,
    arena *Arena,
) (StringsPage, error)
```

##### Struct `StringsCursorOn`

StringsCursorOn is the receiver whose pulls block until their call is final: on the calling goroutine when embedded in a [StringsCursor](#StringsCursor), or on an executor that [StringsCursorOn.On](#On) picks.

[strings.go:346 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/strings.go#L346)

```go
type StringsCursorOn struct {
    // contains filtered or unexported fields
}
```

##### Struct `Transaction`

Transaction groups reads and writes across collections and modalities, and commits all of them or none.8

[db.go:1581 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1581)

```go
type Transaction struct {
    TransactionOn
    // contains filtered or unexported fields
}
```

Its own verbs run on the calling goroutine and watch the keys they touch, while [Transaction.View](#View) picks another watch. It serves one call at a time and holds its database open until [Transaction.Close](#Close).

###### `Close`

Close releases the transaction once every deferred call naming it is final, dropping whatever it did not commit.

[db.go:1620 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1620)

```go
func (transaction *Transaction) Close() error
```

It is idempotent.

###### `View`

View is the receiver whose reads and writes, on the calling goroutine, record their keys under watch.

[db.go:1612 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1612)

```go
func (transaction *Transaction) View(watch Watch) TransactionOn
```

###### `*Commit`

× 2 Commit lands every change of the transaction at once, or none of them with a conflict status, answering its position in commit order.

[db.go:1686 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1686)

Inherited from `TransactionOn`

```go
func (on Transaction) Commit(
    durability Durability,
) (CommitStamp, error)
```

###### `*Deferred`

× 2 Deferred is the receiver whose verbs submit their calls to executor, under the same watch.

[db.go:712 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L712)

Inherited from `TransactionOn`

```go
func (on Transaction) Deferred(
    executor *Executor,
) TransactionDeferredOn
```

###### `*On`

× 2 On is the receiver whose verbs block on executor, under the same watch.

[db.go:706 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L706)

Inherited from `TransactionOn`

```go
func (on Transaction) On(executor *Executor) TransactionOn
```

###### `*Reset`

× 2 Reset reopens the transaction on the newest state for another try, dropping its contents.

[db.go:1630 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1630)

Inherited from `TransactionOn`

```go
func (on Transaction) Reset() error
```

###### `*Rollback`

× 2 Rollback withdraws a stage while keeping the reads and writes, so that the transaction can stage again.

[db.go:1718 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1718)

Inherited from `TransactionOn`

```go
func (on Transaction) Rollback() error
```

###### `*Stage`

× 2 Stage validates the transaction and holds its keys, answering the stamp it reads at and its commit validates against.

[db.go:1655 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1655)

Inherited from `TransactionOn`

```go
func (on Transaction) Stage() (ReadStamp, error)
```

##### Struct `TransactionOn`

TransactionOn is the receiver whose verbs block until their call is final, reading and writing inside a transaction under one [Watch](https://www.unum.cloud/docs/ustore/go/transactions.md#Watch).

[db.go:695 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L695)

```go
type TransactionOn struct {
    // contains filtered or unexported fields
}
```

##### Enum `Transport`

Transport is how the NVMe engine moves bytes between its files and memory.2

[types.go:343 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L343)

```go
type Transport int32
```

##### Values

| `TransportAutomatic` | | TransportAutomatic takes io_uring where the kernel offers it, Linux AIO where it offers only that, and blocking calls elsewhere. |
| - | - | - |
| `TransportBlocking` | | TransportBlocking takes positioned reads and writes that block the polling thread. |
| `TransportLinuxUring` | | TransportLinuxUring takes io_uring on unbuffered files. |
| `TransportLinuxAIO` | | TransportLinuxAIO takes Linux AIO on unbuffered files. |
| `TransportLinuxSPDK` | | TransportLinuxSPDK takes SPDK's user-space driver on NVMe devices the process owns. |

###### `TransportFromName`

TransportFromName reads a transport back from the spelling [Transport.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:365 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L365)

```go
func TransportFromName(name string) (Transport, error)
```

###### `String`

String renders the transport as the library spells it.

[types.go:360 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L360)

```go
func (transport Transport) String() string
```

## Transactions

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

A transaction groups reads and writes across collections and modalities, and commits all of them or none. Its own verbs record the keys they touch, so the commit reports `StatusWriteConflict`, `StatusReadConflict` or `StatusPhantomConflict` if another writer changed them, while `Transaction.View` with `WatchNone` records nothing. A transaction conflicts rather than blocks, and keeps its contents whatever the outcome, so `Reset` reopens it on the newest state for another try. `Stage` answers a `ReadStamp`, the stamp the transaction reads at and its commit validates against, and `Commit` a `CommitStamp`, its position in commit order; the two are distinct types, so neither is compared with the other by accident. `Rollback` withdraws a stage while keeping the reads and writes, so the transaction can stage again.

```go
transaction, err := database.TransactionInit()
defer transaction.Close()
err = transaction.BlobsWrite(people, []ustore.Key{ada, grace}, ustore.TapeOf("Ada", "Grace"), nil)
peek, err := transaction.View(ustore.WatchNone).BlobsRead(people, []ustore.Key{ada}, arena, nil)
readStamp, err := transaction.Stage()
commitStamp, err := transaction.Commit(ustore.DurabilityFlushed)
```

### API

#### Types

##### `CommitStamp`

CommitStamp is a commit's position in commit order, which a read at any [ReadStamp](#ReadStamp) at or above it sees.

[db.go:145 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L145)

```go
type CommitStamp uint64
```

##### `ReadStamp`

ReadStamp is the stamp a transaction or a snapshot reads at.

[db.go:141 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L141)

```go
type ReadStamp uint64
```

##### Enum `Isolation`

Isolation is how the transactions of the in-memory engine see each other's writes.2

[db.go:344 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L344)

```go
type Isolation int32
```

##### Values

| `IsolationStrictSerializable` | | IsolationStrictSerializable makes every transaction appear to run alone at one moment. |
| - | - | - |
| `IsolationSnapshot` | | IsolationSnapshot makes every transaction read the state its start saw. |

###### `IsolationFromName`

IsolationFromName reads an isolation back from the spelling [Isolation.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:359 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L359)

```go
func IsolationFromName(name string) (Isolation, error)
```

###### `String`

String renders the isolation as the library spells it.

[db.go:354 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L354)

```go
func (isolation Isolation) String() string
```

##### Struct `TransactionDeferredOn`

TransactionDeferredOn is the receiver whose verbs submit their calls to an executor, offering the verbs of [TransactionOn](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#TransactionOn) with the same arguments.18

[db.go:701 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L701)

```go
type TransactionDeferredOn struct {
    // contains filtered or unexported fields
}
```

###### `*`

× 3 Commit submits [TransactionOn.Commit](#Commit).

[db.go:1692 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L1692)

```go
func (on TransactionDeferredOn) Commit(
    durability Durability,
) (*Deferred[CommitStamp], error)
```

| Symbol |
| - |
| `Commit` |
| `Rollback` |
| `Stage` |

###### `BlobsRemove`

BlobsRemove submits [DatabaseOn.BlobsRemove](#BlobsRemove).

[db.go:209 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L209)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) BlobsRemove(
    collections Collections,
    keys []Key,
    config *RemoveConfig,
) (*Deferred[struct{}], error)
```

###### `BlobsWrite`

BlobsWrite submits [DatabaseOn.BlobsWrite](#BlobsWrite).

[db.go:169 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L169)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) BlobsWrite(
    collections Collections,
    keys []Key,
    values Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `DocsRemove`

DocsRemove submits [DatabaseOn.DocsRemove](#DocsRemove).

[db.go:194 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L194)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) DocsRemove(
    collections Collections,
    keys []Key,
    config *RemoveConfig,
) (*Deferred[struct{}], error)
```

###### `DocsWrite`

DocsWrite submits [DatabaseOn.DocsWrite](#DocsWrite).

[db.go:149 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L149)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) DocsWrite(
    collections Collections,
    keys []Key,
    values Tape,
    config *DocsWriteConfig,
) (*Deferred[struct{}], error)
```

###### `GraphRemoveEdges`

GraphRemoveEdges submits [DatabaseOn.GraphRemoveEdges](#GraphRemoveEdges).

[db.go:261 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L261)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) GraphRemoveEdges(
    collections Collections,
    edges []Edge,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `GraphRemoveVertices`

GraphRemoveVertices submits [DatabaseOn.GraphRemoveVertices](#GraphRemoveVertices).

[db.go:358 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L358)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) GraphRemoveVertices(
    collections Collections,
    vertices []Key,
    config *GraphRemoveVerticesConfig,
) (*Deferred[struct{}], error)
```

###### `GraphWriteEdges`

GraphWriteEdges submits [DatabaseOn.GraphWriteEdges](#GraphWriteEdges).

[db.go:219 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L219)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) GraphWriteEdges(
    collections Collections,
    edges []Edge,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `GraphWriteVertices`

GraphWriteVertices submits [DatabaseOn.GraphWriteVertices](#GraphWriteVertices).

[db.go:307 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L307)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) GraphWriteVertices(
    collections Collections,
    vertices []Key,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `PagesImport`

PagesImport submits [DatabaseOn.PagesImport](#PagesImport).

[db.go:91 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L91)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesImport(
    collections Collections,
    keys []Key,
    values Tape,
    config *PagesImportConfig,
) (*Deferred[struct{}], error)
```

###### `PagesInsert`

PagesInsert submits [DatabaseOn.PagesInsert](#PagesInsert).

[db.go:167 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L167)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesInsert(
    collections Collections,
    keys []Key,
    values Tape,
    arena *Arena,
    config *PagesInsertConfig,
) (*Deferred[Inserted], error)
```

###### `PagesMove`

PagesMove submits [DatabaseOn.PagesMove](#PagesMove).

[db.go:280 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L280)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesMove(
    collections Collections,
    keys, elements []Key,
    config *PagesMoveConfig,
) (*Deferred[struct{}], error)
```

###### `PagesRemove`

PagesRemove submits [DatabaseOn.PagesRemove](#PagesRemove).

[db.go:227 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L227)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesRemove(
    collections Collections,
    keys []Key,
    config *PagesRemoveConfig,
) (*Deferred[struct{}], error)
```

###### `PagesRemoveAttributes`

PagesRemoveAttributes submits [DatabaseOn.PagesRemoveAttributes](#PagesRemoveAttributes).

[db.go:408 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L408)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesRemoveAttributes(
    collections Collections,
    keys, elements []Key,
    fields Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `PagesSetAttributes`

PagesSetAttributes submits [DatabaseOn.PagesSetAttributes](#PagesSetAttributes).

[db.go:366 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L366)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesSetAttributes(
    collections Collections,
    keys, elements []Key,
    fields, values Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `PagesSplice`

PagesSplice submits [DatabaseOn.PagesSplice](#PagesSplice).

[db.go:323 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L323)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) PagesSplice(
    collections Collections,
    keys, elements []Key,
    textStarts, textLengths []uint64,
    values Tape,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

###### `StringsRemove`

StringsRemove submits [DatabaseOn.StringsRemove](#StringsRemove).

[db.go:91 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L91)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) StringsRemove(
    collections Collections,
    strings Tape,
    config *StringsRemoveConfig,
) (*Deferred[struct{}], error)
```

###### `StringsWrite`

StringsWrite submits [DatabaseOn.StringsWrite](#StringsWrite).

[db.go:40 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L40)

Inherited from `deferredWrites[Handle]`

```go
func (on TransactionDeferredOn) StringsWrite(
    collections Collections,
    strings Tape,
    values []Key,
    config *WriteConfig,
) (*Deferred[struct{}], error)
```

##### Enum `Watch`

Watch is whether a transaction records the keys a call reads or writes, to refuse its commit when another writer changes them first.2

[db.go:244 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L244)

```go
type Watch int32
```

##### Values

| `WatchKeys` | | WatchKeys records the keys, so a concurrent change to any of them fails the commit. |
| - | - | - |
| `WatchNone` | | WatchNone records nothing, so concurrent changes to these keys never fail the commit. |

###### `WatchFromName`

WatchFromName reads a watch back from the spelling [Watch.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[db.go:257 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L257)

```go
func WatchFromName(name string) (Watch, error)
```

###### `String`

String renders the watch as the library spells it.

[db.go:254 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L254)

```go
func (watch Watch) String() string
```

## Snapshots

1.0.0-rc.1 · 084197c4

A snapshot pins the state it was taken at until it is closed, and its verbs read that state; nothing writes through it. `Snapshot.ReadStamp` is the stamp it reads at, which every commit whose `CommitStamp` is at or below it shows. `Save` writes it out as a new database of the same engine, holding exactly the collections and names it records.

```go
snapshot, err := database.SnapshotInit()
defer snapshot.Close()
pinned, err := snapshot.BlobsRead(people, []ustore.Key{ada}, arena, nil)
err = snapshot.Save("/var/lib/people-copy", nil)
```

## Documents

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

`DocsWrite` 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. `DocsRead` reads whole documents or fields as JSON or as strings, and `DocsGist` lists the paths to every leaf. `DocsGather` converts fields into typed columns, a row per key, whose scalars `DocsColumnScalars` views straight in the arena beside the validity, conversion and collision bitmaps.

```go
documents := ustore.TapeOf(`{"name":"Ada","born":1815}`)
err := database.DocsWrite(people, []ustore.Key{ada}, documents, nil)
died := &ustore.DocsWriteConfig{Fields: ustore.TapeOf("died")}
err = database.DocsWrite(people, []ustore.Key{ada}, ustore.TapeOf("1852"), died)

names, err := database.DocsRead(people, []ustore.Key{ada}, arena, &ustore.DocsReadConfig{
	Fields: ustore.TapeOf("name"), OutputsType: ustore.DocsFieldTypeString,
})
paths, err := database.DocsGist(people, []ustore.Key{ada}, otherArena)
columns, err := database.DocsGather(people, []ustore.Key{ada}, ustore.TapeOf("born"),
	[]ustore.DocsFieldType{ustore.DocsFieldTypeU64}, arena)
born := ustore.DocsColumnScalars[uint64](columns.Column(0))
```

### API

#### Types

##### `DocsReadConfig`

DocsReadConfig carries the optional arguments of [DatabaseOn.DocsRead](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DocsRead).

[db.go:231 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L231)

```go
type DocsReadConfig struct {
    Fields Tape
    OutputsType DocsFieldType
}
```

##### Fields

| `Fields` | `Tape` | Fields to read inside the documents, one per key, top-level keys or RFC 6901 pointers, or whole documents when empty. |
| - | - | - |
| `OutputsType` | `DocsFieldType` | OutputsType is what the values are converted into, JSON text by default or a string. |

##### `DocsScalar`

DocsScalar constrains the Go types a scalar column reads as, one per fixed-width [DocsFieldType](#DocsFieldType): a 16-bit float as its bits, and a UUID as a [Key](https://www.unum.cloud/docs/ustore/go/scans.md#Key).

[db.go:407 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L407)

```go
type DocsScalar interface {
    ~bool | ~int8 | ~int16 | ~int32 | ~int64 | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~[16]byte
}
```

##### `DocsWriteConfig`

DocsWriteConfig carries the optional arguments of [DatabaseOn.DocsWrite](https://www.unum.cloud/docs/ustore/go/transactions.md#DocsWrite).

[db.go:127 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L127)

```go
type DocsWriteConfig struct {
    IDField string
    Fields Tape
    Type DocsFieldType
    Modification DocsModification
    Durability Durability
}
```

##### Fields

| `IDField` | `string` | IDField is the field holding the key of every document when no keys are given, such as "\_id". |
| - | - | - |
| `Fields` | `Tape` | Fields to modify inside the documents, one per task, or whole documents when empty. |
| `Type` | `DocsFieldType` | Type is the format of the written values, JSON text by default. |
| `Modification` | `DocsModification` | Modification is applied to every document, an upsert by default. |
| `Durability` | `Durability` | Durability is how durable the writes are once the call finishes at the head. |

##### Struct `Columns`

Columns is one typed column per field a gather converted, one row per document, readable until the arena serves another call.2

[docs.go:345 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L345)

```go
type Columns struct {
    // contains filtered or unexported fields
}
```

###### `Column`

Column reports the column of field index.

[docs.go:356 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L356)

```go
func (columns Columns) Column(index uint) DocsColumn
```

###### `Len`

Len reports how many columns the call gathered, one per field.

[docs.go:353 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L353)

```go
func (columns Columns) Len() uint
```

##### Struct `DocsBatches`

DocsBatches is what one pull of a [DocsCursor](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#DocsCursor) wrote into its arena in walk order, one batch per executor task that found rows, readable until the arena serves another call.3

[docs.go:628 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L628)

```go
type DocsBatches struct {
    // contains filtered or unexported fields
}
```

###### `Columns`

Columns views the columns of batch index in the arena, one per field the cursor gathers.

[docs.go:647 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L647)

```go
func (batches DocsBatches) Columns(index uint) Columns
```

###### `Keys`

Keys views the keys of batch index in the arena, one per row.

[docs.go:639 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L639)

```go
func (batches DocsBatches) Keys(index uint) []Key
```

###### `Len`

Len reports how many batches the pull handed out, none once the walk is exhausted.

[docs.go:636 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L636)

```go
func (batches DocsBatches) Len() uint
```

##### Struct `DocsColumn`

DocsColumn is the rows of one field as an Apache Arrow array of its type, beside the bitmaps of the rows found and converted, converted with a change of semantics, and colliding with a value of an inconvertible type.5

[docs.go:366 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L366)

```go
type DocsColumn struct {
    // contains filtered or unexported fields
}
```

###### `Colliding`

Colliding reports whether a value of an inconvertible type sits under row's field.

[docs.go:391 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L391)

```go
func (column DocsColumn) Colliding(row uint) bool
```

###### `Converted`

Converted reports whether row's conversion changed its semantics, such as a string parsed into an integer.

[docs.go:384 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L384)

```go
func (column DocsColumn) Converted(row uint) bool
```

###### `Len`

Len reports how many rows the column holds.

[docs.go:373 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L373)

```go
func (column DocsColumn) Len() uint
```

###### `Strings`

Strings views the rows of a string, binary or JSON column in the arena, and nothing for a scalar column.

[docs.go:399 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L399)

```go
func (column DocsColumn) Strings() Strings
```

###### `Valid`

Valid reports whether row's value was found and converted.

[docs.go:376 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L376)

```go
func (column DocsColumn) Valid(row uint) bool
```

##### Enum `DocsFieldType`

DocsFieldType is the type of a document, or of a value extracted from one; every type but JSON text, strings and binary text is a fixed-width scalar.2

[docs.go:42 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L42)

```go
type DocsFieldType int32
```

##### Values

| `DocsFieldTypeJSON` | | DocsFieldTypeJSON is JSON text. |
| - | - | - |
| `DocsFieldTypeNull` | | DocsFieldTypeNull is the JSON null. |
| `DocsFieldTypeBool` | | DocsFieldTypeBool is a boolean. |
| `DocsFieldTypeUUID` | | DocsFieldTypeUUID is a 128-bit UUID. |
| `DocsFieldTypeF64` | | DocsFieldTypeF64 is a 64-bit float. |
| `DocsFieldTypeF32` | | DocsFieldTypeF32 is a 32-bit float. |
| `DocsFieldTypeF16` | | DocsFieldTypeF16 is a 16-bit float. |
| `DocsFieldTypeI64` | | DocsFieldTypeI64 is a signed 64-bit integer. |
| `DocsFieldTypeI32` | | DocsFieldTypeI32 is a signed 32-bit integer. |
| `DocsFieldTypeI16` | | DocsFieldTypeI16 is a signed 16-bit integer. |
| `DocsFieldTypeI8` | | DocsFieldTypeI8 is a signed 8-bit integer. |
| `DocsFieldTypeU64` | | DocsFieldTypeU64 is an unsigned 64-bit integer. |
| `DocsFieldTypeU32` | | DocsFieldTypeU32 is an unsigned 32-bit integer. |
| `DocsFieldTypeU16` | | DocsFieldTypeU16 is an unsigned 16-bit integer. |
| `DocsFieldTypeU8` | | DocsFieldTypeU8 is an unsigned 8-bit integer. |
| `DocsFieldTypeBinary` | | DocsFieldTypeBinary is the text of a value without a null terminator. |
| `DocsFieldTypeString` | | DocsFieldTypeString is a value printed as text. |

###### `DocsFieldTypeFromName`

DocsFieldTypeFromName reads a field type back from the spelling [DocsFieldType.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[docs.go:87 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L87)

```go
func DocsFieldTypeFromName(name string) (DocsFieldType, error)
```

###### `String`

String renders the field type as the library spells it, such as "f64".

[docs.go:82 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L82)

```go
func (fieldType DocsFieldType) String() string
```

##### Enum `DocsModification`

DocsModification is the modification a document write applies.2

[docs.go:94 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L94)

```go
type DocsModification int32
```

##### Values

| `DocsModifyUpsert` | | DocsModifyUpsert writes whether or not the document exists. |
| - | - | - |
| `DocsModifyUpdate` | | DocsModifyUpdate writes only documents that exist. |
| `DocsModifyInsert` | | DocsModifyInsert writes only documents that do not exist. |
| `DocsModifyPatch` | | DocsModifyPatch applies an RFC 6902 patch. |
| `DocsModifyMerge` | | DocsModifyMerge applies an RFC 7386 merge. |

###### `DocsModificationFromName`

DocsModificationFromName reads a modification back from the spelling [DocsModification.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[docs.go:116 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L116)

```go
func DocsModificationFromName(
    name string,
) (DocsModification, error)
```

###### `String`

String renders the modification as the library spells it.

[docs.go:110 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L110)

```go
func (modification DocsModification) String() string
```

##### Struct `Paths`

Paths is every unique JSON Pointer to a leaf that a gist found, readable until the arena serves another call.2

[docs.go:284 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L284)

```go
type Paths struct {
    // contains filtered or unexported fields
}
```

###### `Get`

Get views path index in the arena.

[docs.go:294 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L294)

```go
func (paths Paths) Get(index uint) []byte
```

###### `Len`

Len reports how many unique paths the call found.

[docs.go:291 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/docs.go#L291)

```go
func (paths Paths) Len() uint
```

#### Functions

##### `DocsColumnScalars`

DocsColumnScalars views the scalars of a column gathered as the type Value spells, in place; a Value of another width than the column's type reads garbage, as the column does not record it.

[ustore.go:413 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/ustore.go#L413)

```go
func DocsColumnScalars[Value DocsScalar](
    column DocsColumn,
) []Value
```

##### `DocsColumnViewToArrow`

DocsColumnViewToArrow exports one column a gather of fieldType wrote into arena as an Arrow column whose validity buffer is the column's validities; until both outputs are released, the arena's next call and Close answer [StatusContended](https://www.unum.cloud/docs/ustore/go/errors.md#StatusContended).

[ustore.go:118 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/ustore.go#L118)

```go
func DocsColumnViewToArrow(
    column DocsColumn,
    fieldType DocsFieldType,
    arena *Arena,
    schema *ArrowSchema,
    array *ArrowDeviceArray,
) error
```

## Graphs

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

A 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. `GraphReadEdges` answers `Neighborhoods`, the degree of every vertex and its edges, outgoing ones before incoming ones, and `Edge.Neighbor` names the other end. A `VertexRole` gives the whole batch one role and `VertexRoles` gives every vertex its own.

```go
follows, err := database.CollectionCreate("follows", ustore.ModalityGraph)
edges := []ustore.Edge{
	{Source: first, Target: second, ID: ustore.EdgeIDDefault},
	{Source: first, Target: third, ID: ustore.EdgeIDDefault},
	{Source: second, Target: third, ID: seventh},
}
err = database.GraphWriteEdges(follows, edges, nil)

vertices := []ustore.Key{first, third}
found, err := database.GraphReadEdges(follows, vertices, ustore.VertexRoleAny, arena)
for index, vertex := range vertices {
	for _, edge := range found.Edges(uint(index)) {
		fmt.Println(vertex, "meets", edge.Neighbor(vertex))
	}
}
err = database.GraphRemoveVertices(follows, []ustore.Key{first}, nil)
```

### API

#### Types

##### `GraphRemoveVerticesConfig`

GraphRemoveVerticesConfig carries the optional arguments of [DatabaseOn.GraphRemoveVertices](https://www.unum.cloud/docs/ustore/go/transactions.md#GraphRemoveVertices).

[db.go:339 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L339)

```go
type GraphRemoveVerticesConfig struct {
    EndVertices []Key
    Roles Roles
    Durability Durability
}
```

##### Fields

| `EndVertices` | `[]Key` | EndVertices turns every vertex into the inclusive start of a range ending before its end vertex, one per task, or removes the vertices alone when empty. |
| - | - | - |
| `Roles` | `Roles` | Roles are the roles of the vertices, needed only by joining graphs. |
| `Durability` | `Durability` | Durability is how durable the removals are once the call finishes at the head. |

##### `GraphScanConfig`

GraphScanConfig carries the optional arguments of [DatabaseOn.GraphScanVertices](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#GraphScanVertices).

[db.go:396 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L396)

```go
type GraphScanConfig struct {
    StartKeys []Key
    EndKeys []Key
    Direction ScanDirection
    Predicate Admitter
    Mode ScanMode
    Progress ProgressCallback
}
```

##### Fields

| `StartKeys` | `[]Key` | StartKeys are the inclusive starts of the scans, one per task, or the first vertex in Direction when empty. |
| - | - | - |
| `EndKeys` | `[]Key` | EndKeys are the vertices every scan stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every scan goes from its start. |
| `Predicate` | `Admitter` | Predicate admits or passes over the listed vertices. |
| `Mode` | `ScanMode` | Mode is in what order the vertices come. |
| `Progress` | `ProgressCallback` | Progress reports the scans finished, and may cancel the call. |

##### `GraphVerticesCursorConfig`

GraphVerticesCursorConfig carries the optional arguments of [DatabaseOn.GraphVerticesCursorInit](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#GraphVerticesCursorInit).

[db.go:468 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L468)

```go
type GraphVerticesCursorConfig struct {
    EndKey *Key
    Direction ScanDirection
    Predicate Admitter
}
```

##### Fields

| `EndKey` | `*Key` | EndKey is the vertex the walk stops before, or nil for no bound. |
| - | - | - |
| `Direction` | `ScanDirection` | Direction is which way the walk goes from its start. |
| `Predicate` | `Admitter` | Predicate admits or passes over the vertices of every page. |

##### `Roles`

Roles names the role of every vertex in a batch: a [VertexRole](#VertexRole) the whole batch shares, or [VertexRoles](#VertexRoles), one per vertex; nil stands for [VertexRoleAny](#VertexRoleAny).

[db.go:85 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L85)

```go
type Roles interface {
    // contains filtered or unexported methods
}
```

##### `VertexRoles`

VertexRoles names one role per vertex of a batch.

[db.go:90 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L90)

```go
type VertexRoles []VertexRole
```

##### Struct `Edge`

Edge is a source, a target and an edge identifier, laid out as the three keys the library puts on its tapes, so a slice of edges crosses as three strided columns.1

[graph.go:40 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L40)

```go
type Edge struct {
    Source Key
    Target Key
    ID     Key
}
```

###### `Neighbor`

Neighbor reports the end of the edge other than vertex.

[graph.go:50 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L50)

```go
func (edge Edge) Neighbor(vertex Key) Key
```

##### Struct `Neighborhoods`

Neighborhoods is the degree and the edges of every vertex a read named, readable until the arena serves another call.3

[graph.go:135 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L135)

```go
type Neighborhoods struct {
    // contains filtered or unexported fields
}
```

###### `Degree`

Degree reports how many edges vertex index connects to, and false for a missing vertex.

[graph.go:150 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L150)

```go
func (neighborhoods Neighborhoods) Degree(
    index uint,
) (uint32, bool)
```

###### `Edges`

Edges views the edges of vertex index in the arena: with both roles the outgoing ones first, sorted by target, then the incoming ones, sorted by source.

[graph.go:159 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L159)

```go
func (neighborhoods Neighborhoods) Edges(index uint) []Edge
```

###### `Len`

Len reports how many vertices the call read.

[graph.go:144 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L144)

```go
func (neighborhoods Neighborhoods) Len() uint
```

##### Enum `VertexRole`

VertexRole is the role a vertex plays in the edges a call names.2

[graph.go:58 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L58)

```go
type VertexRole int32
```

##### Values

| `VertexRoleUnknown` | | VertexRoleUnknown is no role. |
| - | - | - |
| `VertexRoleSource` | | VertexRoleSource is the vertex an edge leaves. |
| `VertexRoleTarget` | | VertexRoleTarget is the vertex an edge enters. |
| `VertexRoleAny` | | VertexRoleAny is either end of an edge. |

###### `VertexRoleFromName`

VertexRoleFromName reads a role back from the spelling [VertexRole.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[graph.go:77 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L77)

```go
func VertexRoleFromName(name string) (VertexRole, error)
```

###### `String`

String renders the role as the library spells it.

[graph.go:72 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/graph.go#L72)

```go
func (role VertexRole) String() string
```

#### Constants

##### `EdgeIDDefault`

EdgeIDDefault is the identifier of an edge that was given none, every bit of it set.

[db.go:47 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L47)

```go
var EdgeIDDefault = KeyUnknown
```

## Errors

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

Every 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. A closed handle is refused with `StatusUninitialized` before anything crosses, and a batch whose runs disagree in length with `StatusInvalidArgument`. `Status`, `Durability`, `Watch`, `Modality` and the other enums print through `String` and parse through their `FromName` functions the spellings the C tables own, such as `"not-found"` or `"strict-serializable"`.

```go
_, err := database.CollectionCreate("people", ustore.ModalityBlobs)
if errors.Is(err, ustore.StatusAlreadyExists) {
	fmt.Println(err)
}
fmt.Println(ustore.VersionName()) // the library the program runs against, such as "1.0.0-rc.1"
```

### API

#### Struct `Error`

Error is one failed call: a status every caller can branch on, and the detail the status cannot carry.2

[types.go:153 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L153)

```go
type Error struct {
    Status  Status
    Message string
}
```

Reach the status with errors.Is or errors.As.

##### `Error`

Error implements the error interface.

[types.go:159 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L159)

```go
func (failure *Error) Error() string
```

##### `Unwrap`

Unwrap exposes the status, which is what errors.Is compares.

[types.go:164 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L164)

```go
func (failure *Error) Unwrap() error
```

#### Enum `Status`

Status names what went wrong, in a vocabulary shared by every engine and by this binding.3

[types.go:83 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L83)

```go
type Status int32
```

Validation performed here before a call crosses reports the status the engine would have reported for the same fault.

A Status is an error, so errors.Is matches any failure carrying it against a bare Status.

##### Values

| `StatusSuccess` | | StatusSuccess means the call succeeded and carries no message. |
| - | - | - |
| `StatusDeferred` | | StatusDeferred means the call was submitted deferred and is not final yet. |
| `StatusOutOfMemory` | | StatusOutOfMemory means an allocation could not be satisfied. |
| `StatusReadOnly` | | StatusReadOnly means the call would change a database opened read-only. |
| `StatusIO` | | StatusIO means a file or directory could not be opened, read, written, or closed. |
| `StatusDevice` | | StatusDevice means a device could not be selected or its memory claimed, or the call's executor, database and arena belong to different residencies or devices. |
| `StatusMalformed` | | StatusMalformed means stored or supplied data could not be decoded. |
| `StatusInternal` | | StatusInternal means the engine failed in a way no other status names. |
| `StatusOverflow` | | StatusOverflow means a count passed what its word holds, like the open exports of one arena. |
| `StatusUninitialized` | | StatusUninitialized means the call needs a handle that was never opened or is closed. |
| `StatusConfigMismatch` | | StatusConfigMismatch means the handles or arguments are each well-formed but cannot be joined. |
| `StatusContended` | | StatusContended means the call was refused rather than waited for: another call holds its executor, arena, cursor or transaction. |
| `StatusCancelled` | | StatusCancelled means a progress handler stopped the call, which unwound and published nothing. |
| `StatusUnsupported` | | StatusUnsupported means the engine or build does not implement what the call asks for. |
| `StatusInvalidArgument` | | StatusInvalidArgument means an argument is missing, contradicts another one, or carries a choice the call does not accept. |
| `StatusNotFound` | | StatusNotFound means a collection, a directory, or a document a modification needs does not exist. |
| `StatusAlreadyExists` | | StatusAlreadyExists means a collection name or a document the call creates is already taken. |
| `StatusWriteConflict` | | StatusWriteConflict means a concurrent writer changed a key this transaction wrote. |
| `StatusReadConflict` | | StatusReadConflict means a concurrent writer changed a key this transaction read. |
| `StatusPhantomConflict` | | StatusPhantomConflict means a concurrent writer inserted into a range this transaction scanned. |
| `StatusCapacityExhausted` | | StatusCapacityExhausted means a hard design ceiling was reached. |

###### `StatusFromName`

StatusFromName reads a status back from the spelling [Status.String](https://www.unum.cloud/docs/ustore/go/platform-notes.md#String) renders.

[types.go:142 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L142)

```go
func StatusFromName(name string) (Status, error)
```

###### `Error`

Error implements the error interface, so a bare Status is an errors.Is target.

[types.go:149 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L149)

```go
func (status Status) Error() string
```

###### `String`

String renders the status as the library spells it, such as "not-found".

[types.go:137 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/types.go#L137)

```go
func (status Status) String() string
```

## Platform Notes

`import "github.com/unum-cloud/ustore"` 1.0.0-rc.1 · 084197c4

#### Engines

`DatabaseInitRam` 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`. `Close` writes nothing to disk, so `On(executor).Flush()` makes commits with `DurabilityBuffered` durable before it. `Describe` reports the engine, the isolation, the CPU class picked and the sizes the engine estimates, `Clear` empties every collection at once, and `Compact` reclaims space through the phases its engine runs, where a `CompactPlan` keeps a stopped compaction open until `CompactPlanFinish`. The RAM engine always links, and build tags mirror the Cargo features for the others: `ustore_rocksdb` links `librocksdb`, and on Linux `liburing` beside it, and `ustore_leveldb` links `libleveldb`. Build the archive with the matching `USTORE_WITH_*` options and point `CGO_LDFLAGS` at the directory holding the engine archives too, as the `lib/` of a prefix CMake installed with `USTORE_INSTALL` does; the NVMe engine links nothing more.

```sh
go build -tags ustore_rocksdb,ustore_leveldb ./...
```

With those tags, a scratch database in memory and a RocksDB directory open side by side, and either one describes, clears and compacts through the same calls:

```go
scratch, err := ustore.DatabaseInitRam(&ustore.DatabaseInitRamConfig{Isolation: ustore.IsolationSnapshot})
people, err := ustore.DatabaseOpenRocksdb("/var/lib/people", nil)
description, err := people.Describe()
err = people.Clear(ustore.DropValues) // keeps every key, emptying its value
err = people.Compact(nil)            // reclaims what overwritten and removed data still takes
```

#### Left Unbound

- Deferred opens, transaction and snapshot inits, resets, cursor inits, cursor pulls and ingests: these block whatever receiver they are called on.
- The progress of a cursor pull, and the lengths a read writes beside its values, which the tape’s offsets carry.
- Batches of strings through an accessor: every input batch is a `Tape`.
- Exporting strided keys, like the columns of edges, through `KeysViewToArrow`, which takes dense keys alone.

#### Design

- The receiver makes the completion a type, not a flag. Each verb is written once over its parent, and the parent decides what compiles: only a transaction commits, only the head clears and compacts, and nothing writes through a snapshot.
- Inputs cross as they lie. Keys, edges and tapes are pinned in place for the call, and a collection or a role the whole batch shares crosses from the call’s own frame, so nothing is staged on the way in.
- One pinned frame per call. It holds the outcome, the argument structure, the fixed-width inputs and the result, and `TestCallsAllocateOnlyTheirFrames` pins the budgets below.
- No life of its own. The binding starts no goroutines, takes no locks and keeps no counts or queues, and releasing a `Deferred` rides `Wait`, `Close` or the collector, each of which waits for the call to be final first.

| Path | Go | Rust |
| - | - | - |
| Blocking call | 1 frame | 0 |
| Refusal before the call | 1 `Error` | 1 error |
| Deferred submit and wait | 4: frame, `Deferred`, 2 in `AddCleanup` | 0 |
| Each callback | 1 handle | 0 |

### API

#### Types

##### `PagesImportConfig`

PagesImportConfig carries the optional arguments of [DatabaseOn.PagesImport](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesImport).

[db.go:74 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L74)

```go
type PagesImportConfig struct {
    Encoding PageEncoding
    Durability Durability
    Progress ProgressCallback
}
```

##### Fields

| `Encoding` | `PageEncoding` | Encoding is the encoding of the markup. |
| - | - | - |
| `Durability` | `Durability` | Durability is how durable the edits are once the call finishes at the head. |
| `Progress` | `ProgressCallback` | Progress reports the pages parsed, and may cancel the call. |

##### `PagesInsertConfig`

PagesInsertConfig carries the optional arguments of [DatabaseOn.PagesInsert](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesInsert).

[db.go:128 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L128)

```go
type PagesInsertConfig struct {
    Elements []Key
    Parents []Key
    Anchors []Key
    Encoding PageEncoding
    Durability Durability
}
```

##### Fields

| `Elements` | `[]Key` | Elements are the keys to give the inserted elements, one per task, or keys minted for each when empty. |
| - | - | - |
| `Parents` | `[]Key` | Parents are the elements the fragments land under, one per task, the zero key for the root, or the root for every one when empty. |
| `Anchors` | `[]Key` | Anchors are the siblings after which the fragments land, one per task, the zero key for the front, or the front for every one when empty. |
| `Encoding` | `PageEncoding` | Encoding is the encoding of the fragments. |
| `Durability` | `Durability` | Durability is how durable the edits are once the call finishes at the head. |

##### `PagesMoveConfig`

PagesMoveConfig carries the optional arguments of [DatabaseOn.PagesMove](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesMove).

[db.go:261 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L261)

```go
type PagesMoveConfig struct {
    Parents []Key
    Anchors []Key
    Durability Durability
}
```

##### Fields

| `Parents` | `[]Key` | Parents are the elements the moved elements land under, one per task, the zero key for the root. |
| - | - | - |
| `Anchors` | `[]Key` | Anchors are the siblings after which the moved elements land, one per task, the zero key for the front. |
| `Durability` | `Durability` | Durability is how durable the edits are once the call finishes at the head. |

##### `PagesReadConfig`

PagesReadConfig carries the optional arguments of [DatabaseOn.PagesRead](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#PagesRead).

[db.go:446 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L446)

```go
type PagesReadConfig struct {
    Elements []Key
    OutputsEncoding PageEncoding
}
```

##### Fields

| `Elements` | `[]Key` | Elements are the elements to render with their subtrees, one per key, the zero key for the whole page, or whole pages when empty. |
| - | - | - |
| `OutputsEncoding` | `PageEncoding` | OutputsEncoding is the encoding the renderings are converted into. |

##### `PagesRemoveConfig`

PagesRemoveConfig carries the optional arguments of [DatabaseOn.PagesRemove](https://www.unum.cloud/docs/ustore/go/transactions.md#PagesRemove).

[db.go:208 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L208)

```go
type PagesRemoveConfig struct {
    Elements []Key
    EndKeys []Key
    Durability Durability
}
```

##### Fields

| `Elements` | `[]Key` | Elements are the elements to remove with their subtrees, one per task. |
| - | - | - |
| `EndKeys` | `[]Key` | EndKeys turn every key into the inclusive start of a range of whole pages ending before its end key, one per task, which leaves Elements empty. |
| `Durability` | `Durability` | Durability is how durable the edits are once the call finishes at the head. |

##### `PagesScanConfig`

PagesScanConfig carries the optional arguments of [DatabaseOn.PagesScan](https://www.unum.cloud/docs/ustore/go/batches-and-arenas.md#PagesScan).

[db.go:502 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/db.go#L502)

```go
type PagesScanConfig struct {
    StartKeys []Key
    EndKeys []Key
    Direction ScanDirection
    Filter string
    Predicate Admitter
    Mode ScanMode
    Progress ProgressCallback
}
```

##### Fields

| `StartKeys` | `[]Key` | StartKeys are the inclusive starts of the scans, one per task, or the first page in Direction when empty. |
| - | - | - |
| `EndKeys` | `[]Key` | EndKeys are the keys every scan stops before, one per task, or no bound when empty. |
| `Direction` | `ScanDirection` | Direction is which way every scan goes from its start. |
| `Filter` | `string` | Filter is the expression every listed page matches, shared by every scan. |
| `Predicate` | `Admitter` | Predicate admits or passes over the listed keys. |
| `Mode` | `ScanMode` | Mode is in what order the keys come. |
| `Progress` | `ProgressCallback` | Progress reports the scans finished, and may cancel the call. |

##### Struct `Inserted`

Inserted is the key every inserted element ended up with, minted or given, readable until the arena serves another call.1

[pages.go:146 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L146)

```go
type Inserted struct {
    // contains filtered or unexported fields
}
```

###### `Keys`

Keys views the keys of the inserted elements in the arena, one per fragment.

[pages.go:153 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L153)

```go
func (inserted Inserted) Keys() []Key
```

##### Enum `PageEncoding`

PageEncoding is the encoding a page or a fragment is imported from or rendered into.2

[pages.go:42 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L42)

```go
type PageEncoding int32
```

##### Values

| `PageEncodingHTML` | | PageEncodingHTML is HTML, not yet imported. |
| - | - | - |
| `PageEncodingXML` | | PageEncodingXML is XML, with every element and attribute kept as written. |
| `PageEncodingMarkdown` | | PageEncodingMarkdown is Markdown, not yet imported. |
| `PageEncodingText` | | PageEncodingText is the text of every run in document order, with structure dropped. |
| `PageEncodingJSON` | | PageEncodingJSON is the element tree as JSON, not yet imported. |

###### `PageEncodingFromName`

PageEncodingFromName reads an encoding back from the spelling [PageEncoding.String](#String) renders.

[pages.go:63 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L63)

```go
func PageEncodingFromName(name string) (PageEncoding, error)
```

###### `String`

String renders the encoding as the library spells it.

[pages.go:58 ↗](https://github.com/unum-cloud/UStore/blob/084197c470a8c329d83051d880c71e7972b9e1b2/pages.go#L58)

```go
func (encoding PageEncoding) String() string
```
