resultauthority

package
v0.6.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMetadataUnavailable = errors.New("result metadata is unavailable")

Functions

func Bind

func Bind[V any, M comparable](
	handle *Handle[V, M],
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
) error

func BindMany

func BindMany[V any, M comparable](requests []BindRequest[V, M]) error

BindMany binds no slot unless every requested authority and root passes preflight.

func Materialize

func Materialize[V any, M comparable](
	handle *Handle[V, M],
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
	clone func(*V) V,
) (V, error)

func MetadataMatches

func MetadataMatches[V any, M comparable](
	handle *Handle[V, M],
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
	metadata M,
) error

func Pending

func Pending[V any, M comparable](
	handle *Handle[V, M],
	key incremental.QueryKey,
	encoded string,
	ownerRoot incremental.ExactValueRoot,
) error

func Take

func Take[V any, M comparable](
	handle *Handle[V, M],
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
) (V, error)

func TakeMany

func TakeMany[V any, M comparable](requests []TakeRequest[V, M]) ([]V, error)

TakeMany preflights one arena range before transferring any slot.

func Validate

func Validate[V any, M comparable](
	handle *Handle[V, M],
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
) error

Types

type Arena

type Arena[V any, M comparable] struct {
	// contains filtered or unexported fields
}

Arena owns a fixed set of independently authenticated result slots.

func NewArena

func NewArena[V any, M comparable](capacity int, generation uint64) (*Arena[V, M], error)

NewArena allocates exactly capacity result slots for generation.

func (*Arena[V, M]) InitializeOwned

func (a *Arena[V, M]) InitializeOwned(
	index int,
	key incremental.QueryKey,
	encoded string,
	value V,
	metadata *M,
) (*Ref[V, M], error)

InitializeOwned transfers value ownership into one exact empty slot.

func (*Arena[V, M]) InitializeOwnedMany

func (a *Arena[V, M]) InitializeOwnedMany(
	requests []InitializeRequest[V, M],
) ([]*Ref[V, M], error)

InitializeOwnedMany transfers value ownership only after every slot passes preflight.

func (*Arena[V, M]) Revoke

func (a *Arena[V, M]) Revoke()

Revoke clears every value still owned by the arena and invalidates all refs.

type BindRequest

type BindRequest[V any, M comparable] struct {
	Ref       *Ref[V, M]
	Key       incremental.QueryKey
	Encoded   string
	OwnerRoot incremental.ExactValueRoot
	Root      incremental.ExactValueRoot
}

BindRequest authenticates one pending or already-bound arena slot.

type Handle

type Handle[V any, M comparable] struct {
	// contains filtered or unexported fields
}

func New

func New[V any, M comparable](
	key incremental.QueryKey,
	encoded string,
	value V,
	metadata *M,
	clone func(*V) V,
) *Handle[V, M]

func NewOwned

func NewOwned[V any, M comparable](
	key incremental.QueryKey,
	encoded string,
	value V,
	metadata *M,
) *Handle[V, M]

type InitializeRequest

type InitializeRequest[V any, M comparable] struct {
	Index    int
	Key      incremental.QueryKey
	Encoded  string
	Value    V
	Metadata *M
}

InitializeRequest transfers one value into an exact arena slot.

type Ref

type Ref[V any, M comparable] struct {
	// contains filtered or unexported fields
}

Ref is the authenticated authority stored inside one arena slot.

func (*Ref[V, M]) Bind

func (r *Ref[V, M]) Bind(
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
) error

Bind installs the slot's exact root or authenticates an existing binding.

func (*Ref[V, M]) Materialize

func (r *Ref[V, M]) Materialize(
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
	clone func(*V) V,
) (V, error)

Materialize returns a detached clone while the arena retains ownership.

func (*Ref[V, M]) MetadataMatches

func (r *Ref[V, M]) MetadataMatches(
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
	metadata M,
) error

MetadataMatches authenticates optional metadata attached to the slot.

func (*Ref[V, M]) Pending

func (r *Ref[V, M]) Pending(
	key incremental.QueryKey,
	encoded string,
	ownerRoot incremental.ExactValueRoot,
) error

Pending authenticates an initialized slot before it owns an exact root.

func (*Ref[V, M]) Take

func (r *Ref[V, M]) Take(
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
) (V, error)

Take transfers slot ownership exactly once.

func (*Ref[V, M]) Validate

func (r *Ref[V, M]) Validate(
	key incremental.QueryKey,
	encoded string,
	ownerRoot, root incremental.ExactValueRoot,
) error

Validate authenticates the ref, its owner root, and its requested root.

type TakeRequest

type TakeRequest[V any, M comparable] struct {
	Ref       *Ref[V, M]
	Key       incremental.QueryKey
	Encoded   string
	OwnerRoot incremental.ExactValueRoot
	Root      incremental.ExactValueRoot
}

TakeRequest identifies one arena slot for an atomic ownership transfer.

Jump to

Keyboard shortcuts

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