meta

package
v0.0.0-...-f847f7c Latest Latest
Warning

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

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

Documentation

Overview

Package meta loads a RecordMetaData from one of the two supported sources declared in a Context's MetadataSource field:

  • FileSource: a serialized RecordMetaDataProto.MetaData on disk
  • FDBStoreSource: an FDBMetaDataStore at a given keyspace path

Both produce the same *recordlayer.RecordMetaData and callers never need to know which source produced it. See cmd/frl/docs/operator-guide.md for the app-side wiring (Go + Java) for each path.

Index

Constants

This section is empty.

Variables

View Source
var ErrFDBStoreNotAvailable = errors.New("this command does not support fdb_store metadata sources — configure `meta_file` in the context or pass --meta-file")

ErrFDBStoreNotAvailable is returned by FromContext when the context is wired for an FDBMetaDataStore source but the caller passed a nil db handle or keyspaceResolver — i.e. the command explicitly opted out of FDB-store support. Callers that want to surface a friendlier "this command doesn't support fdb_store sources" message detect this with errors.Is().

The message starts with "this command" (rather than "fdb_store …") so fang's auto-capitalized error banner reads as a sentence — "fdb_store" gets up-cased to "Fdb_store" which looks like a typo.

View Source
var ErrMissingSource = errors.New("context has no metadata source; add metadata.meta_file or metadata.meta_store_keyspace to the context")

ErrMissingSource is returned by FromContext when the context has no metadata source configured and one is required by the caller.

Functions

This section is empty.

Types

type FDBStoreSource

type FDBStoreSource struct {
	DB           *recordlayer.FDBDatabase
	Subspace     subspace.Subspace
	KeyspacePath string // retained for Name() / error context
}

FDBStoreSource reads the current RecordMetaData from an FDBMetaDataStore at the configured subspace. Loads are performed in a new read transaction for each call.

func (*FDBStoreSource) Load

func (*FDBStoreSource) Name

func (s *FDBStoreSource) Name() string

type FileSource

type FileSource struct {
	Path string
}

FileSource reads a serialized com.apple.foundationdb.record.RecordMetaDataProto.MetaData message from disk. Typically produced by an app's build/deploy tooling using recordlayer.WriteRecordMetaData (or Java's meta.toProto().writeTo()).

func (*FileSource) Load

func (*FileSource) Name

func (s *FileSource) Name() string

type Source

type Source interface {
	// Name is a short human-readable identifier used in errors and logs,
	// e.g. "file:/etc/myapp/meta.pb" or "fdb_store:/myapp/_meta".
	Name() string

	// Load resolves the source into a RecordMetaData. Errors wrap the
	// underlying cause (file IO, FDB transaction, proto unmarshal, or
	// metadata build) and are safe to surface directly to the operator.
	Load(ctx context.Context) (*recordlayer.RecordMetaData, error)
}

Source abstracts where a RecordMetaData comes from. Implementations are expected to be cheap to construct; Load is where the actual IO happens.

func FromContext

func FromContext(
	ctx *configv1.Context,
	db *recordlayer.FDBDatabase,
	keyspaceResolver func(string) (subspace.Subspace, error),
) (Source, error)

FromContext builds a Source from a Context's metadata field. Returns ErrMissingSource if neither meta_file nor meta_store_keyspace is set (commands that can tolerate missing metadata — like `store info` — should check errors.Is(err, ErrMissingSource) and skip loading).

keyspaceResolver is the hook used by FDBStoreSource to turn a string keyspace path into an FDB subspace. Callers inject this so the meta package doesn't duplicate parse-path logic living in internal/cmd.

Jump to

Keyboard shortcuts

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