@loro-dev/flock 4.4.0 → 4.4.2
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/README.md +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_moon_flock.ts +3642 -4260
- package/src/index.ts +51 -91
package/dist/index.d.mts
CHANGED
|
@@ -122,8 +122,7 @@ declare class Flock {
|
|
|
122
122
|
private inner;
|
|
123
123
|
private listeners;
|
|
124
124
|
private nativeUnsubscribe;
|
|
125
|
-
|
|
126
|
-
private debounceState;
|
|
125
|
+
private readonly eventBatcher;
|
|
127
126
|
constructor(peerId?: string);
|
|
128
127
|
private static fromInner;
|
|
129
128
|
static fromJson(bundle: ExportBundle, peerId: string): Flock;
|
|
@@ -159,8 +158,15 @@ declare class Flock {
|
|
|
159
158
|
merge(other: Flock): void;
|
|
160
159
|
/**
|
|
161
160
|
* Returns the exclusive version vector, which only includes peers that have
|
|
162
|
-
* at least one entry in the current state.
|
|
163
|
-
*
|
|
161
|
+
* at least one entry in the current state.
|
|
162
|
+
*
|
|
163
|
+
* Complexity: O(M + V log M + R (log L + log S)).
|
|
164
|
+
* - M = memtablePeerCount
|
|
165
|
+
* - V = vvPeerCount
|
|
166
|
+
* - L = memtableLen
|
|
167
|
+
* - R = scanned candidate rows in KV_BY_PEER_CLOCK
|
|
168
|
+
* - S = storage key count in KV_BY_KEY
|
|
169
|
+
* No full O(memtableSize) pre-scan is performed.
|
|
164
170
|
*
|
|
165
171
|
* Use this version when sending to other peers for incremental sync.
|
|
166
172
|
*/
|
|
@@ -192,8 +198,7 @@ declare class Flock {
|
|
|
192
198
|
scan(options?: ScanOptions): ScanRow[];
|
|
193
199
|
private ensureNativeSubscription;
|
|
194
200
|
private handleBatch;
|
|
195
|
-
private
|
|
196
|
-
private resetDebounceTimer;
|
|
201
|
+
private deliverBatch;
|
|
197
202
|
subscribe(listener: (batch: EventBatch) => void): () => void;
|
|
198
203
|
/**
|
|
199
204
|
* Enable auto-debounce mode. Events will be accumulated and emitted after
|
|
@@ -250,6 +255,7 @@ declare class Flock {
|
|
|
250
255
|
* @returns The return value of the callback
|
|
251
256
|
* @throws Error if nested transaction attempted
|
|
252
257
|
* @throws Error if import is called during the transaction (auto-commits first)
|
|
258
|
+
* @throws Error if called while autoDebounceCommit is active
|
|
253
259
|
*
|
|
254
260
|
* @example
|
|
255
261
|
* ```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -122,8 +122,7 @@ declare class Flock {
|
|
|
122
122
|
private inner;
|
|
123
123
|
private listeners;
|
|
124
124
|
private nativeUnsubscribe;
|
|
125
|
-
|
|
126
|
-
private debounceState;
|
|
125
|
+
private readonly eventBatcher;
|
|
127
126
|
constructor(peerId?: string);
|
|
128
127
|
private static fromInner;
|
|
129
128
|
static fromJson(bundle: ExportBundle, peerId: string): Flock;
|
|
@@ -159,8 +158,15 @@ declare class Flock {
|
|
|
159
158
|
merge(other: Flock): void;
|
|
160
159
|
/**
|
|
161
160
|
* Returns the exclusive version vector, which only includes peers that have
|
|
162
|
-
* at least one entry in the current state.
|
|
163
|
-
*
|
|
161
|
+
* at least one entry in the current state.
|
|
162
|
+
*
|
|
163
|
+
* Complexity: O(M + V log M + R (log L + log S)).
|
|
164
|
+
* - M = memtablePeerCount
|
|
165
|
+
* - V = vvPeerCount
|
|
166
|
+
* - L = memtableLen
|
|
167
|
+
* - R = scanned candidate rows in KV_BY_PEER_CLOCK
|
|
168
|
+
* - S = storage key count in KV_BY_KEY
|
|
169
|
+
* No full O(memtableSize) pre-scan is performed.
|
|
164
170
|
*
|
|
165
171
|
* Use this version when sending to other peers for incremental sync.
|
|
166
172
|
*/
|
|
@@ -192,8 +198,7 @@ declare class Flock {
|
|
|
192
198
|
scan(options?: ScanOptions): ScanRow[];
|
|
193
199
|
private ensureNativeSubscription;
|
|
194
200
|
private handleBatch;
|
|
195
|
-
private
|
|
196
|
-
private resetDebounceTimer;
|
|
201
|
+
private deliverBatch;
|
|
197
202
|
subscribe(listener: (batch: EventBatch) => void): () => void;
|
|
198
203
|
/**
|
|
199
204
|
* Enable auto-debounce mode. Events will be accumulated and emitted after
|
|
@@ -250,6 +255,7 @@ declare class Flock {
|
|
|
250
255
|
* @returns The return value of the callback
|
|
251
256
|
* @throws Error if nested transaction attempted
|
|
252
257
|
* @throws Error if import is called during the transaction (auto-commits first)
|
|
258
|
+
* @throws Error if called while autoDebounceCommit is active
|
|
253
259
|
*
|
|
254
260
|
* @example
|
|
255
261
|
* ```ts
|