Skip to content
Juvix imports

module arch.node.engines.local_key_value_storage_messages;

import prelude open;

Local Key-Value Storage Messages

These are the messages that the Local Key-Value Storage engine can receive/respond to.

Message interface

type LocalKVStorageMsg :=
| LocalKVStorageMsgGetValueRequest GetValueKVStoreRequest
| LocalKVStorageMsgGetValueReply GetValueKVStoreReply
| LocalKVStorageMsgSetValueRequest SetValueKVStoreRequest
| LocalKVStorageMsgSetValueReply SetValueKVStoreReply
| LocalKVStorageMsgDeleteValueRequest DeleteValueKVStoreRequest
| LocalKVStorageMsgDeleteValueReply DeleteValueKVStoreReply
| LocalKVStorageMsgValueChanged ValueChangedKVStore;

Message sequence diagrams

Get value request/response flow

sequenceDiagram
    participant Client
    participant KVStorage

    Client ->>+ KVStorage: GetValueKVStoreRequest
    KVStorage -->>- Client: GetValueKVStoreReply
Get Value Request/Reply Flow

Set value request/response flow

sequenceDiagram
    participant Client
    participant KVStorage

    Client ->>+ KVStorage: SetValueKVStoreRequest
    KVStorage -->>- Client: SetValueKVStoreReply
Set Value Request/Reply Flow

Delete value request/response flow

sequenceDiagram
    participant Client
    participant KVStorage

    Client ->>+ KVStorage: DeleteValueKVStoreRequest
    KVStorage -->>- Client: DeleteValueKVStoreReply
Delete Value Request/Reply Flow

Message types

Auxiliary Juvix code

syntax alias StorageKey := String;

syntax alias StorageValue := String;

syntax alias EpochTimestamp := Nat;

GetValueKVStoreRequest

Request to get a value from storage.

type GetValueKVStoreRequest :=
mkGetValueKVStoreRequest@{
key : StorageKey;
};
Arguments
key
The key that maps to the requested value in the KV-store.

GetValueKVStoreReply

Reply containing requested value.

type GetValueKVStoreReply :=
mkGetValueKVStoreReply@{
key : StorageKey;
value : StorageValue;
};
Arguments
key
The key that maps to the requested value in the KV-store.
value
The requested value from the KV-store.

SetValueKVStoreRequest

Request to set a value in storage.

type SetValueKVStoreRequest :=
mkSetValueKVStoreRequest@{
key : StorageKey;
value : StorageValue;
};
Arguments
key
The key that identifies the data in the KV-store.
value
The value to store in the KV-store.

SetValueKVStoreReply

Reply indicating success/failure of set operation.

type SetValueKVStoreReply :=
mkSetValueKVStoreReply@{
key : StorageKey;
success : Bool;
};

DeleteValueKVStoreRequest

Request to delete a value from storage.

type DeleteValueKVStoreRequest :=
mkDeleteValueKVStoreRequest@{
key : StorageKey;
};

DeleteValueKVStoreReply

Reply indicating success/failure of a delete operation.

type DeleteValueKVStoreReply :=
mkDeleteValueKVStoreReply@{
key : StorageKey;
success : Bool;
};

ValueChangedKVStore

Notification that a value has changed.

type ValueChangedKVStore :=
mkValueChangedKVStore@{
key : StorageKey;
value : StorageValue;
timestamp : EpochTimestamp;
};

LocalKVStorageMsg

type LocalKVStorageMsg :=
| LocalKVStorageMsgGetValueRequest GetValueKVStoreRequest
| LocalKVStorageMsgGetValueReply GetValueKVStoreReply
| LocalKVStorageMsgSetValueRequest SetValueKVStoreRequest
| LocalKVStorageMsgSetValueReply SetValueKVStoreReply
| LocalKVStorageMsgDeleteValueRequest DeleteValueKVStoreRequest
| LocalKVStorageMsgDeleteValueReply DeleteValueKVStoreReply
| LocalKVStorageMsgValueChanged ValueChangedKVStore;

Engine components