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

Auxiliary Juvix code

syntax alias StorageKey := String;

syntax alias StorageValue := String;

syntax alias EpochTimestamp := Nat;

GetValueKVStoreRequest 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.

GetValueKVStoreResponse GetValueKVStoreResponse

Response containing requested value.

type GetValueKVStoreResponse :=
mkGetValueKVStoreResponse@{
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 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.

SetValueKVStoreResponse SetValueKVStoreResponse

Response indicating success/failure of set operation.

type SetValueKVStoreResponse :=
mkSetValueKVStoreResponse@{
key : StorageKey;
success : Bool;
};

DeleteValueKVStoreRequest DeleteValueKVStoreRequest

Request to delete a value from storage.

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

DeleteValueKVStoreResponse DeleteValueKVStoreResponse

Response indicating success/failure of a delete operation.

type DeleteValueKVStoreResponse :=
mkDeleteValueKVStoreResponse@{
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
| LocalKVStorageMsgGetValueResponse GetValueKVStoreResponse
| LocalKVStorageMsgSetValueRequest SetValueKVStoreRequest
| LocalKVStorageMsgSetValueResponse SetValueKVStoreResponse
| LocalKVStorageMsgDeleteValueRequest DeleteValueKVStoreRequest
| LocalKVStorageMsgDeleteValueResponse DeleteValueKVStoreResponse
| LocalKVStorageMsgValueChanged ValueChangedKVStore;

Sequence Diagrams

Get Value Request/Response Flow

sequenceDiagram
    participant Client
    participant KVStorage

    Client ->>+ KVStorage: GetValueKVStoreRequest
    KVStorage -->>- Client: GetValueKVStoreResponse
Get Value Request/Response Flow

Set Value Request/Response Flow

sequenceDiagram
    participant Client
    participant KVStorage

    Client ->>+ KVStorage: SetValueKVStoreRequest
    KVStorage -->>- Client: SetValueKVStoreResponse
Set Value Request/Response Flow

Delete Value Request/Response Flow

sequenceDiagram
    participant Client
    participant KVStorage

    Client ->>+ KVStorage: DeleteValueKVStoreRequest
    KVStorage -->>- Client: DeleteValueKVStoreResponse
Delete Value Request/Response Flow