import { Observable } from 'rxjs'; import type { NumberFunctionMap, RxCollection, RxDatabase, RxStorageInstance, RxStorageInstanceReplicationState } from '../../types/index.d.ts'; import { getOldCollectionMeta, mustMigrate } from './migration-helpers.ts'; import type { MigrationStatusUpdate, RxMigrationStatus } from './migration-types.ts'; import { BroadcastChannel } from 'broadcast-channel'; export declare class RxMigrationState { readonly collection: RxCollection; readonly migrationStrategies: NumberFunctionMap; readonly statusDocKey: string; database: RxDatabase; private started; readonly oldCollectionMeta: ReturnType; readonly mustMigrate: ReturnType; readonly statusDocId: string; readonly $: Observable; /** * Contains ALL replication states * that are ever used in this migration state. */ replicationStates: Set>; canceled: boolean; broadcastChannel?: BroadcastChannel; constructor(collection: RxCollection, migrationStrategies: NumberFunctionMap, statusDocKey?: string); getStatus(): Promise; /** * Starts the migration. * Returns void so that people to not get the idea to await * this function. * Instead use migratePromise() if you want to await * the migration. This ensures it works even if the migration * is run on a different browser tab. */ startMigration(batchSize?: number): Promise; updateStatusHandlers: MigrationStatusUpdate[]; updateStatusQueue: Promise; updateStatus(handler: MigrationStatusUpdate): Promise; migrateStorage(oldStorage: RxStorageInstance, newStorage: RxStorageInstance, batchSize: number): Promise; /** * Stops the migration. * Mostly used in tests to simulate what happens * when the user reloads the page during a migration. */ cancel(): Promise; countAllDocuments(storageInstances: RxStorageInstance[]): Promise; getConnectedStorageInstances(): Promise<{ oldStorage: RxStorageInstance; newStorage: RxStorageInstance; }[]>; migratePromise(batchSize?: number): Promise; }