StateModule

org.sigilaris.core.application.module.runtime.StateModule
See theStateModule companion class
object StateModule

Companion for StateModule, providing mounting, composition, and factory operations.

Attributes

Companion
class
Source
StateModule.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object ModuleFactory

Companion for ModuleFactory.

Companion for ModuleFactory.

Attributes

Companion
trait
Source
StateModule.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait ModuleFactory[F[_], Owns <: Tuple, Txs <: Tuple]

Factory for building state modules at arbitrary paths from a fixed blueprint.

Factory for building state modules at arbitrary paths from a fixed blueprint.

Type parameters

F

the effect type

Owns

the owned schema tuple

Txs

the transaction types tuple

Attributes

Companion
object
Source
StateModule.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def extend[F[_], Path <: Tuple, O1 <: Tuple, N1 <: Tuple, O2 <: Tuple, N2 <: Tuple, T1 <: Tuple, T2 <: Tuple, R1, R2](a: StateModule[F, Path, O1, N1, T1, R1], b: StateModule[F, Path, O2, N2, T2, R2])(using evidence$1: Monad[F], uniqueNames: UniqueNames[Concat[O1, O2]], prefixFreePath: PrefixFreePath[Path, Concat[O1, O2]], disjointNeeds: DisjointSchemas[N1, N2]): StateModule[F, Path, Concat[O1, O2], Concat[N1, N2], Concat[T1, T2], StateReducer[F, Path, Concat[O1, O2], Concat[N1, N2]]]

Extends two mounted state modules at the same path into one with merged schemas.

Extends two mounted state modules at the same path into one with merged schemas.

The merged module tries the first reducer, and on failure falls back to the second.

Type parameters

F

the effect type

Value parameters

a

the first state module

b

the second state module

Attributes

Returns

a merged state module with combined schemas and transactions

Source
StateModule.scala
def mount[Path <: Tuple](blueprint: ModuleBlueprint[_[_], _, _, _, _])(using monad: Monad[blueprint.EffectType], prefixFreePath: PrefixFreePath[Path, blueprint.OwnsType], nodeStore: NodeStore[blueprint.EffectType], schemaMapper: SchemaMapper[blueprint.EffectType, Path, blueprint.OwnsType]): StateModule[blueprint.EffectType, Path, blueprint.OwnsType, blueprint.NeedsType, blueprint.TxsType, StateReducer[blueprint.EffectType, Path, blueprint.OwnsType, blueprint.NeedsType]]

Mount a single-module blueprint at a specific path, creating a StateModule.

Mount a single-module blueprint at a specific path, creating a StateModule.

This is the key operation in Phase 2: it takes a path-independent ModuleBlueprint and binds it to a concrete path, computing table prefixes and creating usable table instances.

The mounting process:

  1. Computes the prefix for each owned table: encodePath(Path) ++ encodeSegment(TableName) 2. Creates fresh StateTable instances bound to these prefixes 3. Wraps the reducer (StateReducer0) to create a path-aware StateReducer

Each mount produces a completely independent set of tables, ensuring that mounting the same blueprint at different paths results in isolated keyspaces.

Phase 5.5 update: Mounts Owns tables, passes through TablesProvider for Needs.

Type inference: Only Path needs to be specified explicitly. All other types (F, MName, Owns, Needs, Txs) are inferred from the blueprint parameter.

Type parameters

Path

the mount path (only type parameter that needs explicit specification)

Value parameters

blueprint

the module blueprint to mount

monad

the Monad instance for F (used by SchemaMapper derivation)

nodeStore

the MerkleTrie node store (used by SchemaMapper derivation)

prefixFreePath

evidence that the path+owns combination is prefix-free

schemaMapper

the schema mapper for instantiating owned tables

Attributes

Returns

a mounted state module with path-bound tables

Source
StateModule.scala
def mountComposed[Path <: Tuple](blueprint: ComposedBlueprint[_[_], _, _, _, _])(using monad: Monad[blueprint.EffectType], prefixFreePath: PrefixFreePath[Path, blueprint.OwnsType], nodeStore: NodeStore[blueprint.EffectType], schemaMapper: SchemaMapper[blueprint.EffectType, Path, blueprint.OwnsType]): StateModule[blueprint.EffectType, Path, blueprint.OwnsType, blueprint.NeedsType, blueprint.TxsType, RoutedStateReducer[blueprint.EffectType, Path, blueprint.OwnsType, blueprint.NeedsType]]

Mount a composed blueprint at a specific path, creating a StateModule with a RoutedStateReducer.

Mount a composed blueprint at a specific path, creating a StateModule with a RoutedStateReducer.

Similar to mount but for composed blueprints that require ModuleRoutedTx for transaction routing.

Type parameters

Path

the mount path (only type parameter that needs explicit specification)

Value parameters

blueprint

the composed blueprint to mount

Attributes

Returns

a mounted state module with a routed reducer

Source
StateModule.scala