Juvix imports
module arch.node.engines.storage_messages;
import arch.node.types.storage open;
import arch.node.types.basics open;
import arch.node.types.crypto open;
import arch.node.types.identities open;
import arch.node.types.messages open;
Storage Engine¶
Message interface¶
type StorageMsg :=
| StorageMsgChunkGetRequest ChunkGetRequest
| StorageMsgChunkGetReply ChunkGetReply
| StorageMsgChunkPutRequest Chunk
| StorageMsgChunkPutReply ChunkPutReply;
Message sequence diagrams¶
Storage message sequence diagram¶
Message types¶
ChunkGetRequest
¶
Request for a chunk of an object.
Source: any local engine or remote Storage engine.
type ChunkGetRequest :=
mkChunkRequest@{
chunk : ChunkID;
children : Either Bool Nat;
};
Arguments
chunk
- Chunk ID
children
- Request children recursively:
- False
: none,
- True
: all,
- Nat
: up to nth level.
ChunkGetReply
¶
Reply to a ChunkGetRequest
.
Auxiliary type
ChunkGetReplyOk
¶
Chunk found.
When available, the chunk contents are returned, otherwise a list of commitments by nodes that store the chunk.
type ChunkGetReplyOk :=
| ChunkGetReplyOkContent Chunk
| ChunkGetReplyOkCommitment (Set ChunkCommitment);
ChunkGetReplyOk
constructors
ChunkGetReplyOkContent
- Reply with chunk content.
ChunkGetReplyOkCommitment
- Reply with a set of known storage commitments.
Each such commitment contains a
NodeID
that stores the chunk until the time specified. To retrieve the chunk, the requestor should issue anotherChunkGetRequest
to one of these nodes, trying them in the order of most recently successfully contacted.
ChunkGetReplyError
¶
Chunk not found.
type ChunkGetReplyError := | ChunkGetReplyErrorNotFound;
ChunkGetReply : Type := Result ChunkGetReplyOk ChunkGetReplyError;
ChunkPutRequest
¶
Request to store a chunk. May be restricted to local engines.
Auxiliary type
ChunkPutRequestOk
¶
Request to store a chunk.
type ChunkPutRequestOk := | ChunkPutRequestOkSuccess;
ChunkPutReplyOk
¶
Chunk stored successfully or already exists.
type ChunkPutReplyOk :=
| ChunkPutReplyOkStored
| ChunkPutReplyOkExists;
ChunkPutReplyError
¶
Failed to store chunk.
type ChunkPutReplyError := | ChunkPutReplyErrorFailed;
ChunkPutReply : Type := Result ChunkPutReplyOk ChunkPutReplyError;
StorageMsg
¶
All storage protocol messages.
type StorageMsg :=
| StorageMsgChunkGetRequest ChunkGetRequest
| StorageMsgChunkGetReply ChunkGetReply
| StorageMsgChunkPutRequest Chunk
| StorageMsgChunkPutReply ChunkPutReply;