store

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package store is the contract between ceremony's engine and the store that keeps the entities, what a binding such as ceremony/goke implements: the engine reads an entity's facts and tags off a Row the store hands it a block at a time, writes a fact into the place the store's Facts stage for it, and keeps a plan's state in the Mind the store carries on the entity.

Row and Col

A Row is a block of entities: for every column bound through Columns, the array of its values over the block, as the store lays them out, nil where the block carries none. The engine indexes it with Row.At and nothing else; the store decides what a block is and hands the arrays out of its own accessors, so the engine knows nothing of its layout.

Facts

Facts is the writing side: Facts.Stage hands the engine the place to write a fact into, in the store's own staging, so a value is written once, where the store wants it, and lands as the store syncs; Facts.Drop takes a fact off the same way.

Mind

Mind is the component every entity on a plan carries, saved with it; MaxSteps bounds a plan. A plan's shape changed, its saved minds do not load.

Index

Constants

View Source
const MaxSteps = 128

MaxSteps is how many steps one plan holds at most.

Variables

This section is empty.

Functions

This section is empty.

Types

type Col

type Col struct {
	Idx  int
	Size uintptr
}

Col is one column of a Row: its place and the size of one value.

type Columns

type Columns interface {
	Column(t reflect.Type) Col
}

Columns is what hands the engine the columns it reads, as a pass is bound: Column registers the component type t with the store and says where the Row carries it.

type Facts

type Facts interface {
	Columns
	// Stage is where a fact of col for id is written, in the store's own staging, landing as
	// the store syncs; nil where id has no mind to take it.
	Stage(id uid.UID64, col Col) unsafe.Pointer
	// Drop takes the fact of col off id as the store syncs.
	Drop(id uid.UID64, col Col)
}

Facts is how a store gives the engine the facts it reads and writes: a fact is a value of its type on an entity, one at most.

type Mind

type Mind struct {
	Plan    uint64 // the name hashed
	Running StepSet
	Slot    [MaxSteps]uint8
	Since   [MaxSteps]time.Duration // on the clock of the plans
}

Mind is the state of an entity's plan, a component the entity carries: which plan, the steps running since the last tick and what each keeps. The fields are exported and of a fixed size for the store.

type Row

type Row struct {
	Columns []unsafe.Pointer // by Col.Idx
}

Row is a block of entities as the store hands it to the engine: for every column bound, the array of its values over the block, nil where the block carries none.

func (Row) At

func (r Row) At(col Col, i int) unsafe.Pointer

At is the value of col for the i-th entity of the row, nil where the row carries none.

type StepSet

type StepSet [MaxSteps / 64]uint64

StepSet is a set of a plan's steps, a bit each.

Jump to

Keyboard shortcuts

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