Juvix imports
module arch.node.engines.shard_messages;
import prelude open;
import arch.node.types.basics open;
import arch.node.types.identities open;
Shard Messages¶
These are the messages that the Shard engine can receive/respond to.
Message interface¶
ShardMsgKVSReadRequest KVSReadRequestMsg¶
Read request from an Executor Engine.
type KVSReadRequestMsg : Type :=
mkKVSReadRequestMsg@{
timestamp : TxFingerprint;
key : KVSKey;
actual : Bool;
};
Arguments
timestamp- The logical timestamp identifying the transaction at which to read
key- The key to read
actual- True if value is actually needed, false if just cleaning up a lazy read
ShardMsgKVSWrite KVSWriteMsg¶
Write request from an Executor Engine.
type KVSWriteMsg : Type :=
mkKVSWriteMsg@{
timestamp : TxFingerprint;
key : KVSKey;
datum : Option KVSDatum;
};
Arguments
timestamp- The logical timestamp identifying the transaction in which to write
key- The key to write to
datum- The data to write, or
noneto indicate no write
ShardMsgUpdateSeenAll UpdateSeenAllMsg¶
Update about seen transactions from a Mempool Worker Engine.
type UpdateSeenAllMsg : Type :=
mkUpdateSeenAllMsg@{
timestamp : TxFingerprint;
write : Bool;
};
Arguments
timestamp- The logical timestamp at which to push the SeenAll value.
write- Whether it is the
SeenAllReadsorSeenAllWritesto update.
ShardMsgKVSAcquireLock KVSAcquireLockMsg¶
Request to acquire locks for transaction execution.
type KVSAcquireLockMsg : Type :=
mkKVSAcquireLockMsg@{
lazy_read_keys : Set KVSKey;
eager_read_keys : Set KVSKey;
will_write_keys : Set KVSKey;
may_write_keys : Set KVSKey;
worker : EngineID;
executor : EngineID;
timestamp : TxFingerprint;
};
Arguments
lazy_read_keys- Keys this transaction may read (only send values read in response to
KVSReadRequests) eager_read_keys- Keys this transaction will read (send values read as soon as possible)
will_write_keys- Keys this transaction will write
may_write_keys- Keys this transaction may write
worker- The Worker Engine in charge of the transaction
executor- The Executor for this transaction
timestamp- Specifies the transaction affiliated with these locks
ShardMsgKVSLockAcquired KVSLockAcquiredMsg¶
Confirmation that locks were acquired.
type KVSLockAcquiredMsg : Type :=
mkKVSLockAcquiredMsg@{timestamp : TxFingerprint};
Arguments
timestamp- The timestamp of the transaction which was locked.
ShardMsgKVSRead KVSReadMsg¶
Value read response to executor.
type KVSReadMsg : Type :=
mkKVSReadMsg@{
timestamp : TxFingerprint;
key : KVSKey;
data : KVSDatum;
};
Arguments
timestamp- The timestamp of the transaction which was read.
key- The key which was read.
data- The the data read.
ShardMsg¶
type ShardMsg :=
| ShardMsgKVSReadRequest KVSReadRequestMsg
| ShardMsgKVSWrite KVSWriteMsg
| ShardMsgKVSAcquireLock KVSAcquireLockMsg
| ShardMsgKVSLockAcquired KVSLockAcquiredMsg
| ShardMsgKVSRead KVSReadMsg
| ShardMsgUpdateSeenAll UpdateSeenAllMsg;
Sequence Diagrams¶
Transaction Lock and Read Flow¶
sequenceDiagram
participant WorkerEngine
participant Shard
participant Executor
participant Mempool
participant Consensus
WorkerEngine->>Shard: KVSAcquireLock
Shard->>WorkerEngine: KVSLockAcquired
Executor->>Shard: KVSReadRequest
Mempool->>Shard: UpdateSeenAll
Consensus->>Shard: AnchorChosen
Shard->>Executor: KVSRead
Executor->>Shard: KVSWrite