@peerbit/shared-log 16.0.6 → 16.0.8
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/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/ranges.d.ts +50 -1
- package/dist/src/ranges.d.ts.map +1 -1
- package/dist/src/ranges.js +273 -112
- package/dist/src/ranges.js.map +1 -1
- package/dist/src/sync/factory.d.ts.map +1 -1
- package/dist/src/sync/factory.js +8 -2
- package/dist/src/sync/factory.js.map +1 -1
- package/dist/src/sync/index.d.ts +12 -0
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/rateless-iblt.d.ts +1 -0
- package/dist/src/sync/rateless-iblt.d.ts.map +1 -1
- package/dist/src/sync/rateless-iblt.js +67 -14
- package/dist/src/sync/rateless-iblt.js.map +1 -1
- package/dist/src/sync/simple.d.ts.map +1 -1
- package/dist/src/sync/simple.js +36 -10
- package/dist/src/sync/simple.js.map +1 -1
- package/package.json +15 -14
- package/src/index.ts +34 -9
- package/src/ranges.ts +436 -165
- package/src/sync/factory.ts +11 -2
- package/src/sync/index.ts +14 -4
- package/src/sync/rateless-iblt.ts +81 -24
- package/src/sync/simple.ts +45 -14
package/src/index.ts
CHANGED
|
@@ -915,6 +915,13 @@ type NativeAppendEntryPlan<R extends "u32" | "u64"> = {
|
|
|
915
915
|
committedNativeCoordinateDeletes?: boolean;
|
|
916
916
|
};
|
|
917
917
|
|
|
918
|
+
type NativeFullReplicaCandidateSource = {
|
|
919
|
+
fullReplicaCandidatesFor?: (
|
|
920
|
+
minReplicas: number,
|
|
921
|
+
selfHash: string,
|
|
922
|
+
) => string[];
|
|
923
|
+
};
|
|
924
|
+
|
|
918
925
|
type EntryLeaderBatchItem<R extends "u32" | "u64"> = {
|
|
919
926
|
entry: ShallowOrFullEntry<any> | EntryReplicated<R>;
|
|
920
927
|
replicas: number;
|
|
@@ -8050,6 +8057,21 @@ export class SharedLog<
|
|
|
8050
8057
|
return candidates;
|
|
8051
8058
|
}
|
|
8052
8059
|
|
|
8060
|
+
private async getNativeFullReplicaDeliveryCandidates(
|
|
8061
|
+
minReplicas: number,
|
|
8062
|
+
selfHash: string,
|
|
8063
|
+
): Promise<Set<string>> {
|
|
8064
|
+
const source = (this._nativeBackbone ?? this._nativeSharedLogState) as
|
|
8065
|
+
| NativeFullReplicaCandidateSource
|
|
8066
|
+
| undefined;
|
|
8067
|
+
if (typeof source?.fullReplicaCandidatesFor === "function") {
|
|
8068
|
+
return new Set(source.fullReplicaCandidatesFor(minReplicas, selfHash));
|
|
8069
|
+
}
|
|
8070
|
+
return this.getFullReplicaRepairCandidates(undefined, {
|
|
8071
|
+
includeSubscribers: false,
|
|
8072
|
+
});
|
|
8073
|
+
}
|
|
8074
|
+
|
|
8053
8075
|
private removeRepairFrontierTarget(
|
|
8054
8076
|
target: string,
|
|
8055
8077
|
options?: { expectedWarmupSession?: WarmupSession | null },
|
|
@@ -13566,9 +13588,10 @@ export class SharedLog<
|
|
|
13566
13588
|
ownershipLifecycleController,
|
|
13567
13589
|
);
|
|
13568
13590
|
const fullReplicaDeliveryCandidates =
|
|
13569
|
-
await this.
|
|
13570
|
-
|
|
13571
|
-
|
|
13591
|
+
await this.getNativeFullReplicaDeliveryCandidates(
|
|
13592
|
+
replicas,
|
|
13593
|
+
context.selfHash,
|
|
13594
|
+
);
|
|
13572
13595
|
this.throwIfReplicationOwnershipLifecycleInactive(
|
|
13573
13596
|
ownershipLifecycleController,
|
|
13574
13597
|
);
|
|
@@ -13712,9 +13735,10 @@ export class SharedLog<
|
|
|
13712
13735
|
ownershipLifecycleController,
|
|
13713
13736
|
);
|
|
13714
13737
|
const fullReplicaDeliveryCandidates =
|
|
13715
|
-
await this.
|
|
13716
|
-
|
|
13717
|
-
|
|
13738
|
+
await this.getNativeFullReplicaDeliveryCandidates(
|
|
13739
|
+
replicas,
|
|
13740
|
+
context.selfHash,
|
|
13741
|
+
);
|
|
13718
13742
|
this.throwIfReplicationOwnershipLifecycleInactive(
|
|
13719
13743
|
ownershipLifecycleController,
|
|
13720
13744
|
);
|
|
@@ -13924,9 +13948,10 @@ export class SharedLog<
|
|
|
13924
13948
|
ownershipLifecycleController,
|
|
13925
13949
|
);
|
|
13926
13950
|
const fullReplicaDeliveryCandidates =
|
|
13927
|
-
await this.
|
|
13928
|
-
|
|
13929
|
-
|
|
13951
|
+
await this.getNativeFullReplicaDeliveryCandidates(
|
|
13952
|
+
replicas,
|
|
13953
|
+
context.selfHash,
|
|
13954
|
+
);
|
|
13930
13955
|
this.throwIfReplicationOwnershipLifecycleInactive(
|
|
13931
13956
|
ownershipLifecycleController,
|
|
13932
13957
|
);
|