@peerbit/shared-log 9.2.13 → 10.0.0-05f4bef
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.
- package/dist/benchmark/get-samples.js +190 -64
- package/dist/benchmark/get-samples.js.map +1 -1
- package/dist/benchmark/index.js +16 -38
- package/dist/benchmark/index.js.map +1 -1
- package/dist/benchmark/memory/child.js.map +1 -1
- package/dist/benchmark/partial-sync.d.ts +3 -0
- package/dist/benchmark/partial-sync.d.ts.map +1 -0
- package/dist/benchmark/partial-sync.js +121 -0
- package/dist/benchmark/partial-sync.js.map +1 -0
- package/dist/benchmark/replication-prune.js.map +1 -1
- package/dist/benchmark/replication.js.map +1 -1
- package/dist/benchmark/to-rebalance.d.ts +2 -0
- package/dist/benchmark/to-rebalance.d.ts.map +1 -0
- package/dist/benchmark/to-rebalance.js +117 -0
- package/dist/benchmark/to-rebalance.js.map +1 -0
- package/dist/benchmark/utils.d.ts +24 -0
- package/dist/benchmark/utils.d.ts.map +1 -0
- package/dist/benchmark/utils.js +47 -0
- package/dist/benchmark/utils.js.map +1 -0
- package/dist/src/debounce.d.ts +2 -2
- package/dist/src/debounce.d.ts.map +1 -1
- package/dist/src/debounce.js +17 -47
- package/dist/src/debounce.js.map +1 -1
- package/dist/src/exchange-heads.d.ts +1 -13
- package/dist/src/exchange-heads.d.ts.map +1 -1
- package/dist/src/exchange-heads.js +0 -32
- package/dist/src/exchange-heads.js.map +1 -1
- package/dist/src/index.d.ts +119 -60
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1116 -762
- package/dist/src/index.js.map +1 -1
- package/dist/src/integers.d.ts +22 -0
- package/dist/src/integers.d.ts.map +1 -0
- package/dist/src/integers.js +76 -0
- package/dist/src/integers.js.map +1 -0
- package/dist/src/pid.d.ts.map +1 -1
- package/dist/src/pid.js +22 -22
- package/dist/src/pid.js.map +1 -1
- package/dist/src/ranges.d.ts +168 -38
- package/dist/src/ranges.d.ts.map +1 -1
- package/dist/src/ranges.js +869 -272
- package/dist/src/ranges.js.map +1 -1
- package/dist/src/replication-domain-hash.d.ts +2 -3
- package/dist/src/replication-domain-hash.d.ts.map +1 -1
- package/dist/src/replication-domain-hash.js +40 -15
- package/dist/src/replication-domain-hash.js.map +1 -1
- package/dist/src/replication-domain-time.d.ts +5 -5
- package/dist/src/replication-domain-time.d.ts.map +1 -1
- package/dist/src/replication-domain-time.js +2 -0
- package/dist/src/replication-domain-time.js.map +1 -1
- package/dist/src/replication-domain.d.ts +17 -19
- package/dist/src/replication-domain.d.ts.map +1 -1
- package/dist/src/replication-domain.js +2 -6
- package/dist/src/replication-domain.js.map +1 -1
- package/dist/src/replication.d.ts +6 -6
- package/dist/src/replication.d.ts.map +1 -1
- package/dist/src/replication.js +4 -4
- package/dist/src/replication.js.map +1 -1
- package/dist/src/role.d.ts +3 -6
- package/dist/src/role.d.ts.map +1 -1
- package/dist/src/role.js +4 -5
- package/dist/src/role.js.map +1 -1
- package/dist/src/sync/index.d.ts +40 -0
- package/dist/src/sync/index.d.ts.map +1 -0
- package/dist/src/sync/index.js +2 -0
- package/dist/src/sync/index.js.map +1 -0
- package/dist/src/sync/rateless-iblt.d.ts +124 -0
- package/dist/src/sync/rateless-iblt.d.ts.map +1 -0
- package/dist/src/sync/rateless-iblt.js +495 -0
- package/dist/src/sync/rateless-iblt.js.map +1 -0
- package/dist/src/sync/simple.d.ts +69 -0
- package/dist/src/sync/simple.d.ts.map +1 -0
- package/dist/src/sync/simple.js +338 -0
- package/dist/src/sync/simple.js.map +1 -0
- package/dist/src/sync/wasm-init.browser.d.ts +1 -0
- package/dist/src/sync/wasm-init.browser.d.ts.map +1 -0
- package/dist/src/sync/wasm-init.browser.js +3 -0
- package/dist/src/sync/wasm-init.browser.js.map +1 -0
- package/dist/src/sync/wasm-init.d.ts +2 -0
- package/dist/src/sync/wasm-init.d.ts.map +1 -0
- package/dist/src/sync/wasm-init.js +13 -0
- package/dist/src/sync/wasm-init.js.map +1 -0
- package/dist/src/utils.d.ts +3 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -2
- package/dist/src/utils.js.map +1 -1
- package/package.json +73 -69
- package/src/debounce.ts +16 -51
- package/src/exchange-heads.ts +1 -23
- package/src/index.ts +1532 -1038
- package/src/integers.ts +102 -0
- package/src/pid.ts +23 -22
- package/src/ranges.ts +1204 -413
- package/src/replication-domain-hash.ts +43 -18
- package/src/replication-domain-time.ts +9 -9
- package/src/replication-domain.ts +21 -31
- package/src/replication.ts +10 -9
- package/src/role.ts +4 -6
- package/src/sync/index.ts +51 -0
- package/src/sync/rateless-iblt.ts +617 -0
- package/src/sync/simple.ts +403 -0
- package/src/sync/wasm-init.browser.ts +1 -0
- package/src/sync/wasm-init.ts +14 -0
- package/src/utils.ts +10 -4
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { field, variant, vec } from "@dao-xyz/borsh";
|
|
11
|
+
import { Cache } from "@peerbit/cache";
|
|
12
|
+
import { Compare, IntegerCompare, Or, } from "@peerbit/indexer-interface";
|
|
13
|
+
import { Entry, Log } from "@peerbit/log";
|
|
14
|
+
import { SilentDelivery } from "@peerbit/stream-interface";
|
|
15
|
+
import { EntryWithRefs, createExchangeHeadsMessages, } from "../exchange-heads.js";
|
|
16
|
+
import { TransportMessage } from "../message.js";
|
|
17
|
+
let RequestMaybeSync = class RequestMaybeSync extends TransportMessage {
|
|
18
|
+
hashes;
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super();
|
|
21
|
+
this.hashes = props.hashes;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__decorate([
|
|
25
|
+
field({ type: vec("string") }),
|
|
26
|
+
__metadata("design:type", Array)
|
|
27
|
+
], RequestMaybeSync.prototype, "hashes", void 0);
|
|
28
|
+
RequestMaybeSync = __decorate([
|
|
29
|
+
variant([0, 1]),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], RequestMaybeSync);
|
|
32
|
+
export { RequestMaybeSync };
|
|
33
|
+
let ResponseMaybeSync = class ResponseMaybeSync extends TransportMessage {
|
|
34
|
+
hashes;
|
|
35
|
+
constructor(props) {
|
|
36
|
+
super();
|
|
37
|
+
this.hashes = props.hashes;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
field({ type: vec("string") }),
|
|
42
|
+
__metadata("design:type", Array)
|
|
43
|
+
], ResponseMaybeSync.prototype, "hashes", void 0);
|
|
44
|
+
ResponseMaybeSync = __decorate([
|
|
45
|
+
variant([0, 2]),
|
|
46
|
+
__metadata("design:paramtypes", [Object])
|
|
47
|
+
], ResponseMaybeSync);
|
|
48
|
+
export { ResponseMaybeSync };
|
|
49
|
+
let RequestMaybeSyncCoordinate = class RequestMaybeSyncCoordinate extends TransportMessage {
|
|
50
|
+
coordinates;
|
|
51
|
+
constructor(props) {
|
|
52
|
+
super();
|
|
53
|
+
this.coordinates = props.coordinates;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
__decorate([
|
|
57
|
+
field({ type: vec("u64") }),
|
|
58
|
+
__metadata("design:type", Array)
|
|
59
|
+
], RequestMaybeSyncCoordinate.prototype, "coordinates", void 0);
|
|
60
|
+
RequestMaybeSyncCoordinate = __decorate([
|
|
61
|
+
variant([0, 5]),
|
|
62
|
+
__metadata("design:paramtypes", [Object])
|
|
63
|
+
], RequestMaybeSyncCoordinate);
|
|
64
|
+
export { RequestMaybeSyncCoordinate };
|
|
65
|
+
const getHashesFromSymbols = async (symbols, entryIndex, coordinateToHash) => {
|
|
66
|
+
let queries = [];
|
|
67
|
+
let batchSize = 1; // TODO arg
|
|
68
|
+
let results = new Set();
|
|
69
|
+
const handleBatch = async (end = false) => {
|
|
70
|
+
if (queries.length >= batchSize || (end && queries.length > 0)) {
|
|
71
|
+
const entries = await entryIndex
|
|
72
|
+
.iterate({ query: queries.length > 1 ? new Or(queries) : queries }, { shape: { hash: true, coordinates: true } })
|
|
73
|
+
.all();
|
|
74
|
+
queries = [];
|
|
75
|
+
for (const entry of entries) {
|
|
76
|
+
results.add(entry.value.hash);
|
|
77
|
+
for (const coordinate of entry.value.coordinates) {
|
|
78
|
+
coordinateToHash.add(coordinate, entry.value.hash);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
84
|
+
const fromCache = coordinateToHash.get(symbols[i]);
|
|
85
|
+
if (fromCache) {
|
|
86
|
+
results.add(fromCache);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const matchQuery = new IntegerCompare({
|
|
90
|
+
key: "coordinates",
|
|
91
|
+
compare: Compare.Equal,
|
|
92
|
+
value: symbols[i],
|
|
93
|
+
});
|
|
94
|
+
queries.push(matchQuery);
|
|
95
|
+
await handleBatch();
|
|
96
|
+
}
|
|
97
|
+
await handleBatch(true);
|
|
98
|
+
return results;
|
|
99
|
+
};
|
|
100
|
+
export class SimpleSyncronizer {
|
|
101
|
+
// map of hash to public keys that we can ask for entries
|
|
102
|
+
syncInFlightQueue;
|
|
103
|
+
syncInFlightQueueInverted;
|
|
104
|
+
// map of hash to public keys that we have asked for entries
|
|
105
|
+
syncInFlight;
|
|
106
|
+
rpc;
|
|
107
|
+
log;
|
|
108
|
+
entryIndex;
|
|
109
|
+
coordinateToHash;
|
|
110
|
+
// Syncing and dedeplucation work
|
|
111
|
+
syncMoreInterval;
|
|
112
|
+
closed;
|
|
113
|
+
constructor(properties) {
|
|
114
|
+
this.syncInFlightQueue = new Map();
|
|
115
|
+
this.syncInFlightQueueInverted = new Map();
|
|
116
|
+
this.syncInFlight = new Map();
|
|
117
|
+
this.rpc = properties.rpc;
|
|
118
|
+
this.log = properties.log;
|
|
119
|
+
this.entryIndex = properties.entryIndex;
|
|
120
|
+
this.coordinateToHash = properties.coordinateToHash;
|
|
121
|
+
}
|
|
122
|
+
onMaybeMissingEntries(properties) {
|
|
123
|
+
return this.rpc.send(new RequestMaybeSync({ hashes: [...properties.entries.keys()] }), {
|
|
124
|
+
priority: 1,
|
|
125
|
+
mode: new SilentDelivery({ to: properties.targets, redundancy: 1 }),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async onMessage(msg, context) {
|
|
129
|
+
const from = context.from;
|
|
130
|
+
if (msg instanceof RequestMaybeSync) {
|
|
131
|
+
await this.queueSync(msg.hashes, from);
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
else if (msg instanceof ResponseMaybeSync) {
|
|
135
|
+
// TODO perhaps send less messages to more receivers for performance reasons?
|
|
136
|
+
// TODO wait for previous send to target before trying to send more?
|
|
137
|
+
for await (const message of createExchangeHeadsMessages(this.log, msg.hashes)) {
|
|
138
|
+
await this.rpc.send(message, {
|
|
139
|
+
mode: new SilentDelivery({ to: [context.from], redundancy: 1 }),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
else if (msg instanceof RequestMaybeSyncCoordinate) {
|
|
145
|
+
const hashes = await getHashesFromSymbols(msg.coordinates, this.entryIndex, this.coordinateToHash);
|
|
146
|
+
for await (const message of createExchangeHeadsMessages(this.log, hashes)) {
|
|
147
|
+
await this.rpc.send(message, {
|
|
148
|
+
mode: new SilentDelivery({ to: [context.from], redundancy: 1 }),
|
|
149
|
+
priority: 1,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return false; // no message was consumed
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
onReceivedEntries(properties) {
|
|
159
|
+
for (const entry of properties.entries) {
|
|
160
|
+
const set = this.syncInFlight.get(properties.from.hashcode());
|
|
161
|
+
if (set) {
|
|
162
|
+
set.delete(entry.entry.hash);
|
|
163
|
+
if (set?.size === 0) {
|
|
164
|
+
this.syncInFlight.delete(properties.from.hashcode());
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async queueSync(keys, from, options) {
|
|
170
|
+
const requestHashes = [];
|
|
171
|
+
for (const coordinateOrHash of keys) {
|
|
172
|
+
const inFlight = this.syncInFlightQueue.get(coordinateOrHash);
|
|
173
|
+
if (inFlight) {
|
|
174
|
+
if (!inFlight.find((x) => x.hashcode() === from.hashcode())) {
|
|
175
|
+
inFlight.push(from);
|
|
176
|
+
let inverted = this.syncInFlightQueueInverted.get(from.hashcode());
|
|
177
|
+
if (!inverted) {
|
|
178
|
+
inverted = new Set();
|
|
179
|
+
this.syncInFlightQueueInverted.set(from.hashcode(), inverted);
|
|
180
|
+
}
|
|
181
|
+
inverted.add(coordinateOrHash);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else if (options?.skipCheck ||
|
|
185
|
+
!(await this.checkHasCoordinateOrHash(coordinateOrHash))) {
|
|
186
|
+
this.syncInFlightQueue.set(coordinateOrHash, []);
|
|
187
|
+
requestHashes.push(coordinateOrHash); // request immediately (first time we have seen this hash)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
requestHashes.length > 0 &&
|
|
191
|
+
(await this.requestSync(requestHashes, [
|
|
192
|
+
from.hashcode(),
|
|
193
|
+
]));
|
|
194
|
+
}
|
|
195
|
+
async requestSync(hashes, to) {
|
|
196
|
+
if (hashes.length === 0) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const now = +new Date();
|
|
200
|
+
for (const node of to) {
|
|
201
|
+
let map = this.syncInFlight.get(node);
|
|
202
|
+
if (!map) {
|
|
203
|
+
map = new Map();
|
|
204
|
+
this.syncInFlight.set(node, map);
|
|
205
|
+
}
|
|
206
|
+
for (const hash of hashes) {
|
|
207
|
+
map.set(hash, { timestamp: now });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const isBigInt = typeof hashes[0] === "bigint";
|
|
211
|
+
await this.rpc.send(isBigInt
|
|
212
|
+
? new RequestMaybeSyncCoordinate({ coordinates: hashes })
|
|
213
|
+
: new ResponseMaybeSync({ hashes: hashes }), {
|
|
214
|
+
mode: new SilentDelivery({ to, redundancy: 1 }),
|
|
215
|
+
priority: 1,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
async checkHasCoordinateOrHash(key) {
|
|
219
|
+
return typeof key === "bigint"
|
|
220
|
+
? (await this.entryIndex.count({ query: { coordinates: key } })) > 0
|
|
221
|
+
: this.log.has(key);
|
|
222
|
+
}
|
|
223
|
+
async open() {
|
|
224
|
+
this.closed = false;
|
|
225
|
+
const requestSyncLoop = async () => {
|
|
226
|
+
/**
|
|
227
|
+
* This method fetches entries that we potentially want.
|
|
228
|
+
* In a case in which we become replicator of a segment,
|
|
229
|
+
* multiple remote peers might want to send us entries
|
|
230
|
+
* This method makes sure that we only request on entry from the remotes at a time
|
|
231
|
+
* so we don't get flooded with the same entry
|
|
232
|
+
*/
|
|
233
|
+
const requestHashes = [];
|
|
234
|
+
const from = new Set();
|
|
235
|
+
for (const [key, value] of this.syncInFlightQueue) {
|
|
236
|
+
if (this.closed) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const has = await this.checkHasCoordinateOrHash(key);
|
|
240
|
+
if (!has) {
|
|
241
|
+
// TODO test that this if statement actually does anymeaningfull
|
|
242
|
+
if (value.length > 0) {
|
|
243
|
+
requestHashes.push(key);
|
|
244
|
+
const publicKeyHash = value.shift().hashcode();
|
|
245
|
+
from.add(publicKeyHash);
|
|
246
|
+
const invertedSet = this.syncInFlightQueueInverted.get(publicKeyHash);
|
|
247
|
+
if (invertedSet) {
|
|
248
|
+
if (invertedSet.delete(key)) {
|
|
249
|
+
if (invertedSet.size === 0) {
|
|
250
|
+
this.syncInFlightQueueInverted.delete(publicKeyHash);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (value.length === 0) {
|
|
256
|
+
this.syncInFlightQueue.delete(key); // no-one more to ask for this entry
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.syncInFlightQueue.delete(key);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const nowMin10s = +new Date() - 2e4;
|
|
264
|
+
for (const [key, map] of this.syncInFlight) {
|
|
265
|
+
// cleanup "old" missing syncs
|
|
266
|
+
for (const [hash, { timestamp }] of map) {
|
|
267
|
+
if (timestamp < nowMin10s) {
|
|
268
|
+
map.delete(hash);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (map.size === 0) {
|
|
272
|
+
this.syncInFlight.delete(key);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
this.requestSync(requestHashes, from).finally(() => {
|
|
276
|
+
if (this.closed) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
this.syncMoreInterval = setTimeout(requestSyncLoop, 3e3);
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
requestSyncLoop();
|
|
283
|
+
}
|
|
284
|
+
async close() {
|
|
285
|
+
this.closed = true;
|
|
286
|
+
this.syncInFlightQueue.clear();
|
|
287
|
+
this.syncInFlightQueueInverted.clear();
|
|
288
|
+
this.syncInFlight.clear();
|
|
289
|
+
clearTimeout(this.syncMoreInterval);
|
|
290
|
+
}
|
|
291
|
+
onEntryAdded(entry) {
|
|
292
|
+
return this.clearSyncProcess(entry.hash);
|
|
293
|
+
}
|
|
294
|
+
onEntryRemoved(hash) {
|
|
295
|
+
return this.clearSyncProcess(hash);
|
|
296
|
+
}
|
|
297
|
+
clearSyncProcess(hash) {
|
|
298
|
+
const inflight = this.syncInFlightQueue.get(hash);
|
|
299
|
+
if (inflight) {
|
|
300
|
+
for (const key of inflight) {
|
|
301
|
+
const map = this.syncInFlightQueueInverted.get(key.hashcode());
|
|
302
|
+
if (map) {
|
|
303
|
+
map.delete(hash);
|
|
304
|
+
if (map.size === 0) {
|
|
305
|
+
this.syncInFlightQueueInverted.delete(key.hashcode());
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
this.syncInFlightQueue.delete(hash);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
onPeerDisconnected(key) {
|
|
313
|
+
return this.clearSyncProcessPublicKey(key);
|
|
314
|
+
}
|
|
315
|
+
clearSyncProcessPublicKey(publicKey) {
|
|
316
|
+
this.syncInFlight.delete(publicKey.hashcode());
|
|
317
|
+
const map = this.syncInFlightQueueInverted.get(publicKey.hashcode());
|
|
318
|
+
if (map) {
|
|
319
|
+
for (const hash of map) {
|
|
320
|
+
const arr = this.syncInFlightQueue.get(hash);
|
|
321
|
+
if (arr) {
|
|
322
|
+
const filtered = arr.filter((x) => !x.equals(publicKey));
|
|
323
|
+
if (filtered.length > 0) {
|
|
324
|
+
this.syncInFlightQueue.set(hash, filtered);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
this.syncInFlightQueue.delete(hash);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
this.syncInFlightQueueInverted.delete(publicKey.hashcode());
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
get pending() {
|
|
335
|
+
return this.syncInFlightQueue.size;
|
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QAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrE,IAAI,GAAG,EAAE,CAAC;YACT,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;gBACxB,MAAM,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC7C,IAAI,GAAG,EAAE,CAAC;oBACT,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;oBACzD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACzB,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;oBAC5C,CAAC;yBAAM,CAAC;wBACP,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;oBACrC,CAAC;gBACF,CAAC;YACF,CAAC;YACD,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;IACpC,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=wasm-init.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-init.browser.d.ts","sourceRoot":"","sources":["../../../src/sync/wasm-init.browser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-init.browser.js","sourceRoot":"","sources":["../../../src/sync/wasm-init.browser.ts"],"names":[],"mappings":";AAAA,gEAAgE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-init.d.ts","sourceRoot":"","sources":["../../../src/sync/wasm-init.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Override globalThis.fetch to intercept .wasm requests
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
const defaultFetch = globalThis.fetch.bind(globalThis);
|
|
4
|
+
globalThis.fetch = async (url, options) => {
|
|
5
|
+
// If you have multiple wasm files, you might use some logic to handle them.
|
|
6
|
+
// Here, we assume any request ending in `.wasm` is local on disk at the same path.
|
|
7
|
+
if (url.toString().endsWith(".wasm")) {
|
|
8
|
+
// Return a NodeResponse that looks enough like a fetch Response
|
|
9
|
+
return readFile(url);
|
|
10
|
+
}
|
|
11
|
+
return defaultFetch(url, options);
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=wasm-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-init.js","sourceRoot":"","sources":["../../../src/sync/wasm-init.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtD,UAAU,CAAC,KAAa,GAAG,KAAK,EAAE,GAAQ,EAAE,OAAY,EAAE,EAAE;IAC5D,4EAA4E;IAC5E,mFAAmF;IACnF,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,gEAAgE;QAChE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entry, ShallowEntry } from "@peerbit/log";
|
|
2
2
|
import type { EntryWithRefs } from "./exchange-heads.js";
|
|
3
|
-
import { EntryReplicated } from "./ranges.js";
|
|
4
|
-
export declare const groupByGid: <T extends ShallowEntry | Entry<any> | EntryWithRefs<any> | EntryReplicated
|
|
5
|
-
export declare const groupByGidSync: <T extends ShallowEntry | EntryReplicated
|
|
3
|
+
import { type EntryReplicated } from "./ranges.js";
|
|
4
|
+
export declare const groupByGid: <T extends ShallowEntry | Entry<any> | EntryWithRefs<any> | EntryReplicated<any>>(entries: T[]) => Promise<Map<string, T[]>>;
|
|
5
|
+
export declare const groupByGidSync: <T extends ShallowEntry | EntryReplicated<any>>(entries: T[]) => Promise<Map<string, T[]>>;
|
|
6
6
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,aAAa,CAAC;AAEtE,eAAO,MAAM,UAAU,GACtB,CAAC,SACE,YAAY,GACZ,KAAK,CAAC,GAAG,CAAC,GACV,aAAa,CAAC,GAAG,CAAC,GAClB,eAAe,CAAC,GAAG,CAAC,WAEd,CAAC,EAAE,KACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAmB1B,CAAC;AAEF,eAAO,MAAM,cAAc,GAC1B,CAAC,SAAS,YAAY,GAAG,eAAe,CAAC,GAAG,CAAC,WAEpC,CAAC,EAAE,KACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAiB1B,CAAC"}
|
package/dist/src/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Entry, ShallowEntry } from "@peerbit/log";
|
|
2
|
-
import {
|
|
2
|
+
import { isEntryReplicated } from "./ranges.js";
|
|
3
3
|
export const groupByGid = async (entries) => {
|
|
4
4
|
const groupByGid = new Map();
|
|
5
5
|
for (const head of entries) {
|
|
@@ -7,7 +7,7 @@ export const groupByGid = async (entries) => {
|
|
|
7
7
|
? (await head.getMeta()).gid
|
|
8
8
|
: head instanceof ShallowEntry
|
|
9
9
|
? head.meta.gid
|
|
10
|
-
: head
|
|
10
|
+
: isEntryReplicated(head)
|
|
11
11
|
? head.gid
|
|
12
12
|
: (await head.entry.getMeta()).gid;
|
|
13
13
|
let value = groupByGid.get(gid);
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAwB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAO9B,OAAY,EACgB,EAAE;IAC9B,MAAM,UAAU,GAAqB,IAAI,GAAG,EAAE,CAAC;IAC/C,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,GAAG,GACR,IAAI,YAAY,KAAK;YACpB,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,O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AAC,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,71 +1,75 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
2
|
+
"name": "@peerbit/shared-log",
|
|
3
|
+
"version": "10.0.0-05f4bef",
|
|
4
|
+
"description": "Shared log",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"*": [
|
|
11
|
+
"*",
|
|
12
|
+
"dist/*",
|
|
13
|
+
"dist/src/*",
|
|
14
|
+
"dist/src/*/index"
|
|
15
|
+
],
|
|
16
|
+
"src/*": [
|
|
17
|
+
"*",
|
|
18
|
+
"dist/*",
|
|
19
|
+
"dist/src/*",
|
|
20
|
+
"dist/src/*/index"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"dist",
|
|
27
|
+
"!dist/e2e",
|
|
28
|
+
"!dist/test",
|
|
29
|
+
"!**/*.tsbuildinfo"
|
|
30
|
+
],
|
|
31
|
+
"browser": {
|
|
32
|
+
"./dist/src/sync/wasm-init.js": "./dist/src/sync/wasm-init.browser.js"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/src/index.d.ts",
|
|
37
|
+
"import": "./dist/src/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"eslintConfig": {
|
|
41
|
+
"extends": "peerbit",
|
|
42
|
+
"parserOptions": {
|
|
43
|
+
"project": true,
|
|
44
|
+
"sourceType": "module"
|
|
45
|
+
},
|
|
46
|
+
"ignorePatterns": [
|
|
47
|
+
"!.aegir.js",
|
|
48
|
+
"test/ts-use",
|
|
49
|
+
"*.d.ts"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"clean": "aegir clean",
|
|
57
|
+
"build": "aegir build --no-bundle",
|
|
58
|
+
"test": "aegir test --target node",
|
|
59
|
+
"lint": "aegir lint"
|
|
60
|
+
},
|
|
61
|
+
"author": "dao.xyz",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@dao-xyz/borsh": "^5.2.3",
|
|
65
|
+
"@peerbit/logger": "1.0.3-05f4bef",
|
|
66
|
+
"@peerbit/program": "5.1.0-05f4bef",
|
|
67
|
+
"@peerbit/log": "4.0.22-05f4bef",
|
|
68
|
+
"@peerbit/rpc": "5.0.20-05f4bef",
|
|
69
|
+
"@peerbit/time": "2.0.7-05f4bef",
|
|
70
|
+
"@peerbit/riblt": "1.0.0-05f4bef"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@peerbit/test-utils": "2.1.10-05f4bef"
|
|
74
|
+
}
|
|
71
75
|
}
|