-
Notifications
You must be signed in to change notification settings - Fork 35
sync: SVS v4 (mhash, PARTIAL, publish+pull) #190
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
Open
Taranum01
wants to merge
17
commits into
named-data:psvs
Choose a base branch
from
Taranum01:svs-exploration
base: psvs
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b88a364
sync: SVS v4 large-group sync (mhash, PARTIAL, publish+pull)
fe5586b
test: add SVS v4 unit tests
e9522cc
docs: SVS v4 specification
1002285
fix(e2e): use AIMD congestion window in segment fetcher
5d8b1be
sync: address review comments on SVS v4
9340c00
object: bump metadata fetch retries 3 to 5 and lifetime 1s to 2s
56c2af0
docs+code: address easy review comments
67d93c2
docs+code: reword 'X not Y' anti-patterns
aed3420
sync: tighten v4 wire-format validation
7f04d17
sync: drop announce wording from SVS internals
d27e022
fix(e2e): retry ExpressR on transient NackReasonNoRoute/Congestion
1872c64
docs(svs-v4): address spec review comments
5f3a477
sync: address v4 review comments on PARTIAL selection and SvsData flow
ea79483
sync: replace VectorType with distinct FullStateVector/PartialStateVe…
e6ce78e
lint+refactor: fix goimports and rename svs v3 package to v4
bbce410
e2e: bump DV convergence + put-then-cat windows; revert client retry …
a9a0de7
sync: tighten direct-form exclusivity and hoist mhash in PARTIAL encode
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package svs | ||
|
|
||
| // VectorKind identifies which direct form an SvsData carries on the wire. | ||
| // Publish-only Sync Data carries neither FullStateVector nor | ||
| // PartialStateVector; instead it has SvsDataRef. The choice of wire TLV | ||
| // replaces the previous VectorType discriminator field. | ||
| type VectorKind int | ||
|
|
||
| const ( | ||
| // VectorKindNone is the publish-only form: no embedded vector, only a | ||
| // retrievable SvsDataRef. | ||
| VectorKindNone VectorKind = iota | ||
| // VectorKindFull is a complete State Vector (FULL). | ||
| VectorKindFull | ||
| // VectorKindPartial is a sender-selected subset (PARTIAL). | ||
| VectorKindPartial | ||
| ) | ||
|
|
||
| // GetStateVector returns the embedded StateVector for direct forms (FULL | ||
| // or PARTIAL), or nil for the publish-only form. | ||
| func (d *SvsData) GetStateVector() *StateVector { | ||
| switch { | ||
| case d.FullStateVector != nil: | ||
| return d.FullStateVector.StateVector | ||
| case d.PartialStateVector != nil: | ||
| return d.PartialStateVector.StateVector | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // Kind reports which direct form (or none) the SvsData carries on the wire. | ||
| // An SvsData carrying both FullStateVector and PartialStateVector is | ||
| // reported as KindFull (the more specific case wins). | ||
| func (d *SvsData) Kind() VectorKind { | ||
| switch { | ||
| case d.FullStateVector != nil: | ||
| return VectorKindFull | ||
| case d.PartialStateVector != nil: | ||
| return VectorKindPartial | ||
| } | ||
| return VectorKindNone | ||
| } | ||
|
|
||
| // IsPartial reports whether the embedded StateVector is a PARTIAL subset. | ||
| // Returns false for the publish-only form (callers that branch on this | ||
| // should also check SvsDataRef for the publish-only recovery path). | ||
| func (d *SvsData) IsPartial() bool { | ||
| return d.PartialStateVector != nil | ||
| } | ||
|
|
||
| // IsFull reports whether the embedded StateVector is a FULL State Vector. | ||
| func (d *SvsData) IsFull() bool { | ||
| return d.FullStateVector != nil | ||
| } |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to ndn/svs/v4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| //go:generate gondn_tlv_gen | ||
| package svs | ||
|
|
||
| import ( | ||
| enc "github.com/named-data/ndnd/std/encoding" | ||
| ) | ||
|
|
||
| // FullStateVector is the wire form of a complete State Vector carried in a | ||
| // Sync message or published at .../32=sv/<version>. The presence of this | ||
| // TLV (rather than PartialStateVector) tells the receiver that the embedded | ||
| // StateVector represents the sender's full membership view. | ||
| type FullStateVector struct { | ||
| //+field:struct:StateVector | ||
| StateVector *StateVector `tlv:"0xc9"` | ||
| } | ||
|
|
||
| // PartialStateVector is the wire form of a publication-time subset State | ||
| // Vector. The presence of this TLV tells the receiver that omitted entries | ||
| // are a sender-selected subset (not a partition or out-of-date sender). | ||
| type PartialStateVector struct { | ||
| //+field:struct:StateVector | ||
| StateVector *StateVector `tlv:"0xc9"` | ||
| } | ||
|
|
||
| // SvsData is a tagged union: the wire carries exactly one of | ||
| // FullStateVector, PartialStateVector, or SvsDataRef. The choice of TLV | ||
| // type replaces the previous VectorType discriminator. MemberSetHash | ||
| // (`mhash`) is present on all three forms and lets receivers detect | ||
| // membership mismatches without walking a full StateVector. | ||
| type SvsData struct { | ||
| //+field:binary:optional | ||
| MemberSetHash []byte `tlv:"0xcb"` | ||
| //+field:struct:FullStateVector | ||
| FullStateVector *FullStateVector `tlv:"0xcd"` | ||
| //+field:struct:PartialStateVector | ||
| PartialStateVector *PartialStateVector `tlv:"0xce"` | ||
| //+field:name | ||
| SvsDataRef enc.Name `tlv:"0x07"` | ||
| } | ||
|
|
||
| type StateVector struct { | ||
| //+field:sequence:*StateVectorEntry:struct:StateVectorEntry | ||
| Entries []*StateVectorEntry `tlv:"0xca"` | ||
| } | ||
|
|
||
| type StateVectorEntry struct { | ||
| //+field:name | ||
| Name enc.Name `tlv:"0x07"` | ||
| //+field:sequence:*SeqNoEntry:struct:SeqNoEntry | ||
| SeqNoEntries []*SeqNoEntry `tlv:"0xd2"` | ||
| } | ||
|
|
||
| type SeqNoEntry struct { | ||
| //+field:natural | ||
| BootstrapTime uint64 `tlv:"0xd4"` | ||
| //+field:natural | ||
| SeqNo uint64 `tlv:"0xd6"` | ||
| } | ||
|
|
||
| // MembershipTuple is one (Name, BootstrapTime) pair used to compute MemberSetHash. | ||
| type MembershipTuple struct { | ||
| //+field:name | ||
| Name enc.Name `tlv:"0x07"` | ||
| //+field:natural | ||
| BootstrapTime uint64 `tlv:"0xd4"` | ||
| } | ||
|
|
||
| // +tlv-model:nocopy | ||
| type PassiveState struct { | ||
| //+field:sequence:[]byte:binary:[]byte | ||
| Data [][]byte `tlv:"0xfa0"` | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.