org.sigilaris.core.application.module.blueprint

Members list

Type members

Classlikes

sealed trait Blueprint[F[_], MName <: String, Owns <: Tuple, Needs <: Tuple, Txs <: Tuple, +R]

Base trait for blueprints (path-independent).

Base trait for blueprints (path-independent).

A blueprint is a module specification without a concrete deployment path. The base trait is covariant in the reducer type, allowing both single-module blueprints (StateReducer0) and composed blueprints (RoutedStateReducer0) to be treated uniformly where appropriate.

Phase 5.5 update: Schema is now split into Owns and Needs:

  • Owns: tables that this module owns and will create
  • Needs: tables that this module needs from external providers
  • Deps is replaced by TablesProvider[F, Needs]

Type parameters

F

the effect type

MName

the module name (literal String type)

Needs

the needed schema tuple (tuple of Entry types)

Owns

the owned schema tuple (tuple of Entry types)

R

the reducer type (covariant)

Txs

the transaction types tuple

Attributes

Companion
object
Source
Blueprint.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ComposedBlueprint[F, MName, Owns, Needs, Txs]
class ModuleBlueprint[F, MName, Owns, Needs, Txs]
object Blueprint

Companion for Blueprint, providing composition and mounting operations.

Companion for Blueprint, providing composition and mounting operations.

Attributes

Companion
trait
Source
Blueprint.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Blueprint.type
final class ComposedBlueprint[F[_], MName <: String, Owns <: Tuple, Needs <: Tuple, Txs <: Tuple](val owns: Owns, val reducer0: RoutedStateReducer0[F, Owns, Needs], val txs: TxRegistry[Txs], val provider: TablesProvider[F, Needs], val routeHeads: List[String])(using val uniqueNames: UniqueNames[Owns], val moduleValue: ValueOf[MName]) extends Blueprint[F, MName, Owns, Needs, Txs, RoutedStateReducer0[F, Owns, Needs]]

Composed blueprint (path-independent).

Composed blueprint (path-independent).

A composed blueprint is the result of combining two or more module blueprints. It uses RoutedStateReducer0, which REQUIRES all transactions to implement ModuleRoutedTx for routing purposes.

The type system enforces this requirement at compile time: attempting to apply a non-routed transaction to a ComposedBlueprint's reducer will be a compile error.

Phase 5.5 update: Now explicitly models Owns and Needs like ModuleBlueprint.

Type parameters

F

the effect type

MName

the module name (literal String type)

Needs

the needed schema tuple (tuple of Entry types)

Owns

the owned schema tuple (tuple of Entry types)

Txs

the transaction types tuple

Value parameters

owns

the Entry instances for owned tables (runtime values)

provider

the tables provider for needed external tables

reducer0

the routed reducer (requires ModuleRoutedTx)

txs

the transaction registry

uniqueNames

evidence that table names are unique within Owns

Attributes

Source
Blueprint.scala
Supertypes
trait Blueprint[F, MName, Owns, Needs, Txs, RoutedStateReducer0[F, Owns, Needs]]
class Object
trait Matchable
class Any
final class ModuleBlueprint[F[_], MName <: String, Owns <: Tuple, Needs <: Tuple, Txs <: Tuple](val owns: Owns, val reducer0: StateReducer0[F, Owns, Needs], val txs: TxRegistry[Txs], val provider: TablesProvider[F, Needs])(using val uniqueNames: UniqueNames[Owns], val moduleValue: ValueOf[MName]) extends Blueprint[F, MName, Owns, Needs, Txs, StateReducer0[F, Owns, Needs]]

Single-module blueprint (path-independent).

Single-module blueprint (path-independent).

A module blueprint is a specification for a single, self-contained module. It uses StateReducer0, which can process any transaction type (T <: Tx) that satisfies the schema requirements.

Module blueprints are designed with the assumption that they don't know where they will be deployed. The mounting process (Phase 2) binds a blueprint to a specific Path, computing prefixes and using Entry instances to create concrete StateTable instances.

IMPORTANT: Blueprint contains Entry instances (runtime values), not StateTable instances. Each Entry can create a StateTable when given a prefix.

Phase 5.5 update: Now explicitly models Owns and Needs:

  • owns: Entry tuple for tables this module will create
  • provider: TablesProvider for external tables this module needs
  • reducer0: operates on Owns ++ Needs combined schema

Type parameters

F

the effect type

MName

the module name (literal String type)

Needs

the needed schema tuple (tuple of Entry types)

Owns

the owned schema tuple (tuple of Entry types)

Txs

the transaction types tuple

Value parameters

owns

the Entry instances for owned tables (runtime values)

provider

the tables provider for needed external tables

reducer0

the path-agnostic reducer (accepts any Tx)

txs

the transaction registry

uniqueNames

evidence that table names are unique within Owns

Attributes

Source
Blueprint.scala
Supertypes
trait Blueprint[F, MName, Owns, Needs, Txs, StateReducer0[F, Owns, Needs]]
class Object
trait Matchable
class Any
trait RoutedStateReducer0[F[_], Owns <: Tuple, Needs <: Tuple]

Routed state reducer requiring ModuleRoutedTx.

Routed state reducer requiring ModuleRoutedTx.

This is a wrapper that implements StateReducer0 but only works correctly with transactions that implement ModuleRoutedTx. It is used in composed blueprints where routing based on module path is required.

The user is expected to only pass ModuleRoutedTx transactions to composed blueprints. Non-routed transactions will fail at runtime with a cast exception, which is acceptable since the API contract (composition) requires routing.

Phase 5.5 update: Like StateReducer0, now explicitly models Owns and Needs.

Type parameters

F

the effect type

Needs

the needed schema tuple (tuple of Entry types)

Owns

the owned schema tuple (tuple of Entry types)

Attributes

Source
Blueprint.scala
Supertypes
class Object
trait Matchable
class Any

Helper object for convenient access to schema instantiation.

Helper object for convenient access to schema instantiation.

Attributes

Source
SchemaInstantiation.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait SchemaMapper[F[_], Path <: Tuple, Schema <: Tuple]

Typeclass for instantiating tables from Entry instances.

Typeclass for instantiating tables from Entry instances.

This uses the typeclass derivation pattern to avoid inline match issues with abstract type parameters. Given instances are automatically derived for EmptyTuple and cons cases at compile time.

Type parameters

F

the effect type

Path

the mount path tuple

Schema

the schema tuple type

Attributes

Companion
object
Source
SchemaInstantiation.scala
Supertypes
class Object
trait Matchable
class Any
object SchemaMapper

Companion for SchemaMapper, providing derivation instances for empty and cons schemas.

Companion for SchemaMapper, providing derivation instances for empty and cons schemas.

Attributes

Companion
trait
Source
SchemaInstantiation.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait StateReducer0[F[_], Owns <: Tuple, Needs <: Tuple]

Path-agnostic state reducer.

Path-agnostic state reducer.

A StateReducer0 operates on transactions without knowledge of where it will be mounted. The Path is unknown at this stage - it will be bound when the blueprint is mounted into a StateModule.

This allows writing reusable module logic that can be deployed at different paths in different applications.

Phase 5.5 update: StateReducer0 now explicitly models Owns and Needs:

  • Owns: tables that this module owns (will be created at mount time)
  • Needs: tables that this module needs from external providers
  • Combined schema (Owns ++ Needs) is what transactions operate over

Type parameters

F

the effect type

Needs

the needed schema tuple (tuple of Entry types)

Owns

the owned schema tuple (tuple of Entry types)

Attributes

Source
Blueprint.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class AccountsReducer[F]
class GroupsReducer[F]