Juvix imports
module arch.node.engines.pub_sub_topic_messages;
import arch.node.engines.net_registry_messages open;
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;
Pub/Sub Topic Messages¶
These are the messages that the Pub/Sub Topic engine can receive/respond to.
Message interface¶
type PubSubTopicMsg :=
| PubSubTopicMsgForward TopicMsg
| PubSubTopicMsgSubRequest TopicSubRequest
| PubSubTopicMsgSubReply TopicSubReply
| PubSubTopicMsgUnsubRequest TopicUnsubRequest
| PubSubTopicMsgUnsubReply TopicUnsubReply;
Message types¶
TopicMsg¶
A message published in a topic by an authorized publisher, forwarded to the local node.
type TopicMsg :=
mkTopicMsg@{
publisher : PublisherID;
seq : Nat;
deps : List TopicMsgID;
seen : List TopicMsgID;
content : TopicMsgContent;
sig : Commitment;
};
Arguments
publisher- Publisher identity.
seq- Per-publisher sequence number.
deps- Earlier messages this message depends on.
seen- Independent messages recently seen.
content:- Encrypted
TopicMsg. sig- Signature by
publisherover the topic ID and the above fields.
TopicMsgContent¶
type TopicMsgContent :=
| TopicMsgContentMsg ByteString
| TopicMsgContentChunk (Pair ByteString Chunk)
| TopicMsgContentChunkRef (Pair ByteString ChunkCommitment)
| TopicMsgContentAck TopicMsgAck;
TopicMsgContent constructors
TopicMsgContentMsg- Encrypted
TopicMsg. TopicMsgContentChunk- Chunk of an object. Pair of an encrypted
SecretKeyand aChunk. TopicMsgContentChunkRef- Reference to the root chunk of an object. Pair of an encrypted
SecretKeyand aChunkCommitment. TopicMsgContentAck- Acknowledgement of a
TopicMsg.
TopicMsgAck¶
Acknowledgement of a TopicMsg with commitment to store it until the specified
expiry date.
type TopicMsgAck :=
mkTopicMsgAck@{
expiry : AbsTime;
};
Arguments
expiry- Expiry date and time until the node commits to store the event.
TopicSubRequest¶
Pub/sub topic subscription request by a local engine or a remote node.
type TopicSubRequest :=
mkTopicSubRequest@{
topic : TopicID;
};
TopicSubReply¶
Reply to a TopicSubRequest.
Auxiliary type
TopicSubReplyOk¶
Subscription successful.
type TopicSubReplyOk := | TopicSubReplyOkSuccess;
TopicSubReplyError¶
Subscription failed.
type TopicSubReplyError := | TopicSubReplyErrorDenied;
TopicSubReply : Type := Result TopicSubReplyOk TopicSubReplyError;
TopicUnsubRequest¶
Pub/sub topic unsubscription request by a local engine or a remote node.
type TopicUnsubRequest :=
mkTopicUnsubRequest@{
topic : TopicID;
};
TopicUnsubReply¶
Unsubscription successful.
Auxiliary type
TopicUnsubReplyOk¶
type TopicUnsubReplyOk := | TopicUnsubReplyOkSuccess;
TopicUnsubReplyError¶
Unsubscription failed.
type TopicUnsubReplyError := | TopicUnsubReplyErrorNotSubscribed;
TopicUnsubReply : Type := Result TopicUnsubReplyOk TopicUnsubReplyError;
PubSubTopicMsg¶
All pub/sub topic messages.
type PubSubTopicMsg :=
| PubSubTopicMsgForward TopicMsg
| PubSubTopicMsgSubRequest TopicSubRequest
| PubSubTopicMsgSubReply TopicSubReply
| PubSubTopicMsgUnsubRequest TopicUnsubRequest
| PubSubTopicMsgUnsubReply TopicUnsubReply;