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 ¶
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 Columns ¶
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.