@peerbit/shared-log 10.4.12 → 11.0.0-c5f9b43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,11 +43,11 @@ export class ResponseMaybeSync extends TransportMessage {
43
43
  @variant([0, 5])
44
44
  export class RequestMaybeSyncCoordinate extends TransportMessage {
45
45
  @field({ type: vec("u64") })
46
- coordinates: bigint[];
46
+ hashNumbers: bigint[];
47
47
 
48
- constructor(props: { coordinates: bigint[] }) {
48
+ constructor(props: { hashNumbers: bigint[] }) {
49
49
  super();
50
- this.coordinates = props.coordinates;
50
+ this.hashNumbers = props.hashNumbers;
51
51
  }
52
52
  }
53
53
 
@@ -64,16 +64,14 @@ const getHashesFromSymbols = async (
64
64
  const entries = await entryIndex
65
65
  .iterate(
66
66
  { query: queries.length > 1 ? new Or(queries) : queries },
67
- { shape: { hash: true, coordinates: true } },
67
+ { shape: { hash: true, hashNumber: true } },
68
68
  )
69
69
  .all();
70
70
  queries = [];
71
71
 
72
72
  for (const entry of entries) {
73
73
  results.add(entry.value.hash);
74
- for (const coordinate of entry.value.coordinates) {
75
- coordinateToHash.add(coordinate, entry.value.hash);
76
- }
74
+ coordinateToHash.add(entry.value.hashNumber, entry.value.hash);
77
75
  }
78
76
  }
79
77
  };
@@ -84,7 +82,7 @@ const getHashesFromSymbols = async (
84
82
  continue;
85
83
  }
86
84
  const matchQuery = new IntegerCompare({
87
- key: "coordinates",
85
+ key: "hashNumber",
88
86
  compare: Compare.Equal,
89
87
  value: symbols[i],
90
88
  });
@@ -168,7 +166,7 @@ export class SimpleSyncronizer<R extends "u32" | "u64">
168
166
  return true;
169
167
  } else if (msg instanceof RequestMaybeSyncCoordinate) {
170
168
  const hashes = await getHashesFromSymbols(
171
- msg.coordinates,
169
+ msg.hashNumbers,
172
170
  this.entryIndex,
173
171
  this.coordinateToHash,
174
172
  );
@@ -261,7 +259,7 @@ export class SimpleSyncronizer<R extends "u32" | "u64">
261
259
 
262
260
  await this.rpc.send(
263
261
  isBigInt
264
- ? new RequestMaybeSyncCoordinate({ coordinates: hashes as bigint[] })
262
+ ? new RequestMaybeSyncCoordinate({ hashNumbers: hashes as bigint[] })
265
263
  : new ResponseMaybeSync({ hashes: hashes as string[] }),
266
264
  {
267
265
  mode: new SilentDelivery({ to, redundancy: 1 }),
@@ -271,7 +269,7 @@ export class SimpleSyncronizer<R extends "u32" | "u64">
271
269
  }
272
270
  private async checkHasCoordinateOrHash(key: string | bigint) {
273
271
  return typeof key === "bigint"
274
- ? (await this.entryIndex.count({ query: { coordinates: key } })) > 0
272
+ ? (await this.entryIndex.count({ query: { hashNumber: key } })) > 0
275
273
  : this.log.has(key);
276
274
  }
277
275
  async open() {