11import { BaseListener , BaseObserverInterface , Disposable } from '../../../utils/BaseObserver.js' ;
22import { CrudBatch } from './CrudBatch.js' ;
3- import { CrudEntry , OpId } from './CrudEntry.js' ;
4- import { SyncDataBatch } from './SyncDataBatch.js' ;
5-
6- export interface BucketDescription {
7- name : string ;
8- priority : number ;
9- }
10-
11- export interface Checkpoint {
12- last_op_id : OpId ;
13- buckets : BucketChecksum [ ] ;
14- write_checkpoint ?: string ;
15- streams ?: any [ ] ;
16- }
17-
18- export interface BucketState {
19- bucket : string ;
20- op_id : string ;
21- }
22-
23- export interface ChecksumCache {
24- checksums : Map < string , { checksum : BucketChecksum ; last_op_id : OpId } > ;
25- lastOpId : OpId ;
26- }
27-
28- export interface SyncLocalDatabaseResult {
29- ready : boolean ;
30- checkpointValid : boolean ;
31- checkpointFailures ?: string [ ] ;
32- }
33-
34- export type SavedProgress = {
35- atLast : number ;
36- sinceLast : number ;
37- } ;
38-
39- export type BucketOperationProgress = Record < string , SavedProgress > ;
40-
41- export interface BucketChecksum {
42- bucket : string ;
43- priority ?: number ;
44- /**
45- * 32-bit unsigned hash.
46- */
47- checksum : number ;
48-
49- /**
50- * Count of operations - informational only.
51- */
52- count ?: number ;
53- /**
54- * The JavaScript client does not use this field, which is why it's defined to be `any`. We rely on the structure of
55- * this interface to pass custom `BucketChecksum`s to the Rust client in unit tests, which so all fields need to be
56- * present.
57- */
58- subscriptions ?: any ;
59- }
3+ import { CrudEntry } from './CrudEntry.js' ;
604
615export enum PSInternalTable {
626 DATA = 'ps_data' ,
@@ -82,27 +26,14 @@ export interface BucketStorageListener extends BaseListener {
8226
8327export interface BucketStorageAdapter extends BaseObserverInterface < BucketStorageListener > , Disposable {
8428 init ( ) : Promise < void > ;
85- saveSyncData ( batch : SyncDataBatch , fixedKeyFormat ?: boolean ) : Promise < void > ;
86- removeBuckets ( buckets : string [ ] ) : Promise < void > ;
87- setTargetCheckpoint ( checkpoint : Checkpoint ) : Promise < void > ;
8829
89- startSession ( ) : void ;
90-
91- getBucketStates ( ) : Promise < BucketState [ ] > ;
92- getBucketOperationProgress ( ) : Promise < BucketOperationProgress > ;
9330 hasMigratedSubkeys ( ) : Promise < boolean > ;
9431 migrateToFixedSubkeys ( ) : Promise < void > ;
9532
96- syncLocalDatabase (
97- checkpoint : Checkpoint ,
98- priority ?: number
99- ) : Promise < { checkpointValid : boolean ; ready : boolean ; failures ?: any [ ] } > ;
100-
10133 nextCrudItem ( ) : Promise < CrudEntry | undefined > ;
10234 hasCrud ( ) : Promise < boolean > ;
10335 getCrudBatch ( limit ?: number ) : Promise < CrudBatch | null > ;
10436
105- hasCompletedSync ( ) : Promise < boolean > ;
10637 updateLocalTarget ( cb : ( ) => Promise < string > ) : Promise < boolean > ;
10738 getMaxOpId ( ) : string ;
10839
0 commit comments