RoutedStateReducer0

org.sigilaris.core.application.module.blueprint.RoutedStateReducer0
trait RoutedStateReducer0[F[_], Owns <: Tuple, Needs <: Tuple]

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
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def apply[T <: Tx & ModuleRoutedTx](signedTx: Signed[T])(using requiresReads: Requires[signedTx.value.Reads, Concat[Owns, Needs]], requiresWrites: Requires[signedTx.value.Writes, Concat[Owns, Needs]], ownsTables: Tables[F, Owns], provider: TablesProvider[F, Needs]): StoreF[F][(signedTx.value.Result, List[signedTx.value.Event])]

Apply a signed routed transaction to produce a result and events.

Apply a signed routed transaction to produce a result and events.

ADR-0012: All transactions must be wrapped in Signed[T] to ensure cryptographic signatures are present at compile time.

The type bound T <: Tx & ModuleRoutedTx ensures that only transactions implementing ModuleRoutedTx can be applied. This is enforced at compile time.

Type parameters

T

the transaction type (must implement ModuleRoutedTx)

Value parameters

ownsTables

the owned tables

provider

the provider for needed external tables

requiresReads

evidence that T's read requirements are in Owns ++ Needs

requiresWrites

evidence that T's write requirements are in Owns ++ Needs

signedTx

the signed transaction to apply (ADR-0012)

Attributes

Returns

a stateful computation returning the result and list of events

Source
Blueprint.scala