signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
87 lines • 2.31 kB
TypeScript
/**
* Migration Service
*
* Handles migration of existing flat-structure Parquet files to
* the new Hive-style partitioned structure.
*/
import { ServerAPI } from '@signalk/server-api';
import { AggregationTier } from '../utils/hive-path-builder';
export interface MigrationConfig {
sourceDirectory: string;
targetDirectory: string;
targetTier: AggregationTier;
deleteSourceAfterMigration: boolean;
triggerAggregation?: boolean;
}
export interface MigrationProgress {
jobId: string;
status: 'scanning' | 'running' | 'completed' | 'cancelled' | 'error';
phase: 'scan' | 'migrate' | 'cleanup' | 'aggregation';
processed: number;
total: number;
percent: number;
currentFile?: string;
startTime: Date;
completedAt?: Date;
error?: string;
bytesProcessed: number;
filesMigrated: number;
filesSkipped: number;
errors: string[];
aggregationDatesProcessed?: number;
aggregationDatesTotal?: number;
aggregationCurrentDate?: string;
}
export interface ScanResult {
totalFiles: number;
totalSize: number;
byPath: Map<string, {
count: number;
size: number;
}>;
estimatedTime: number;
sourceStyle: 'flat' | 'mixed' | 'unknown';
}
export declare class MigrationService {
private readonly app;
private readonly hivePathBuilder;
private cancelRequested;
constructor(app: ServerAPI);
/**
* Scan source directory for files to migrate
*/
scan(sourceDirectory: string): Promise<ScanResult>;
/**
* Start migration job
*/
migrate(config: MigrationConfig): Promise<string>;
/**
* Run the migration process
*/
private runMigration;
/**
* Migrate a single file
*/
private migrateFile;
/**
* Extract the earliest timestamp from a parquet file
*/
private extractTimestampFromFile;
/**
* Clean up empty directories after migration
*/
private cleanupEmptyDirectories;
/**
* Get migration job progress
*/
getProgress(jobId: string): MigrationProgress | null;
/**
* Cancel a running migration job
*/
cancel(jobId: string): boolean;
/**
* Get all job IDs
*/
getJobIds(): string[];
}
//# sourceMappingURL=migration-service.d.ts.map