Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for SVS v2 #14

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions PubSubSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ The following well-known additional blocks are RECOMMENDED.
Timestamp = TimestampNameComponent
```

### Name Mapping Delivery Optimization

To optimize the delivery of mapping data, SVS-PS implementations MAY piggyback mapping data in the Sync Interest's `ApplicationParameters`. If present, the mapping data SHOULD be appended as a single block after the StateVector in the `ApplicationParameters`. The mapping data MUST be encoded as a TLV block of type `MappingData` as defined above.

When this optimization is implemented, Mapping Data SHOULD be inserted in every outgoing Sync Interest sent as a result of new data production. On receiving a Sync Interest, this mapping data can be utilized only after the Interest signature has been validated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally, MappingData is generated in response to a query Interest, which includes low-seq and high-seq fields.
With delivery optimization, how could the publisher predict what low-seq and high-seq is wanted by the subscriber?


## Subscribers

This section describes the functions performed at data subscribers.
Expand Down
68 changes: 44 additions & 24 deletions Specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This page describes the protocol specification of [State Vector Sync (SVS)](/README.md).

_Last update to specification: 2021-12-15_
_Last update to specification: 2024-01-09_

## 1. Basic Protocol Design

Expand Down Expand Up @@ -40,13 +40,11 @@ seq=11 \

## 2. Format and Naming

**Sync Interest Format**: `/<group-prefix>/<state-vector>/<signature>`
**Sync Interest Name**: `/<group-prefix>/v=2/<parameters-digest>`

A state vector is appended to the name in TLV format:
The State Vector is encoded in TLV format and included in the `ApplicationParameters` of the Sync Interest. The State Vector SHOULD be the first TLV block in the `ApplicationParameters`. The Interest Lifetime for Sync Interests is 1 second.

Interest Lifetime: 1 second

**Data Interest Format**: `/<node-prefix>/<group-prefix>/<seq-num>`
**Data Interest Name**: `/<node-prefix>/<group-prefix>/<seq-num>`

_Note:_ Choosing alternative Data Interest formats may be decided on application-level.

Expand Down Expand Up @@ -93,27 +91,49 @@ SEQ-NO-TYPE = 204

Nodes can either be in _Steady State_, or in _Suppression State_

- _Steady State_: The sync group is in sync. Incoming Sync Interests carry the latest known state.
- _Suppression State_: Incoming Sync Interests indicate a state inconsistency. The node tries reconciling the inconsistency by emitting a up-to-date Sync Interest. Use a suppression timer before sending to prevent flooding.
- _Steady State_: The Sync group is synchronized. Incoming Sync Interests carry the latest known state.
- _Suppression State_: Incoming Sync Interests indicate a state inconsistency. The node tries to reconcile the inconsistency by emitting a up-to-date Sync Interest. Use a suppression timer before sending to prevent flooding.

SVS utilizes a single Sync Interest timer. It can take on one of the two timeout values that are used by the protocol. The values required for the timer are as follows.

- `PeriodicTimeout`: defaults to 30 seconds (±10% uniform)
- `SuppressionPeriod`: defaults to 200ms
- `SuppressionTimeout`: random value between 0 to `SuppressionPeriod`. \
An exponential decay function SHOULD be used for the timeout value.
```
c = SuppressionPeriod // constant factor
v = random(0, c) // uniform random value
f = 10.0 // decay factor
SuppressionTimeout = c * (1 - e^((v - c) / (c / f)))
Pesa marked this conversation as resolved.
Show resolved Hide resolved
```


**Steady State**

When a node is in _Steady State_:
- When entering _Steady State_, reset the Sync Interest timer to `PeriodicTimeout`

- Incoming Sync Interest is up-to-date or newer.
- No indication of inconsistencies. The scheduled Sync Interest can be delayed.
- Eventually update the local state and reset Sync Interest Timer to 30 seconds (±10% uniform)
- Incoming Sync Interest is outdated: Node moves to _Suppression State_
- Set Sync Interest Timer to 200ms (±50% uniform) - Time represents the suppression interval
- Aggregate the state of consequent incoming Sync Interests in a separate state vector
- On expiration of timer:
- If aggregated received state vector is up-to-date:\
No inconsistency - Reset Sync Interest Timer to 30 seconds (±10% uniform)
- If aggregated received state vector is outdated:\
Inconsistent State: Emit up-to-date Sync Interest. Reset Sync Interest Timer to 30 seconds (±10%)\
Node moves to _Steady State_

When a node is in _Supression State_:

- Only aggregate state vector of incoming Sync Interests. No further action in _Suppression State_.
1. If the incoming state vector is newer, update the local state vector. \
Store the current timestamp as the last update time for each updated node.
1. Reset Sync Interest timer to `PeriodicTimeout`.

- Incoming Sync Interest is outdated.
- If every node with an outdated sequence number in the incoming state vector was updated in the last `SuppressionPeriod`, drop the Sync Interest.
- Otherwise, move to _Suppression State_

- On expiration of timer:
1. Emit a Sync Interest with the current local state vector.
1. Reset Sync Interest timer to `PeriodicTimeout`.

**Suppression State**

- When entering Suppression State_, reset the Sync Interest timer to `SuppressionTimeout`
- For every incoming Sync Interest, aggregate the state vector into a `MergedStateVector`.
- On expiration of timer:
1. If `MergedStateVector` is up-to-date; no inconsistency.
1. If `MergedStateVector` is outdated; inconsistent state.
Emit up-to-date Sync Interest.
1. Move to _Steady State_.

## 5. Examples

Expand Down