keyspace

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package keyspace defines the relational-layer FDB key structure.

The relational layer stores data under a two-level path:

catalog store:  [root]["__SYS"]["__SYS"]["CATALOG"]
user schemas:   [root][domain][dbPath][schemaName]

This mirrors the Java RelationalKeyspaceProvider layout conceptually, but uses plain tuple keys instead of DirectoryLayerDirectory — Go-to-Go relational stores do not need to share keyspace with Java relational stores. Only the RECORD LAYER data format (records, indexes, catalog protos) must be Java-compatible, not the path prefix scheme.

Index

Constants

View Source
const (
	SysName     = "__SYS"
	CatalogName = "CATALOG"
	// StatsName roots collected planner statistics (RFC-236). It is a SIBLING
	// of every schema subspace, never a child, because a schema subspace IS a
	// record store subspace and that namespace belongs to Java —
	// FDBRecordStoreKeyspace defines 0-10 and is (UNSTABLE). Statistics are
	// a Go-side optimization and must not add a byte inside it.
	StatsName = "__STATS"
)

Variables

This section is empty.

Functions

func ParseDBPath

func ParseDBPath(dbPath string) ([]string, error)

ParseDBPath breaks a URI-style database path like "/domain/db" into its path components, stripping the leading slash. Returns an error if the path is invalid.

Types

type RelationalKeyspace

type RelationalKeyspace struct {
	// contains filtered or unexported fields
}

RelationalKeyspace provides FDB subspace resolution for the relational layer. Construct one with a root subspace (e.g. the empty subspace or a tenant-specific prefix), then call CatalogSubspace / SchemaSubspace to get per-object subspaces.

func New

New returns a RelationalKeyspace rooted at root.

func (*RelationalKeyspace) CatalogSubspace

func (k *RelationalKeyspace) CatalogSubspace() subspace.Subspace

CatalogSubspace returns the subspace for the system catalog record store (the __SYS/CATALOG schema).

func (*RelationalKeyspace) SchemaSubspace

func (k *RelationalKeyspace) SchemaSubspace(dbPath, schemaName string) (subspace.Subspace, error)

SchemaSubspace returns the subspace for a user schema identified by (dbPath, schemaName). dbPath is the full database path (e.g. "/my/db"). Returns an error if dbPath or schemaName is empty.

func (*RelationalKeyspace) StatisticsSubspace

func (k *RelationalKeyspace) StatisticsSubspace() subspace.Subspace

StatisticsSubspace returns the root under which collected planner statistics live (RFC-236). Statistics for a given store are keyed BELOW this by that store's own subspace prefix, which is what makes the scheme layout-agnostic: a store is its prefix, whether it came from a relational schema, a hand-built store, or a Java-authored layout.

It deliberately takes no (dbPath, schema): the per-store keying happens one level down, so one root serves every store in this keyspace and the collector needs no relational concepts at all.

TENANTS: FDB tenants are separate keyspaces, so a store's prefix is only meaningful within its tenant — two tenants may hold byte-identical prefixes for different stores. A tenant-scoped deployment must therefore build its RelationalKeyspace on a root inside that tenant, which it already does, since `root` is whatever the caller opened. Nothing here can mix tenants that the caller has not already mixed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL