org.sigilaris.core.application.state

Members list

Type members

Classlikes

final case class AccessLog(reads: Map[ByteVector, Set[ByteVector]], writes: Map[ByteVector, Set[ByteVector]])

Access log for tracking transaction reads and writes.

Access log for tracking transaction reads and writes.

Phase 8: AccessLog accumulates all read and write operations performed by a transaction, enabling efficient conflict detection between concurrent transactions.

The log maps table identifiers (byte prefixes) to sets of accessed keys (full byte keys including prefix). This byte-level approach ensures correct conflict detection across different table types.

ADR-0009 Phase 8 requirements:

  • Store table identifier (path + table name encoded as bytes)
  • Store accessed keys (full key bytes including table prefix)
  • Support conflict detection predicates (W∩W, R∩W)
  • Provide size control options for memory management

Value parameters

reads

map from table prefix to set of read key bytes

writes

map from table prefix to set of written key bytes

Attributes

Companion
object
Source
AccessLog.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object AccessLog

Attributes

Companion
class
Source
AccessLog.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
AccessLog.type
final class Entry[Name <: String, K, V](val tableName: Name)(using val kCodec: ByteCodec[K], val vCodec: ByteCodec[V])

Schema entry defining a table's name and key-value types.

Schema entry defining a table's name and key-value types.

This is both a compile-time marker for type-level schema definitions and a runtime value that can create StateTable instances.

Each Entry requires ByteCodec instances for both key and value types.

Type parameters

K

the key type

Name

the table name (literal String type)

V

the value type

Attributes

Companion
object
Source
StateTypes.scala
Supertypes
class Object
trait Matchable
class Any
object Entry

Attributes

Companion
class
Source
StateTypes.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Entry.type
object KeyOf

Attributes

Source
StateTypes.scala
Supertypes
class Object
trait Matchable
class Any
Self type
KeyOf.type
trait StateTable[F[_]]

State table providing key-value storage with compile-time key safety.

State table providing key-value storage with compile-time key safety.

A StateTable is path-independent - it knows only its schema (name, key type, value type, and codecs). The actual storage location (path/prefix) is determined when the table is mounted into a module.

Key safety is enforced via instance branding: keys are branded with the table's singleton type (self.type), preventing keys from different tables from being mixed at compile time with zero runtime overhead.

Type parameters

F

the effect type

Attributes

Companion
object
Source
StateTable.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object StateTable

Attributes

Companion
trait
Source
StateTable.scala
Supertypes
class Object
trait Matchable
class Any
Self type
StateTable.type
object StoreF

Attributes

Source
StateTypes.scala
Supertypes
class Object
trait Matchable
class Any
Self type
StoreF.type
final case class StoreState(trieState: MerkleTrieState, accessLog: AccessLog)

Combined state for blockchain storage and access logging.

Combined state for blockchain storage and access logging.

Phase 8: Extends MerkleTrieState with AccessLog to track all read/write operations performed during transaction execution.

Value parameters

accessLog

the accumulated access log

trieState

the Merkle trie state

Attributes

Companion
object
Source
StateTypes.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object StoreState

Attributes

Companion
class
Source
StateTypes.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
StoreState.type

Types

type Eff[F[_]] = [_] =>> EitherT[F, SigilarisFailure, _$2]

Effect type for blockchain operations.

Effect type for blockchain operations.

Wraps an underlying effect F with error handling via EitherT.

Type parameters

F

the base effect type

Attributes

Source
StateTypes.scala
type EntryTuple[N <: String, K, V] = Entry[N, K, V] *: EmptyTuple

Type alias for a single-entry schema tuple.

Type alias for a single-entry schema tuple.

Simplifies common pattern Entry["name", K, V] *: EmptyTuple to EntryTuple["name", K, V].

Type parameters

K

the key type

N

the table name

V

the value type

Attributes

Source
Tables.scala
opaque type KeyOf[Brand, A]

Zero-cost key branding to prevent keys from different tables being mixed.

Zero-cost key branding to prevent keys from different tables being mixed.

Brand is typically the table instance's singleton type (self.type), ensuring compile-time safety with no runtime overhead.

Type parameters

A

the underlying key type

Brand

the phantom type used for branding (usually table instance type)

Attributes

Source
StateTypes.scala
type Path[S <: String] = S *: EmptyTuple

Type alias for a single-element string tuple.

Type alias for a single-element string tuple.

Simplifies common pattern "name" *: EmptyTuple to Path["name"].

Type parameters

S

the string literal type

Attributes

Source
Tables.scala
type Path2[S1 <: String, S2 <: String] = S1 *: S2 *: EmptyTuple

Type alias for a two-element string tuple.

Type alias for a two-element string tuple.

Simplifies common pattern "s1" *: "s2" *: EmptyTuple to Path2["s1", "s2"].

Type parameters

S1

the first string literal type

S2

the second string literal type

Attributes

Source
Tables.scala
type StoreF[F[_]] = [_] =>> StateT[Eff[F], StoreState, _$4]

State effect type for blockchain storage operations.

State effect type for blockchain storage operations.

Phase 8 update: Now operates over StoreState (MerkleTrieState + AccessLog) instead of just MerkleTrieState, enabling automatic access logging and conflict detection.

Type parameters

F

the base effect type

Attributes

Source
StateTypes.scala
type TableOf[F[_], E] = E match { case Entry[name, k, v] => StateTable[F] { type Name = name; type K = k; type V = v; } }

Type-level mapping from an Entry to its corresponding StateTable type.

Type-level mapping from an Entry to its corresponding StateTable type.

This match type converts schema entries (Entry[Name, K, V]) into their runtime StateTable implementations with matching type parameters.

Type parameters

E

the entry type

F

the effect type

Attributes

Source
Tables.scala
type Tables[F[_], Schema <: Tuple] = Map[Schema, [E] =>> TableOf[F, E]]

Type-level mapping from a schema tuple to a tuple of StateTables.

Type-level mapping from a schema tuple to a tuple of StateTables.

Applies TableOf to each entry in the schema tuple, producing a tuple of corresponding StateTable instances.

Example:

 type Schema = (Entry["users", String, User], Entry["posts", String, Post])
 type Result = Tables[IO, Schema]
 // Result = (StateTable[IO]{Name="users", K=String, V=User},
 //           StateTable[IO]{Name="posts", K=String, V=Post})

Type parameters

F

the effect type

Schema

the schema tuple (tuple of Entry types)

Attributes

Source
Tables.scala