Skip to content

Commit 08b363d

Browse files
authored
Update SDS.md: Remove Errors (#115)
Remove markdown error from the SDS rfc.
1 parent 2b297d5 commit 08b363d

File tree

1 file changed

+92
-45
lines changed

1 file changed

+92
-45
lines changed

vac/raw/sds.md

Lines changed: 92 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,30 @@ contributors:
99

1010
## Abstract
1111

12-
This specification introduces the Scalable Data Sync (SDS) protocol to achieve end-to-end reliability
12+
This specification introduces the Scalable Data Sync (SDS) protocol
13+
to achieve end-to-end reliability
1314
when consolidating distributed logs in a decentralized manner.
1415
The protocol is designed for a peer-to-peer (p2p) topology
1516
where an append-only log is maintained by each member of a group of nodes
1617
who may individually append new entries to their local log at any time and
1718
is interested in merging new entries from other nodes in real-time or close to real-time
1819
while maintaining a consistent order.
1920
The outcome of the log consolidation procedure is
20-
that all nodes in the group eventually reflect in their own logs the same entries in the same order.
21+
that all nodes in the group eventually reflect in their own logs
22+
the same entries in the same order.
2123
The protocol aims to scale to very large groups.
2224

2325
## Motivation
2426

2527
A common application that fits this model is a p2p group chat (or group communication),
2628
where the participants act as log nodes
27-
and the group conversation is modelled as the consolidated logs maintained on each node.
29+
and the group conversation is modelled as the consolidated logs
30+
maintained on each node.
2831
The problem of end-to-end reliability can then be stated as
2932
ensuring that all participants eventually see the same sequence of messages
3033
in the same causal order,
31-
despite the challenges of network latency, message loss, and scalability present in any communications transport layer.
34+
despite the challenges of network latency, message loss,
35+
and scalability present in any communications transport layer.
3236
The rest of this document will assume the terminology of a group communication:
3337
log nodes being the _participants_ in the group chat
3438
and the logged entries being the _messages_ exchanged between participants.
@@ -39,20 +43,25 @@ We make the following simplifying assumptions for a proposed reliability protoco
3943

4044
* **Broadcast routing:**
4145
Messages are broadcast disseminated by the underlying transport.
42-
The selected transport takes care of routing messages to all participants of the communication.
46+
The selected transport takes care of routing messages
47+
to all participants of the communication.
4348
* **Store nodes:**
44-
There are high-availability caches (a.k.a. Store nodes) from which missed messages can be retrieved.
49+
There are high-availability caches (a.k.a. Store nodes)
50+
from which missed messages can be retrieved.
4551
These caches maintain the full history of all messages that have been broadcast.
4652
This is an optional element in the protocol design,
4753
but improves scalability by reducing direct interactions between participants.
4854
* **Message ID:**
4955
Each message has a globally unique, immutable ID (or hash).
50-
Messages can be requested from the high-availability caches or other participants using the corresponding message ID.
56+
Messages can be requested from the high-availability caches or
57+
other participants using the corresponding message ID.
5158

5259
## Wire protocol
53-
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
60+
61+
The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
5462
“SHOULD NOT”, “RECOMMENDED”, “MAY”, and
5563
“OPTIONAL” in this document are to be interpreted as described in [2119](https://www.ietf.org/rfc/rfc2119.txt).
64+
5665
### Message
5766

5867
Messages MUST adhere to the following meta structure:
@@ -71,33 +80,45 @@ message Message {
7180
}
7281
```
7382

74-
Each message MUST include its globally unique identifier in the `message_id` field, likely based on a message hash.
75-
The `channel_id` field MUST be set to the identifier of the channel of group communication that is being synchronized.
83+
Each message MUST include its globally unique identifier in the `message_id` field,
84+
likely based on a message hash.
85+
The `channel_id` field MUST be set to the identifier of the channel of group communication
86+
that is being synchronized.
7687
For simple group communications without individual channels,
7788
the `channel_id` SHOULD be set to `0`.
78-
The `lamport_timestamp`, `causal_history` and `bloom_filter` fields MUST be set according to the [protocol steps](#protocol-steps) set out below.
89+
The `lamport_timestamp`, `causal_history` and
90+
`bloom_filter` fields MUST be set according to the [protocol steps](#protocol-steps)
91+
set out below.
7992
These fields MAY be left unset in the case of [ephemeral messages](#ephemeral-messages).
8093
The message `content` MAY be left empty for [periodic sync messages](#periodic-sync-message),
8194
otherwise it MUST contain the application-level content
8295

8396
### Participant state
8497

8598
Each participant MUST maintain:
86-
- A Lamport timestamp for each channel of communication,
99+
100+
* A Lamport timestamp for each channel of communication,
87101
initialized to current epoch time in nanosecond resolution.
88-
- A bloom filter for received message IDs per channel.
89-
The bloom filter SHOULD be rolled over and recomputed once it reaches a predefined capacity of message IDs.
90-
Furthermore, it SHOULD be designed to minimize false positives through an optimal selection of size and hash functions.
91-
- A buffer for unacknowledged outgoing messages
92-
- A buffer for incoming messages with unmet causal dependencies
93-
- A local log (or history) for each channel,
102+
* A bloom filter for received message IDs per channel.
103+
The bloom filter SHOULD be rolled over and
104+
recomputed once it reaches a predefined capacity of message IDs.
105+
Furthermore,
106+
it SHOULD be designed to minimize false positives through an optimal selection of
107+
size and hash functions.
108+
* A buffer for unacknowledged outgoing messages
109+
* A buffer for incoming messages with unmet causal dependencies
110+
* A local log (or history) for each channel,
94111
containing all message IDs in the communication channel,
95112
ordered by Lamport timestamp.
96113

97114
Messages in the unacknowledged outgoing buffer can be in one of three states:
98-
1. **Unacknowledged** - there has been no acknowledgement of message receipt by any participant in the channel
99-
2. **Possibly acknowledged** - there has been ambiguous indication that the message has been _possibly_ received by at least one participant in the channel
100-
3. **Acknowledged** - there has been sufficient indication that the message has been received by at least some of the participants in the channel.
115+
116+
1. **Unacknowledged** - there has been no acknowledgement of message receipt
117+
by any participant in the channel
118+
2. **Possibly acknowledged** - there has been ambiguous indication that the message
119+
has been _possibly_ received by at least one participant in the channel
120+
3. **Acknowledged** - there has been sufficient indication that the message
121+
has been received by at least some of the participants in the channel.
101122
This state will also remove the message from the outgoing buffer.
102123

103124
### Protocol Steps
@@ -109,34 +130,45 @@ the `lamport_timestamp`, `causal_history` and `bloom_filter` fields.
109130
#### Send Message
110131

111132
Before broadcasting a message:
112-
- the participant MUST increase its local Lamport timestamp by `1` and include this in the `lamport_timestamp` field.
113-
- the participant MUST determine the preceding few message IDs in the local history and include these in an ordered list in the `causal_history` field.
133+
134+
* the participant MUST increase its local Lamport timestamp by `1` and
135+
include this in the `lamport_timestamp` field.
136+
* the participant MUST determine the preceding few message IDs in the local history
137+
and include these in an ordered list in the `causal_history` field.
114138
The number of message IDs to include in the `causal_history` depends on the application.
115139
We recommend a causal history of two message IDs.
116-
- the participant MUST include the current `bloom_filter` state in the broadcast message.
140+
* the participant MUST include the current `bloom_filter`
141+
state in the broadcast message.
117142

118-
After broadcasting a message, the message MUST be added to the participant’s buffer of unacknowledged outgoing messages.
143+
After broadcasting a message,
144+
the message MUST be added to the participant’s buffer
145+
of unacknowledged outgoing messages.
119146

120147
#### Receive Message
121148

122149
Upon receiving a message,
123-
- the participant MUST [review the ACK status](#review-ack-status) of messages in its unacknowledged outgoing buffer
150+
151+
* the participant MUST [review the ACK status](#review-ack-status) of messages
152+
in its unacknowledged outgoing buffer
124153
using the received message's causal history and bloom filter.
125-
- the participant MUST include the received message ID in its local bloom filter.
126-
- the participant MUST verify that all causal dependencies are met for the received message.
154+
* the participant MUST include the received message ID in its local bloom filter.
155+
* the participant MUST verify that all causal dependencies are met
156+
for the received message.
127157
Dependencies are met if the message IDs in the `causal_history` of the received message
128158
appear in the local history of the receiving participant.
129159

130160
If all dependencies are met,
131161
the participant MUST [deliver the message](#deliver-message).
132162
If dependencies are unmet,
133-
the participant MUST add the message to the incoming buffer of messages with unmet causal dependencies.
163+
the participant MUST add the message to the incoming buffer of messages
164+
with unmet causal dependencies.
134165

135166
#### Deliver Message
136167

137168
Triggered by the [Receive Message](#receive-message) procedure.
138169

139-
If the received message’s Lamport timestamp is greater than the participant's local Lamport timestamp,
170+
If the received message’s Lamport timestamp is greater than the participant's
171+
local Lamport timestamp,
140172
the participant MUST update its local Lamport timestamp to match the received message.
141173
The participant MUST insert the message ID into its local log,
142174
based on Lamport timestamp.
@@ -147,7 +179,8 @@ the participant MUST follow the [Resolve Conflicts](#resolve-conflicts) procedur
147179

148180
Triggered by the [Deliver Message](#deliver-message) procedure.
149181

150-
The participant MUST order messages with the same Lamport timestamp in ascending order of message ID.
182+
The participant MUST order messages with the same Lamport timestamp
183+
in ascending order of message ID.
151184
If the message ID is implemented as a hash of the message,
152185
this means the message with the lowest hash would precede
153186
other messages with the same Lamport timestamp in the local log.
@@ -158,27 +191,35 @@ Triggered by the [Receive Message](#receive-message) procedure.
158191

159192
For each message in the unacknowledged outgoing buffer,
160193
based on the received `bloom_filter` and `causal_history`:
161-
- the participant MUST mark all messages in the received `causal_history` as **acknowledged**.
162-
- the participant MUST mark all messages included in the `bloom_filter` as **possibly acknowledged**.
194+
195+
* the participant MUST mark all messages in the received `causal_history` as **acknowledged**.
196+
* the participant MUST mark all messages included in the `bloom_filter`
197+
as **possibly acknowledged**.
163198
If a message appears as **possibly acknowledged** in multiple received bloom filters,
164199
the participant MAY mark it as acknowledged based on probabilistic grounds,
165200
taking into account the bloom filter size and hash number.
166201

167202
#### Periodic Incoming Buffer Sweep
168203

169-
The participant MUST periodically check causal dependencies for each message in the incoming buffer.
204+
The participant MUST periodically check causal dependencies for each message
205+
in the incoming buffer.
170206
For each message in the incoming buffer:
171-
- the participant MAY attempt to retrieve missing dependencies from the Store node (high-availability cache) or other peers.
172-
- if all dependencies of a message are met,
207+
208+
* the participant MAY attempt to retrieve missing dependencies from the Store node
209+
(high-availability cache) or other peers.
210+
* if all dependencies of a message are met,
173211
the participant MUST proceed to [deliver the message](#deliver-message).
174212

175-
If a message's causal dependencies have failed to be met after a predetermined amount of time,
213+
If a message's causal dependencies have failed to be met
214+
after a predetermined amount of time,
176215
the participant MAY mark them as **irretrievably lost**.
177216

178217
#### Periodic Outgoing Buffer Sweep
179218

180-
The participant MUST rebroadcast **unacknowledged** outgoing messages after a set period.
181-
The participant SHOULD use distinct resend periods for **unacknowledged** and **possibly acknowledged** messages,
219+
The participant MUST rebroadcast **unacknowledged** outgoing messages
220+
after a set period.
221+
The participant SHOULD use distinct resend periods for **unacknowledged** and
222+
**possibly acknowledged** messages,
182223
prioritizing **unacknowledged** messages.
183224

184225
#### Periodic Sync Message
@@ -187,19 +228,25 @@ For each channel of communication,
187228
participants SHOULD periodically send an empty-content message to maintain sync state,
188229
without incrementing the Lamport timestamp.
189230
To avoid network activity bursts in large groups,
190-
a participant MAY choose to only send periodic sync messages if no other messages have been broadcast in the channel after a random backoff period.
231+
a participant MAY choose to only send periodic sync messages
232+
if no other messages have been broadcast in the channel after a random backoff period.
191233

192-
Participants MUST process these sync messages following the same steps as regular messages.
234+
Participants MUST process these sync messages
235+
following the same steps as regular messages.
193236

194237
#### Ephemeral Messages
195238

196-
Participants MAY choose to send short-lived messages for which no synchronization or reliability is required.
239+
Participants MAY choose to send short-lived messages for which no synchronization
240+
or reliability is required.
197241
These messages are termed _ephemeral_.
198242

199-
Ephemeral messages SHOULD be sent with `lamport_timestamp`, `causal_history`, and `bloom_filter` unset.
200-
Ephemeral messages SHOULD NOT be added to the unacknowledged outgoing buffer after broadcast.
243+
Ephemeral messages SHOULD be sent with `lamport_timestamp`, `causal_history`, and
244+
`bloom_filter` unset.
245+
Ephemeral messages SHOULD NOT be added to the unacknowledged outgoing buffer
246+
after broadcast.
201247
Upon reception,
202-
ephemeral messages SHOULD be delivered immediately without buffering for causal dependencies or including in the local log.
248+
ephemeral messages SHOULD be delivered immediately without buffering for causal dependencies
249+
or including in the local log.
203250

204251
## Copyright
205252

0 commit comments

Comments
 (0)