sliftutils 1.4.47 → 1.4.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 +375 -71
- package/package.json +1 -1
- package/storage/BulkDatabase2/BulkDatabaseBase.d.ts +36 -70
- package/storage/BulkDatabase2/BulkDatabaseBase.ts +292 -1236
- package/storage/BulkDatabase2/BulkDatabaseFormat.d.ts +39 -1
- package/storage/BulkDatabase2/BulkDatabaseFormat.ts +242 -26
- package/storage/BulkDatabase2/BulkDatabaseMerge.d.ts +49 -0
- package/storage/BulkDatabase2/BulkDatabaseMerge.ts +398 -0
- package/storage/BulkDatabase2/BulkDatabaseReader.d.ts +71 -0
- package/storage/BulkDatabase2/BulkDatabaseReader.ts +273 -0
- package/storage/BulkDatabase2/LoadedIndex.d.ts +133 -0
- package/storage/BulkDatabase2/LoadedIndex.ts +402 -0
- package/storage/BulkDatabase2/WriteOverlay.d.ts +30 -0
- package/storage/BulkDatabase2/WriteOverlay.ts +52 -0
- package/storage/BulkDatabase2/blockCache.d.ts +1 -0
- package/storage/BulkDatabase2/blockCache.ts +6 -0
- package/storage/BulkDatabase2/streamLog.ts +78 -1
package/index.d.ts
CHANGED
|
@@ -967,16 +967,28 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseBase" {
|
|
|
967
967
|
private storageFactory;
|
|
968
968
|
private config;
|
|
969
969
|
constructor(name: string, deps: ReactiveDeps, storageFactory: StorageFactory, config?: BulkDatabase2Config);
|
|
970
|
-
private
|
|
971
|
-
private
|
|
972
|
-
private static lastMemoryFlushMs;
|
|
973
|
-
private static startMemoryWatchdog;
|
|
974
|
-
static checkMemoryPressure(usedHeapBytes: number): void;
|
|
970
|
+
private reader;
|
|
971
|
+
private subCaches;
|
|
975
972
|
private pendingAppends;
|
|
976
973
|
private flushTimer;
|
|
977
974
|
private flushChain;
|
|
978
975
|
private currentFlushDelay;
|
|
979
976
|
private lastWriteTime;
|
|
977
|
+
private streamFileName;
|
|
978
|
+
private currentStreamFileName;
|
|
979
|
+
private currentStreamFileBytes;
|
|
980
|
+
private lastMergeCheck;
|
|
981
|
+
private streamRowsOnDisk;
|
|
982
|
+
private streamBytesOnDisk;
|
|
983
|
+
private fileSetPollTimer;
|
|
984
|
+
private rebuildPromise;
|
|
985
|
+
private rebuildDirty;
|
|
986
|
+
private rebuildOptions;
|
|
987
|
+
private static liveInstances;
|
|
988
|
+
private static memoryWatchdogStarted;
|
|
989
|
+
private static lastMemoryFlushMs;
|
|
990
|
+
private static startMemoryWatchdog;
|
|
991
|
+
static checkMemoryPressure(usedHeapBytes: number): void;
|
|
980
992
|
static clearCache(): void;
|
|
981
993
|
static enableNetworkCompaction(): void;
|
|
982
994
|
storage: {
|
|
@@ -987,46 +999,15 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseBase" {
|
|
|
987
999
|
isRemote(): Promise<boolean>;
|
|
988
1000
|
private streamNeedsFold;
|
|
989
1001
|
private automaticCompactionAllowed;
|
|
990
|
-
private overlay;
|
|
991
|
-
private streamTimes;
|
|
992
|
-
private columnCache;
|
|
993
|
-
private readerKeys;
|
|
994
|
-
private loadedFileSet;
|
|
995
|
-
private loadedTotalBytes;
|
|
996
|
-
private readerEpoch;
|
|
997
|
-
private fileSetPollTimer;
|
|
998
|
-
private bulkReaderCache;
|
|
999
|
-
private streamReaderCache;
|
|
1000
|
-
private dataGen;
|
|
1001
|
-
private pendingSignals;
|
|
1002
|
-
private triggerTimer;
|
|
1003
|
-
private currentTriggerDelay;
|
|
1004
|
-
private lastTriggerTime;
|
|
1005
|
-
private streamRowsOnDisk;
|
|
1006
|
-
private streamBytesOnDisk;
|
|
1007
|
-
private streamFileName;
|
|
1008
|
-
private currentStreamFileName;
|
|
1009
|
-
private currentStreamFileBytes;
|
|
1010
|
-
private lastMergeCheck;
|
|
1011
|
-
private getStreamFileName;
|
|
1012
|
-
private invalidateOverlay;
|
|
1013
1002
|
isKeyWatched(key: string): boolean;
|
|
1014
|
-
private
|
|
1015
|
-
private
|
|
1016
|
-
private
|
|
1017
|
-
private setOverlayRow;
|
|
1018
|
-
private setOverlayDeleted;
|
|
1019
|
-
private reader;
|
|
1020
|
-
private buildReader;
|
|
1021
|
-
private syncSetup;
|
|
1022
|
-
private localTime;
|
|
1023
|
-
private applyRemote;
|
|
1024
|
-
private clearReaderState;
|
|
1025
|
-
private resetReader;
|
|
1026
|
-
private reloadReader;
|
|
1003
|
+
private ensureIndex;
|
|
1004
|
+
private triggerRebuild;
|
|
1005
|
+
private doOneRebuild;
|
|
1027
1006
|
reloadFromDisk(): void;
|
|
1028
|
-
private readWithReload;
|
|
1029
1007
|
private pollFileSet;
|
|
1008
|
+
private readWithRetry;
|
|
1009
|
+
private syncSetup;
|
|
1010
|
+
private applyRemote;
|
|
1030
1011
|
write(entry: T): Promise<void>;
|
|
1031
1012
|
writeBatch(entries: T[]): Promise<void>;
|
|
1032
1013
|
delete(key: string): Promise<void>;
|
|
@@ -1035,6 +1016,7 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseBase" {
|
|
|
1035
1016
|
flush(): Promise<void>;
|
|
1036
1017
|
private flushPending;
|
|
1037
1018
|
private doFlush;
|
|
1019
|
+
private getStreamFileName;
|
|
1038
1020
|
private foldOwnStream;
|
|
1039
1021
|
update(entry: Partial<T> & {
|
|
1040
1022
|
key: string;
|
|
@@ -1044,8 +1026,6 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseBase" {
|
|
|
1044
1026
|
})[]): Promise<void>;
|
|
1045
1027
|
private listFiles;
|
|
1046
1028
|
private writeBulkFile;
|
|
1047
|
-
private loadStreamEntries;
|
|
1048
|
-
private orderStreamEntries;
|
|
1049
1029
|
private maybeMerge;
|
|
1050
1030
|
tryMergeNow(): Promise<{
|
|
1051
1031
|
merged: boolean;
|
|
@@ -1053,53 +1033,39 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseBase" {
|
|
|
1053
1033
|
}>;
|
|
1054
1034
|
compact(): Promise<void>;
|
|
1055
1035
|
merge(timeLo: number, timeHi: number): Promise<void>;
|
|
1056
|
-
private makeRawGetRange;
|
|
1057
|
-
private loadFileReader;
|
|
1058
|
-
private pruneFileCaches;
|
|
1059
1036
|
private readBulkHeader;
|
|
1060
1037
|
private fileLogicalSize;
|
|
1061
1038
|
private handleUnreadableFile;
|
|
1062
|
-
private resolveReaders;
|
|
1063
1039
|
private mergeFileSet;
|
|
1064
1040
|
private canDeleteStream;
|
|
1065
1041
|
private mergeSpacingDelay;
|
|
1066
1042
|
private testMerge;
|
|
1067
1043
|
private findDuplicateGroups;
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
getSingleField<Column extends keyof T>(key: string, column: Column): Promise<T[Column] | undefined>;
|
|
1071
|
-
getSingleFieldObj<Column extends keyof T>(key: string, column: Column): Promise<{
|
|
1044
|
+
getSingleField<C extends keyof T>(key: string, column: C): Promise<T[C] | undefined>;
|
|
1045
|
+
getSingleFieldObj<C extends keyof T>(key: string, column: C): Promise<{
|
|
1072
1046
|
key: string;
|
|
1073
|
-
value: T[
|
|
1047
|
+
value: T[C];
|
|
1074
1048
|
time: number;
|
|
1075
1049
|
} | undefined>;
|
|
1076
|
-
getColumn<
|
|
1050
|
+
getColumn<C extends keyof T>(column: C): Promise<{
|
|
1077
1051
|
key: string;
|
|
1078
|
-
value: T[
|
|
1052
|
+
value: T[C];
|
|
1079
1053
|
time: number;
|
|
1080
1054
|
}[]>;
|
|
1081
1055
|
getKeys(): Promise<string[]>;
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
private baseFields;
|
|
1085
|
-
private baseFieldsLoading;
|
|
1086
|
-
private staleBaseColumns;
|
|
1087
|
-
private staleBaseFields;
|
|
1088
|
-
private ensureBaseColumn;
|
|
1089
|
-
private ensureBaseField;
|
|
1090
|
-
getSingleFieldSync<Column extends keyof T>(key: string, column: Column): T[Column] | undefined;
|
|
1091
|
-
getSingleFieldObjSync<Column extends keyof T>(key: string, column: Column): {
|
|
1056
|
+
getSingleFieldSync<C extends keyof T>(key: string, column: C): T[C] | undefined;
|
|
1057
|
+
getSingleFieldObjSync<C extends keyof T>(key: string, column: C): {
|
|
1092
1058
|
key: string;
|
|
1093
|
-
value: T[
|
|
1059
|
+
value: T[C];
|
|
1094
1060
|
time: number;
|
|
1095
1061
|
} | undefined;
|
|
1096
|
-
getColumnSync<
|
|
1062
|
+
getColumnSync<C extends keyof T>(column: C): {
|
|
1097
1063
|
key: string;
|
|
1098
|
-
value: T[
|
|
1064
|
+
value: T[C];
|
|
1099
1065
|
time: number;
|
|
1100
1066
|
}[] | undefined;
|
|
1101
|
-
isFieldLoadedSync<
|
|
1102
|
-
isColumnLoadedSync<
|
|
1067
|
+
isFieldLoadedSync<C extends keyof T>(key: string, column: C): boolean;
|
|
1068
|
+
isColumnLoadedSync<C extends keyof T>(column: C): boolean;
|
|
1103
1069
|
getColumnInfo(): Promise<{
|
|
1104
1070
|
column: string;
|
|
1105
1071
|
byteSize: number;
|
|
@@ -1140,8 +1106,43 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseFormat" {
|
|
|
1140
1106
|
export declare const KEY_COLUMN = "key";
|
|
1141
1107
|
export declare const EMPTY_BUFFER: Buffer;
|
|
1142
1108
|
export declare const ABSENT: unique symbol;
|
|
1109
|
+
export type RawCell = {
|
|
1110
|
+
type: number;
|
|
1111
|
+
bytes: Buffer;
|
|
1112
|
+
};
|
|
1113
|
+
export declare const TYPE_ABSENT_TAG = 14;
|
|
1114
|
+
export type ColumnIndex = {
|
|
1115
|
+
offsets: Uint32Array;
|
|
1116
|
+
types: Uint8Array;
|
|
1117
|
+
readValueBytes: (startRow: number, endRow: number) => Promise<Buffer>;
|
|
1118
|
+
};
|
|
1119
|
+
export declare function encodeValue(value: unknown): {
|
|
1120
|
+
type: number;
|
|
1121
|
+
bytes: Buffer;
|
|
1122
|
+
};
|
|
1143
1123
|
export declare const TARGET_FILE_BYTES: number;
|
|
1144
|
-
export
|
|
1124
|
+
export type RawRow = {
|
|
1125
|
+
key: string;
|
|
1126
|
+
time: number;
|
|
1127
|
+
cells: Map<string, RawCell>;
|
|
1128
|
+
};
|
|
1129
|
+
export declare function columnIndexByteLength(rowCount: number): number;
|
|
1130
|
+
export declare function assemblePlannedFile(config: {
|
|
1131
|
+
valueColumns: {
|
|
1132
|
+
name: string;
|
|
1133
|
+
blob: Buffer;
|
|
1134
|
+
}[];
|
|
1135
|
+
keys: string[];
|
|
1136
|
+
times: number[];
|
|
1137
|
+
}): Buffer;
|
|
1138
|
+
export interface BuiltFile {
|
|
1139
|
+
buffer: Buffer;
|
|
1140
|
+
minKey: string;
|
|
1141
|
+
maxKey: string;
|
|
1142
|
+
rowCount: number;
|
|
1143
|
+
}
|
|
1144
|
+
export declare function buildFileBuffer(rows: Record<string, unknown>[], times: number[], targetBytes?: number): BuiltFile[];
|
|
1145
|
+
export declare function buildFileBufferRaw(rows: RawRow[], targetBytes?: number): BuiltFile[];
|
|
1145
1146
|
export type BaseBulkDatabaseReader = {
|
|
1146
1147
|
rowCount: number;
|
|
1147
1148
|
totalBytes: number;
|
|
@@ -1161,6 +1162,9 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseFormat" {
|
|
|
1161
1162
|
value: unknown;
|
|
1162
1163
|
time: number;
|
|
1163
1164
|
}[]>;
|
|
1165
|
+
getRawColumn: (column: string) => Promise<Map<string, RawCell>>;
|
|
1166
|
+
getColumnIndex: (column: string) => Promise<ColumnIndex>;
|
|
1167
|
+
rowOfKey: (key: string) => number | undefined;
|
|
1164
1168
|
getSingleField: (key: string, column: string) => Promise<{
|
|
1165
1169
|
value: unknown;
|
|
1166
1170
|
time: number;
|
|
@@ -1185,6 +1189,305 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseFormat" {
|
|
|
1185
1189
|
|
|
1186
1190
|
}
|
|
1187
1191
|
|
|
1192
|
+
declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseMerge" {
|
|
1193
|
+
/// <reference types="node" />
|
|
1194
|
+
/// <reference types="node" />
|
|
1195
|
+
import { BaseBulkDatabaseReader } from "./BulkDatabaseFormat";
|
|
1196
|
+
type CopyRun = {
|
|
1197
|
+
sourceIdx: number;
|
|
1198
|
+
sourceStartRow: number;
|
|
1199
|
+
sourceEndRow: number;
|
|
1200
|
+
outputByteStart: number;
|
|
1201
|
+
byteLength: number;
|
|
1202
|
+
};
|
|
1203
|
+
type PlannedOutputColumn = {
|
|
1204
|
+
name: string;
|
|
1205
|
+
offsets: Uint32Array;
|
|
1206
|
+
types: Uint8Array;
|
|
1207
|
+
dataLength: number;
|
|
1208
|
+
runs: CopyRun[];
|
|
1209
|
+
};
|
|
1210
|
+
export type PlannedOutputFile = {
|
|
1211
|
+
keys: string[];
|
|
1212
|
+
times: number[];
|
|
1213
|
+
minKey: string;
|
|
1214
|
+
maxKey: string;
|
|
1215
|
+
columns: PlannedOutputColumn[];
|
|
1216
|
+
estimatedFileBytes: number;
|
|
1217
|
+
sourceCounts: Map<number, number>;
|
|
1218
|
+
};
|
|
1219
|
+
export type PlannedMergeOutput = {
|
|
1220
|
+
name: string;
|
|
1221
|
+
minKey: string;
|
|
1222
|
+
maxKey: string;
|
|
1223
|
+
rowCount: number;
|
|
1224
|
+
size: number;
|
|
1225
|
+
sources: Map<string, number>;
|
|
1226
|
+
};
|
|
1227
|
+
export declare function runPlannedMerge(config: {
|
|
1228
|
+
sources: BaseBulkDatabaseReader[];
|
|
1229
|
+
sourceNames: string[];
|
|
1230
|
+
collectionName: string;
|
|
1231
|
+
targetFileBytes?: number;
|
|
1232
|
+
targetBatchBytes?: number;
|
|
1233
|
+
writeFile: (data: Buffer) => Promise<{
|
|
1234
|
+
name: string;
|
|
1235
|
+
size: number;
|
|
1236
|
+
}>;
|
|
1237
|
+
}): Promise<{
|
|
1238
|
+
outputs: PlannedMergeOutput[];
|
|
1239
|
+
carriedDeletes: Map<string, number>;
|
|
1240
|
+
}>;
|
|
1241
|
+
export {};
|
|
1242
|
+
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
declare module "sliftutils/storage/BulkDatabase2/BulkDatabaseReader" {
|
|
1246
|
+
import { LoadedIndex } from "./LoadedIndex";
|
|
1247
|
+
import { WriteOverlay } from "./WriteOverlay";
|
|
1248
|
+
import type { ReactiveDeps } from "./BulkDatabaseBase";
|
|
1249
|
+
declare function nullJoin(a: string, b: string): string;
|
|
1250
|
+
export type ReaderConfig = {
|
|
1251
|
+
name: string;
|
|
1252
|
+
deps: ReactiveDeps;
|
|
1253
|
+
maxTriggerThrottleMs?: number;
|
|
1254
|
+
};
|
|
1255
|
+
export declare class BulkDatabaseReader<T extends {
|
|
1256
|
+
key: string;
|
|
1257
|
+
}> {
|
|
1258
|
+
private readonly cfg;
|
|
1259
|
+
constructor(cfg: ReaderConfig);
|
|
1260
|
+
index: LoadedIndex<T> | undefined;
|
|
1261
|
+
readonly overlay: WriteOverlay;
|
|
1262
|
+
private dataGen;
|
|
1263
|
+
private columnCache;
|
|
1264
|
+
private pendingSignals;
|
|
1265
|
+
private triggerTimer;
|
|
1266
|
+
private currentTriggerDelay;
|
|
1267
|
+
private lastTriggerTime;
|
|
1268
|
+
get name(): string;
|
|
1269
|
+
get deps(): ReactiveDeps;
|
|
1270
|
+
get dataGeneration(): number;
|
|
1271
|
+
setIndex(newIndex: LoadedIndex<T>, options?: {
|
|
1272
|
+
dropStaleFallback?: boolean;
|
|
1273
|
+
}): void;
|
|
1274
|
+
applyWrite(key: string, row: Record<string, unknown>, time: number): void;
|
|
1275
|
+
applyDelete(key: string, time: number): void;
|
|
1276
|
+
isKeyWatched(key: string): boolean;
|
|
1277
|
+
isLiveNow(key: string): boolean;
|
|
1278
|
+
localTime(key: string): number;
|
|
1279
|
+
private notifyOverlayMutation;
|
|
1280
|
+
getKeys(): Promise<string[]>;
|
|
1281
|
+
getColumn<C extends keyof T>(column: C): Promise<{
|
|
1282
|
+
key: string;
|
|
1283
|
+
value: T[C];
|
|
1284
|
+
time: number;
|
|
1285
|
+
}[]>;
|
|
1286
|
+
getSingleField<C extends keyof T>(key: string, column: C): Promise<T[C] | undefined>;
|
|
1287
|
+
getSingleFieldObj<C extends keyof T>(key: string, column: C): Promise<{
|
|
1288
|
+
key: string;
|
|
1289
|
+
value: T[C];
|
|
1290
|
+
time: number;
|
|
1291
|
+
} | undefined>;
|
|
1292
|
+
getSingleFieldSync<C extends keyof T>(key: string, column: C): T[C] | undefined;
|
|
1293
|
+
getSingleFieldObjSync<C extends keyof T>(key: string, column: C): {
|
|
1294
|
+
key: string;
|
|
1295
|
+
value: T[C];
|
|
1296
|
+
time: number;
|
|
1297
|
+
} | undefined;
|
|
1298
|
+
getColumnSync<C extends keyof T>(column: C): {
|
|
1299
|
+
key: string;
|
|
1300
|
+
value: T[C];
|
|
1301
|
+
time: number;
|
|
1302
|
+
}[] | undefined;
|
|
1303
|
+
isFieldLoadedSync<C extends keyof T>(key: string, column: C): boolean;
|
|
1304
|
+
isColumnLoadedSync<C extends keyof T>(column: C): boolean;
|
|
1305
|
+
setEnsureIndex(fn: () => Promise<LoadedIndex<T>>): void;
|
|
1306
|
+
private ensureIndexFn;
|
|
1307
|
+
private requireIndex;
|
|
1308
|
+
private formatInfo;
|
|
1309
|
+
private invalidateSignal;
|
|
1310
|
+
private flushSignals;
|
|
1311
|
+
}
|
|
1312
|
+
export declare const READER_SIGNALS: {
|
|
1313
|
+
LOAD: string;
|
|
1314
|
+
OVERLAY: string;
|
|
1315
|
+
};
|
|
1316
|
+
export { nullJoin };
|
|
1317
|
+
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
declare module "sliftutils/storage/BulkDatabase2/LoadedIndex" {
|
|
1321
|
+
import type { FileStorage } from "../FileFolderAPI";
|
|
1322
|
+
import { BaseBulkDatabaseReader } from "./BulkDatabaseFormat";
|
|
1323
|
+
import { GetRange } from "./blockCache";
|
|
1324
|
+
import { StreamEntry } from "./streamLog";
|
|
1325
|
+
export type BulkFileInfo = {
|
|
1326
|
+
fileName: string;
|
|
1327
|
+
level: number;
|
|
1328
|
+
timestamp: number;
|
|
1329
|
+
};
|
|
1330
|
+
export type StreamFileInfo = {
|
|
1331
|
+
fileName: string;
|
|
1332
|
+
timestamp: number;
|
|
1333
|
+
};
|
|
1334
|
+
export type StreamReaderCacheEntry = {
|
|
1335
|
+
readSize: number;
|
|
1336
|
+
parsedPos: number;
|
|
1337
|
+
entries: StreamEntry[];
|
|
1338
|
+
};
|
|
1339
|
+
export declare class MissingFileError extends Error {
|
|
1340
|
+
}
|
|
1341
|
+
export type ResolvedReader = {
|
|
1342
|
+
rowCount: number;
|
|
1343
|
+
totalBytes: number;
|
|
1344
|
+
keys: string[];
|
|
1345
|
+
rawKeyCount: number;
|
|
1346
|
+
readerCount: number;
|
|
1347
|
+
columns: {
|
|
1348
|
+
column: string;
|
|
1349
|
+
byteSize: number;
|
|
1350
|
+
}[];
|
|
1351
|
+
keyTimes: Map<string, number>;
|
|
1352
|
+
deleteTimes: Map<string, number>;
|
|
1353
|
+
getColumn: (column: string) => Promise<{
|
|
1354
|
+
key: string;
|
|
1355
|
+
value: unknown;
|
|
1356
|
+
time: number;
|
|
1357
|
+
}[]>;
|
|
1358
|
+
getSingleField: (key: string, column: string) => Promise<{
|
|
1359
|
+
value: unknown;
|
|
1360
|
+
time: number;
|
|
1361
|
+
} | undefined>;
|
|
1362
|
+
};
|
|
1363
|
+
export type SubReaderCaches = {
|
|
1364
|
+
bulk: Map<string, BaseBulkDatabaseReader>;
|
|
1365
|
+
stream: Map<string, StreamReaderCacheEntry>;
|
|
1366
|
+
};
|
|
1367
|
+
export declare class LoadedIndex<T extends {
|
|
1368
|
+
key: string;
|
|
1369
|
+
}> {
|
|
1370
|
+
readonly name: string;
|
|
1371
|
+
readonly storage: FileStorage;
|
|
1372
|
+
readonly bulkFiles: BulkFileInfo[];
|
|
1373
|
+
readonly streamFiles: StreamFileInfo[];
|
|
1374
|
+
readonly reader: ResolvedReader;
|
|
1375
|
+
readonly streamTimes: Map<string, number>;
|
|
1376
|
+
readonly streamSizes: Map<string, number>;
|
|
1377
|
+
readonly streamRowsOnDisk: number;
|
|
1378
|
+
readonly streamBytesOnDisk: number;
|
|
1379
|
+
readonly subCaches: SubReaderCaches;
|
|
1380
|
+
private constructor();
|
|
1381
|
+
readonly keys: Set<string>;
|
|
1382
|
+
readonly fileSet: Set<string>;
|
|
1383
|
+
private baseColumns;
|
|
1384
|
+
private baseColumnsLoading;
|
|
1385
|
+
private baseFields;
|
|
1386
|
+
private baseFieldsLoading;
|
|
1387
|
+
private staleBaseColumns;
|
|
1388
|
+
private staleBaseFields;
|
|
1389
|
+
get totalBytes(): number;
|
|
1390
|
+
get rowCount(): number;
|
|
1391
|
+
isLive(key: string): boolean;
|
|
1392
|
+
static build<T extends {
|
|
1393
|
+
key: string;
|
|
1394
|
+
}>(config: {
|
|
1395
|
+
name: string;
|
|
1396
|
+
storage: FileStorage;
|
|
1397
|
+
bulkFiles: BulkFileInfo[];
|
|
1398
|
+
streamFiles: StreamFileInfo[];
|
|
1399
|
+
subCaches: SubReaderCaches;
|
|
1400
|
+
onUnreadableFile?: (file: BulkFileInfo, message: string) => Promise<void>;
|
|
1401
|
+
}): Promise<LoadedIndex<T>>;
|
|
1402
|
+
inheritStaleFrom(prev: LoadedIndex<T>): void;
|
|
1403
|
+
getColumn(column: string): Promise<{
|
|
1404
|
+
key: string;
|
|
1405
|
+
value: unknown;
|
|
1406
|
+
time: number;
|
|
1407
|
+
}[]>;
|
|
1408
|
+
getSingleField(key: string, column: string): Promise<{
|
|
1409
|
+
value: unknown;
|
|
1410
|
+
time: number;
|
|
1411
|
+
} | undefined>;
|
|
1412
|
+
ensureBaseColumn(column: string, onLoaded: () => void): void;
|
|
1413
|
+
ensureBaseField(key: string, column: string, onLoaded: () => void): void;
|
|
1414
|
+
getBaseColumn(column: string): {
|
|
1415
|
+
entries: {
|
|
1416
|
+
key: string;
|
|
1417
|
+
value: unknown;
|
|
1418
|
+
time: number;
|
|
1419
|
+
}[];
|
|
1420
|
+
fresh: boolean;
|
|
1421
|
+
} | undefined;
|
|
1422
|
+
getBaseField(key: string, column: string): {
|
|
1423
|
+
value: {
|
|
1424
|
+
value: unknown;
|
|
1425
|
+
time: number;
|
|
1426
|
+
} | undefined;
|
|
1427
|
+
fresh: boolean;
|
|
1428
|
+
loaded: boolean;
|
|
1429
|
+
};
|
|
1430
|
+
isBaseColumnLoaded(column: string): boolean;
|
|
1431
|
+
isBaseFieldLoaded(key: string, column: string): boolean;
|
|
1432
|
+
dropLoadedValues(): void;
|
|
1433
|
+
}
|
|
1434
|
+
export declare function makeRawGetRange(storage: FileStorage, fileName: string): Promise<{
|
|
1435
|
+
rawGetRange: GetRange;
|
|
1436
|
+
size: number;
|
|
1437
|
+
}>;
|
|
1438
|
+
export declare function loadFileReader(name: string, storage: FileStorage, f: BulkFileInfo, cache: Map<string, BaseBulkDatabaseReader>): Promise<BaseBulkDatabaseReader>;
|
|
1439
|
+
export declare function loadStreamEntries(name: string, storage: FileStorage, streamFiles: StreamFileInfo[], cache: Map<string, StreamReaderCacheEntry>): Promise<{
|
|
1440
|
+
entries: {
|
|
1441
|
+
time: number;
|
|
1442
|
+
fileName: string;
|
|
1443
|
+
entry: StreamEntry;
|
|
1444
|
+
}[];
|
|
1445
|
+
totalBytes: number;
|
|
1446
|
+
missing: boolean;
|
|
1447
|
+
sizes: Map<string, number>;
|
|
1448
|
+
}>;
|
|
1449
|
+
export declare function orderStreamEntries(entries: {
|
|
1450
|
+
time: number;
|
|
1451
|
+
fileName: string;
|
|
1452
|
+
entry: StreamEntry;
|
|
1453
|
+
}[]): StreamEntry[];
|
|
1454
|
+
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
declare module "sliftutils/storage/BulkDatabase2/WriteOverlay" {
|
|
1458
|
+
export declare const DELETED: unique symbol;
|
|
1459
|
+
export type OverlayEntry = {
|
|
1460
|
+
time: number;
|
|
1461
|
+
value: Record<string, unknown> | typeof DELETED;
|
|
1462
|
+
};
|
|
1463
|
+
export declare class WriteOverlay {
|
|
1464
|
+
private entries;
|
|
1465
|
+
get size(): number;
|
|
1466
|
+
get(key: string): OverlayEntry | undefined;
|
|
1467
|
+
has(key: string): boolean;
|
|
1468
|
+
keys(): IterableIterator<string>;
|
|
1469
|
+
[Symbol.iterator](): IterableIterator<[string, OverlayEntry]>;
|
|
1470
|
+
writeRow(key: string, row: Record<string, unknown>, time: number, wasLive: boolean): {
|
|
1471
|
+
invalidatedColumns: Iterable<string> | "all";
|
|
1472
|
+
};
|
|
1473
|
+
deleteKey(key: string, time: number, wasLive: boolean): {
|
|
1474
|
+
invalidatedColumns: Iterable<string> | "all";
|
|
1475
|
+
};
|
|
1476
|
+
clear(): void;
|
|
1477
|
+
sweepCovered(authority: (key: string) => number): void;
|
|
1478
|
+
patchColumn(base: {
|
|
1479
|
+
key: string;
|
|
1480
|
+
value: unknown;
|
|
1481
|
+
time: number;
|
|
1482
|
+
}[], column: string): {
|
|
1483
|
+
key: string;
|
|
1484
|
+
value: unknown;
|
|
1485
|
+
time: number;
|
|
1486
|
+
}[];
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1188
1491
|
declare module "sliftutils/storage/BulkDatabase2/blockCache" {
|
|
1189
1492
|
/// <reference types="node" />
|
|
1190
1493
|
/// <reference types="node" />
|
|
@@ -1194,6 +1497,7 @@ declare module "sliftutils/storage/BulkDatabase2/blockCache" {
|
|
|
1194
1497
|
private blocks;
|
|
1195
1498
|
private indexes;
|
|
1196
1499
|
clear(): void;
|
|
1500
|
+
evict(fileId: string): void;
|
|
1197
1501
|
private touch;
|
|
1198
1502
|
private readIndex;
|
|
1199
1503
|
open(fileId: string, fileSize: number, rawGetRange: GetRange): Promise<{
|