sliftutils 1.1.47 → 1.1.49
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/index.d.ts +27 -8
- package/package.json +2 -2
- package/storage/BulkDatabase2/BulkDatabase2.d.ts +4 -73
- package/storage/BulkDatabase2/BulkDatabase2.ts +29 -731
- package/storage/BulkDatabase2/BulkDatabaseBase.d.ts +84 -0
- package/storage/BulkDatabase2/BulkDatabaseBase.ts +795 -0
- package/yarn.lock +4 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { FileStorage } from "../FileFolderAPI";
|
|
2
|
+
export interface ReactiveDeps {
|
|
3
|
+
observe(signal: string): void;
|
|
4
|
+
invalidate(signal: string): void;
|
|
5
|
+
batch(fn: () => void): void;
|
|
6
|
+
}
|
|
7
|
+
export declare const noopReactiveDeps: ReactiveDeps;
|
|
8
|
+
export type StorageFactory = (path: string) => Promise<FileStorage>;
|
|
9
|
+
export declare class BulkDatabaseBase<T extends {
|
|
10
|
+
key: string;
|
|
11
|
+
}> {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
protected deps: ReactiveDeps;
|
|
14
|
+
private storageFactory;
|
|
15
|
+
constructor(name: string, deps: ReactiveDeps, storageFactory: StorageFactory);
|
|
16
|
+
static clearCache(): void;
|
|
17
|
+
storage: {
|
|
18
|
+
(): Promise<FileStorage>;
|
|
19
|
+
reset(): void;
|
|
20
|
+
set(newValue: Promise<FileStorage>): void;
|
|
21
|
+
};
|
|
22
|
+
private overlay;
|
|
23
|
+
private streamTimes;
|
|
24
|
+
private streamFileName;
|
|
25
|
+
private streamRowsWritten;
|
|
26
|
+
private getStreamFileName;
|
|
27
|
+
private setOverlay;
|
|
28
|
+
private reader;
|
|
29
|
+
private syncSetup;
|
|
30
|
+
private localTime;
|
|
31
|
+
private applyRemote;
|
|
32
|
+
private resetReader;
|
|
33
|
+
write(entry: T): Promise<void>;
|
|
34
|
+
writeBatch(entries: T[]): Promise<void>;
|
|
35
|
+
delete(key: string): Promise<void>;
|
|
36
|
+
deleteBatch(keys: string[]): Promise<void>;
|
|
37
|
+
private writeBulkFile;
|
|
38
|
+
private listStreamFiles;
|
|
39
|
+
private loadStreamEntries;
|
|
40
|
+
private orderStreamEntries;
|
|
41
|
+
private maybeRolloverStream;
|
|
42
|
+
private rolloverStream;
|
|
43
|
+
compact(): Promise<void>;
|
|
44
|
+
private listFiles;
|
|
45
|
+
private makeRawGetRange;
|
|
46
|
+
private loadFileReader;
|
|
47
|
+
private fileLogicalSize;
|
|
48
|
+
private handleUnreadableFile;
|
|
49
|
+
private mergeFilesBase;
|
|
50
|
+
private mergeFiles;
|
|
51
|
+
private formatInfo;
|
|
52
|
+
private patchColumn;
|
|
53
|
+
getSingleField<Column extends keyof T>(key: string, column: Column): Promise<T[Column] | undefined>;
|
|
54
|
+
getColumn<Column extends keyof T>(column: Column): Promise<{
|
|
55
|
+
key: string;
|
|
56
|
+
value: T[Column];
|
|
57
|
+
}[]>;
|
|
58
|
+
getKeys(): Promise<string[]>;
|
|
59
|
+
private baseColumns;
|
|
60
|
+
private baseColumnsLoading;
|
|
61
|
+
private baseFields;
|
|
62
|
+
private baseFieldsLoading;
|
|
63
|
+
private ensureBaseColumn;
|
|
64
|
+
private ensureBaseField;
|
|
65
|
+
getSingleFieldSync<Column extends keyof T>(key: string, column: Column): T[Column] | undefined;
|
|
66
|
+
getColumnSync<Column extends keyof T>(column: Column): {
|
|
67
|
+
key: string;
|
|
68
|
+
value: T[Column];
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
getColumnInfo(): Promise<{
|
|
71
|
+
column: string;
|
|
72
|
+
byteSize: number;
|
|
73
|
+
}[]>;
|
|
74
|
+
getReaderInfo(): Promise<{
|
|
75
|
+
rowCount: number;
|
|
76
|
+
totalBytes: number;
|
|
77
|
+
keyCount: number;
|
|
78
|
+
sampleKey: string | undefined;
|
|
79
|
+
columns: {
|
|
80
|
+
column: string;
|
|
81
|
+
byteSize: number;
|
|
82
|
+
}[];
|
|
83
|
+
}>;
|
|
84
|
+
}
|