Skip to content

Commit

Permalink
svs: delete SVS v1 remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Jan 9, 2025
1 parent da92a13 commit e3f127f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"codedown": "^3.2.1",
"tslib": "^2.8.1",
"typedoc": "^0.27.6",
"typescript": "~5.7.2",
"typescript": "~5.7.3",
"vitest": "^2.1.8"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion pkg/svs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This package contains **StateVectorSync** and related protocols, including:
* [StateVectorSync v2](https://named-data.github.io/StateVectorSync/Specification.html), revision 2025-01-04
* complete unit test
* core synchronization logic only, does not deal with Data fetching
* note: SVS v2 has been deleted
* note: SVS v1 has been deleted
* [SVS-PS](https://named-data.github.io/StateVectorSync/PubSubSpec.html), revision 2023-05-19
* simple unit test
* piggyback MappingData feature is not supported
Expand Down
1 change: 1 addition & 0 deletions pkg/svs/src/an.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export const TT = {

export const MappingKeyword = Component.from("MAPPING");
export const Version0 = Version.create(0);
export const Version2 = Version.create(2);
export const ContentTypeEncap = 6;
9 changes: 0 additions & 9 deletions pkg/svs/src/state-vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ export class StateVector {
}

export namespace StateVector {
/**
* StateVector TLV-TYPE.
*
* @remarks
* SVS v1 encodes StateVector as a name component of this type.
* SVS v2 encodes StateVector as a sub-element of this type within AppParameters.
*/
export const Type = TT.StateVector;

/** Per-node entry. */
export interface NodeEntry {
/** Current sequence number (positive integer). */
Expand Down
12 changes: 5 additions & 7 deletions pkg/svs/src/sync.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Forwarder, type FwFace, FwPacket } from "@ndn/fw";
import { Version } from "@ndn/naming-convention2";
import { Interest, Name, type NameLike, nullSigner, type Signer, type Verifier } from "@ndn/packet";
import { type SyncNode, type SyncProtocol, SyncUpdate } from "@ndn/sync-api";
import { Decoder, Encoder } from "@ndn/tlv";
Expand All @@ -8,10 +7,9 @@ import { consume, map, tap } from "streaming-iterables";
import type { Promisable } from "type-fest";
import { TypedEventTarget } from "typescript-event-target";

import { Version2 } from "./an";
import { StateVector } from "./state-vector";

const V2 = Version.create(2);

interface DebugEntry {
action: string;
own: Record<string, number>;
Expand Down Expand Up @@ -73,7 +71,7 @@ export class SvSync extends TypedEventTarget<EventMap> implements SyncProtocol<N
private readonly suppressionPeriod: number,
) {
super();
this.syncInterestName = syncPrefix.append(V2);
this.syncInterestName = syncPrefix.append(Version2);
}

private makeFace(
Expand Down Expand Up @@ -109,7 +107,7 @@ export class SvSync extends TypedEventTarget<EventMap> implements SyncProtocol<N
describe: this.describe,
routeCapture: false,
});
this.face.addRoute(this.syncPrefix);
this.face.addRoute(this.syncInterestName, this.syncPrefix);
}

private readonly maybeHaveEventListener = trackEventListener(this);
Expand Down Expand Up @@ -192,7 +190,7 @@ export class SvSync extends TypedEventTarget<EventMap> implements SyncProtocol<N
* @param interest - Received Interest, signature verified.
*/
private async handleSyncInterest(interest: Interest): Promise<void> {
assert(interest.name.at(this.syncPrefix.length).equals(V2) && interest.appParameters, "cannot find StateVector");
assert(interest.appParameters);
const decoder = new Decoder(interest.appParameters);
const recv = decoder.decode(StateVector);

Expand Down Expand Up @@ -259,7 +257,7 @@ export class SvSync extends TypedEventTarget<EventMap> implements SyncProtocol<N
interest.name = this.syncInterestName;
interest.appParameters = Encoder.encode(this.own);
this.txStream.push(interest);
// further modification and signing occur in the the logical face
// further modification and signing occur in the logical face
}
}

Expand Down

0 comments on commit e3f127f

Please sign in to comment.