Skip to content

Commit

Permalink
sync: export SvStateVector
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Oct 17, 2023
1 parent 0ebadf8 commit c915ce6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "vitest",
"typedoc": "bash mk/typedoc.sh"
},
"packageManager": "pnpm@8.9.0",
"packageManager": "pnpm@8.9.2",
"devDependencies": {
"@types/node": "^20.8.6",
"@types/wtfnode": "^0.7.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/sync/src/svs/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./mapping-entry";
export { SvMappingEntry, SvTimedMappingEntry } from "./mapping-entry";
export { SvStateVector } from "./state-vector";
export { SvSync } from "./sync";
export { SvPublisher } from "./publisher";
export { SvSubscriber } from "./subscriber";
5 changes: 3 additions & 2 deletions packages/sync/tests/svs.t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import DefaultMap from "mnemonist/default-map.js";
import { filter } from "streaming-iterables";
import { afterEach, expect, test } from "vitest";

import { SvSync } from "..";
import { SvStateVector, SvSync } from "..";

class UpdateHandler {
constructor(sync: SvSync) {
Expand Down Expand Up @@ -161,10 +161,11 @@ test("initialize", async () => {
expect(v0.get(new Name("/C"))).toBe(13);
expect(v0.get(new Name("/D"))).toBe(0);

const v1 = new SvStateVector(JSON.parse(JSON.stringify(v0)));
const p1 = await SvSync.create({
...opts,
describe: "1",
initialStateVector: v0,
initialStateVector: v1,
async initialize(sync) {
closers.push(sync);
debugHandler.start(sync);
Expand Down
4 changes: 0 additions & 4 deletions packages/sync/tests/svsps.t.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import "@ndn/packet/test-fixture/expect";

import { setMaxListeners } from "node:events";

import { Endpoint } from "@ndn/endpoint";
import { generateSigningKey } from "@ndn/keychain";
import { Name, type NameLike } from "@ndn/packet";
Expand All @@ -17,8 +15,6 @@ let pubOpts: Partial<SvPublisher.Options>;
let subOpts: Partial<SvSubscriber.Options>;

beforeAll(async () => {
setMaxListeners(20);

const [signerS, verifierS] = await generateSigningKey("/kS");
const [signerI, verifierI] = await generateSigningKey("/kI");
const [signerO, verifierO] = await generateSigningKey("/kO");
Expand Down

0 comments on commit c915ce6

Please sign in to comment.