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 Objecttrait Matchableclass Any
- Self type
-
StateTable[F]
Members list
Value members
Abstract methods
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
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
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
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
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
ByteCodec for keys.
ByteCodec for values.