Juvix imports
module arch.node.net.pub_sub_topic_messages;
import arch.node.net.router_types open;
import arch.node.net.storage_types 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 PubSubTopic engine can receive/respond to.
Message interface¶
PubSubTopicMsgForward TopicMsg
¶
A message published in a topic by an authorized publisher, forwarded to the local node.
TopicMsgID
¶
syntax alias TopicMsgID := Digest;
TopicMsg
¶
type TopicMsg :=
mkTopicMsg@{
publisher : PublisherID;
seq : Nat;
deps : List TopicMsgID;
seen : List TopicMsgID;
content : TopicMsgContent;
sig : Commitment;
};
publisher
- Publisher identity.
seq
- Per-publisher sequence number.
deps
- Earlier messages this message depends on.
seen
- Independent messages recently seen.
msg
:- Encrypted
TopicMsg
. sig
- Signature by
publisher
over the topic ID and the above fields.
TopicMsgContent
¶
type TopicMsgContent :=
| TopicMsgContentMsg ByteString
| TopicMsgContentChunk (Pair ByteString Chunk)
| TopicMsgContentChunkRef (Pair ByteString ChunkCommitment)
| TopicMsgContentAck TopicMsgAck;
TopicMsgContentMsg
- Encrypted
TopicMsg
. TopicMsgContentChunk
- Chunk of an object.
Pair of an encrypted
SecretKey
and aChunk
. TopicMsgContentChunkRef
- Reference to the root chunk of an object.
Pair of an encrypted
SecretKey
and 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};
expiry
- Expiry date and time until the node commits to store the event.
PubSubTopicSubRequest
¶
Pub/sub topic subscription request by a local engine or a remote node.
type TopicSubRequest := mkTopicSubRequest@{topic : TopicID};
PubSubTopicSubReply
¶
Reply to a TopicSubRequest
.
TopicSubReplyOk
¶
Subscription successful.
type TopicSubReplyOk := TopicSubReplyOkSuccess;
TopicSubReplyError
¶
Subscription failed.
type TopicSubReplyError := TopicSubReplyErrorDenied;
TopicSubReply
¶
TopicSubReply : Type := Result TopicSubReplyOk TopicSubReplyError;
PubSubTopicUnsubRequest
¶
Pub/sub topic unsubscription request by a local engine or a remote node.
type TopicUnsubRequest := mkTopicUnsubRequest@{topic : TopicID};
PubSubTopicUnsubReply
¶
Reply to a TopicUnsubRequest
TopicUnsubReplyOk
¶
Unsubscription successful.
type TopicUnsubReplyOk := TopicUnsubReplyOkSuccess;
TopicUnsubReplyError
¶
Unsubscription failed.
type TopicUnsubReplyError := TopicUnsubReplyErrorNotSubscribed;
TopicUnsubReply
¶
TopicUnsubReply : Type := Result TopicUnsubReplyOk TopicUnsubReplyError;
PubSubTopicMsg
¶
All pub/sub topic messages.
type PubSubTopicMsg :=
| PubSubTopicMsgForward TopicMsg
| PubSubTopicMsgSubRequest TopicSubRequest
| PubSubTopicMsgSubReply TopicSubReply
| PubSubTopicMsgUnsubRequest TopicUnsubRequest
| PubSubTopicMsgUnsubReply TopicUnsubReply;