StateTable

org.sigilaris.core.application.state.StateTable
See theStateTable companion object
trait StateTable[F[_]]

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

Members list

Type members

Types

type K

The key type.

The key type.

Attributes

Source
StateTable.scala
type Key = KeyOf[this.type, K]

The branded key type, preventing cross-table key confusion.

The branded key type, preventing cross-table key confusion.

Attributes

Source
StateTable.scala
type Name <: String

The table name as a literal String type.

The table name as a literal String type.

Attributes

Source
StateTable.scala
type V

The value type.

The value type.

Attributes

Source
StateTable.scala

Value members

Abstract methods

def get(k: Key): StoreF[F][Option[V]]

Retrieve a value by key.

Retrieve a value by key.

Value parameters

k

the branded key

Attributes

Returns

a stateful computation returning Some(value) if found, None otherwise

Source
StateTable.scala
def name: Name

The table name as a runtime String value.

The table name as a runtime String value.

Used for prefix computation when the table is mounted into a module.

Attributes

Source
StateTable.scala
def put(k: Key, v: V): StoreF[F][Unit]

Insert or update a key-value pair.

Insert or update a key-value pair.

Value parameters

k

the branded key

v

the value

Attributes

Returns

a stateful computation returning Unit

Source
StateTable.scala
def remove(k: Key): StoreF[F][Boolean]

Remove a key-value pair.

Remove a key-value pair.

Value parameters

k

the branded key

Attributes

Returns

a stateful computation returning true if the key existed, false otherwise

Source
StateTable.scala

Concrete methods

inline def brand(k: K): Key

Brand an unbranded key with this table's instance type.

Brand an unbranded key with this table's instance type.

Value parameters

k

the unbranded key

Attributes

Returns

the branded key

Source
StateTable.scala

Givens

Givens

given kCodec: ByteCodec[K]

ByteCodec for keys.

ByteCodec for keys.

Attributes

Source
StateTable.scala
given vCodec: ByteCodec[V]

ByteCodec for values.

ByteCodec for values.

Attributes

Source
StateTable.scala