sliftutils 1.7.32 → 1.7.34
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/builders/extensionBuild.ts +1 -1
- package/bundler/bundleEntry.ts +1 -3
- package/bundler/bundler.ts +2 -4
- package/bundler/sourceMaps.ts +1 -2
- package/examplestorage/browser.tsx +1 -2
- package/examplestorage/exampleserver.ts +1 -2
- package/index.d.ts +134 -102
- package/misc/dist/environment.ts.cache +2 -2
- package/misc/dist/getSecret.ts.cache +2 -2
- package/misc/dist/strings.ts.cache +2 -2
- package/misc/dist/zip.ts.cache +2 -2
- package/misc/https/dist/certs.ts.cache +2 -2
- package/misc/https/dist/dns.ts.cache +7 -16
- package/misc/https/dist/persistentLocalStorage.ts.cache +2 -2
- package/misc/https/dns.d.ts +1 -4
- package/misc/https/dns.ts +5 -14
- package/misc/https/hostServer.d.ts +2 -0
- package/misc/https/hostServer.ts +6 -7
- package/misc/https/httpsCerts.ts +4 -10
- package/misc/openrouter.ts +1 -2
- package/package.json +1 -1
- package/render-utils/FullscreenModal.tsx +1 -4
- package/render-utils/GenericFormat.tsx +2 -8
- package/render-utils/Input.tsx +5 -13
- package/render-utils/InputLabel.tsx +4 -6
- package/render-utils/InputPicker.tsx +1 -2
- package/render-utils/URLParam.ts +2 -3
- package/render-utils/dist/observer.tsx.cache +2 -2
- package/render-utils/mobxTyped.ts +2 -3
- package/render-utils/niceStringify.ts +2 -4
- package/storage/ArchivesDisk.ts +4 -14
- package/storage/BulkDatabase2/BulkDatabase2.d.ts +1 -2
- package/storage/BulkDatabase2/BulkDatabase2.ts +4 -11
- package/storage/BulkDatabase2/BulkDatabaseBase.ts +42 -114
- package/storage/BulkDatabase2/BulkDatabaseFormat.ts +31 -91
- package/storage/BulkDatabase2/BulkDatabaseMerge.ts +19 -57
- package/storage/BulkDatabase2/BulkDatabaseReader.ts +4 -12
- package/storage/BulkDatabase2/LoadedIndex.ts +6 -18
- package/storage/BulkDatabase2/WriteOverlay.ts +3 -8
- package/storage/BulkDatabase2/blockCache.ts +12 -28
- package/storage/BulkDatabase2/dist/BulkDatabaseBase.ts.cache +40 -103
- package/storage/BulkDatabase2/dist/BulkDatabaseFormat.ts.cache +19 -50
- package/storage/BulkDatabase2/dist/BulkDatabaseMerge.ts.cache +18 -50
- package/storage/BulkDatabase2/dist/BulkDatabaseReader.ts.cache +7 -15
- package/storage/BulkDatabase2/dist/LoadedIndex.ts.cache +9 -21
- package/storage/BulkDatabase2/dist/WriteOverlay.ts.cache +6 -11
- package/storage/BulkDatabase2/dist/blockCache.ts.cache +15 -31
- package/storage/BulkDatabase2/dist/mergeLock.ts.cache +10 -29
- package/storage/BulkDatabase2/dist/mergeMarkers.ts.cache +10 -18
- package/storage/BulkDatabase2/dist/streamLog.ts.cache +17 -43
- package/storage/BulkDatabase2/dist/syncClient.ts.cache +11 -27
- package/storage/BulkDatabase2/mergeLock.ts +7 -26
- package/storage/BulkDatabase2/mergeMarkers.ts +7 -15
- package/storage/BulkDatabase2/streamLog.ts +14 -40
- package/storage/BulkDatabase2/syncClient.ts +8 -24
- package/storage/FileFolderAPI.tsx +28 -75
- package/storage/IArchives.d.ts +3 -3
- package/storage/IArchives.ts +21 -50
- package/storage/IStorage.ts +2 -4
- package/storage/PendingManager.tsx +2 -3
- package/storage/TransactionStorage.ts +11 -24
- package/storage/backblaze.ts +12 -43
- package/storage/dist/ArchivesDisk.ts.cache +7 -17
- package/storage/dist/FileFolderAPI.tsx.cache +25 -63
- package/storage/dist/IArchives.ts.cache +10 -20
- package/storage/dist/IndexedDBFileFolderAPI.ts.cache +2 -2
- package/storage/dist/JSONStorage.ts.cache +2 -2
- package/storage/dist/PendingManager.tsx.cache +5 -6
- package/storage/dist/TransactionStorage.ts.cache +14 -27
- package/storage/dist/backblaze.ts.cache +15 -46
- package/storage/dist/embeddingFormats.ts.cache +11 -24
- package/storage/dist/fileSystemPointer.ts.cache +4 -7
- package/storage/dist/remoteFileStorage.ts.cache +17 -36
- package/storage/embeddingFormats.ts +11 -27
- package/storage/fileSystemPointer.ts +2 -7
- package/storage/proxydatabase/dist/ivfEmbeddingDatabase.ts.cache +8 -18
- package/storage/proxydatabase/dist/transactionSet.ts.cache +4 -7
- package/storage/proxydatabase/inMemoryDatabase.ts +1 -3
- package/storage/proxydatabase/ivfEmbeddingDatabase.ts +8 -23
- package/storage/proxydatabase/transactionSet.ts +2 -5
- package/storage/remoteFileServer.ts +20 -48
- package/storage/remoteFileStorage.ts +14 -33
- package/storage/remoteStorage/ArchivesRemote.d.ts +1 -4
- package/storage/remoteStorage/ArchivesRemote.ts +11 -26
- package/storage/remoteStorage/ArchivesUrl.ts +2 -4
- package/storage/remoteStorage/accessPage.tsx +1 -5
- package/storage/remoteStorage/blobStore.d.ts +5 -13
- package/storage/remoteStorage/blobStore.ts +52 -130
- package/storage/remoteStorage/createArchives.d.ts +22 -14
- package/storage/remoteStorage/createArchives.ts +54 -188
- package/storage/remoteStorage/deployTakeover.d.ts +18 -32
- package/storage/remoteStorage/deployTakeover.ts +70 -384
- package/storage/remoteStorage/dist/ArchivesRemote.ts.cache +12 -24
- package/storage/remoteStorage/dist/ArchivesUrl.ts.cache +5 -7
- package/storage/remoteStorage/dist/blobStore.ts.cache +47 -117
- package/storage/remoteStorage/dist/cliArgs.ts.cache +2 -2
- package/storage/remoteStorage/dist/createArchives.ts.cache +58 -189
- package/storage/remoteStorage/dist/deployTakeover.ts.cache +81 -387
- package/storage/remoteStorage/dist/intermediateSources.ts.cache +119 -0
- package/storage/remoteStorage/dist/remoteConfig.ts.cache +36 -24
- package/storage/remoteStorage/dist/sourceWrapper.ts.cache +20 -40
- package/storage/remoteStorage/dist/storageClientController.ts.cache +4 -6
- package/storage/remoteStorage/dist/storageController.ts.cache +37 -74
- package/storage/remoteStorage/dist/storageServerState.ts.cache +345 -188
- package/storage/remoteStorage/grantAccessCli.ts +1 -3
- package/storage/remoteStorage/intermediateSources.d.ts +21 -0
- package/storage/remoteStorage/intermediateSources.ts +117 -0
- package/storage/remoteStorage/remoteConfig.ts +33 -20
- package/storage/remoteStorage/sourceWrapper.d.ts +8 -19
- package/storage/remoteStorage/sourceWrapper.ts +19 -41
- package/storage/remoteStorage/storageClientController.ts +1 -3
- package/storage/remoteStorage/storageController.d.ts +7 -6
- package/storage/remoteStorage/storageController.ts +36 -82
- package/storage/remoteStorage/storageServer.ts +20 -34
- package/storage/remoteStorage/storageServerState.d.ts +41 -5
- package/storage/remoteStorage/storageServerState.ts +355 -216
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { LZ4 } from "socket-function/src/lz4/LZ4";
|
|
2
2
|
|
|
3
3
|
// Block-aligned, promise-deduped, decompressing range cache for BulkDatabase2's on-disk files.
|
|
4
|
-
//
|
|
5
|
-
// On-disk format (produced by encodeCompressedBlocks): the logical (uncompressed) bulk buffer is
|
|
6
|
-
//
|
|
7
|
-
// at least 2x, in which case it's stored raw. The file starts with a JSON index mapping each block to
|
|
8
|
-
// its stored length + a compressed flag, so a reader can seek straight to any block:
|
|
9
|
-
//
|
|
4
|
+
//
|
|
5
|
+
// On-disk format (produced by encodeCompressedBlocks): the logical (uncompressed) bulk buffer is split into fixed BLOCK_SIZE blocks; each block is LZ4-compressed unless that wouldn't shrink it by at least 2x, in which case it's stored raw. The file starts with a JSON index mapping each block to its stored length + a compressed flag, so a reader can seek straight to any block:
|
|
6
|
+
//
|
|
10
7
|
// [u32 indexLength][index JSON][block 0 stored bytes][block 1 stored bytes]...
|
|
11
|
-
//
|
|
12
|
-
// The cache presents a *logical* getRange (over uncompressed bytes) so BulkDatabase2's reader is
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// coalesced into one underlying read. Files are immutable, so cached blocks are valid forever.
|
|
16
|
-
//
|
|
17
|
-
// Per-block compression mainly helps slow storage (HDD): fewer bytes off disk per block, at the cost
|
|
18
|
-
// of a fast in-memory LZ4 decompress.
|
|
8
|
+
//
|
|
9
|
+
// The cache presents a *logical* getRange (over uncompressed bytes) so BulkDatabase2's reader is oblivious to compression. It reads compressed bytes via the underlying getRange, decompresses, and caches the uncompressed blocks. Reads are promise-deduped and contiguous missing blocks are coalesced into one underlying read. Files are immutable, so cached blocks are valid forever.
|
|
10
|
+
//
|
|
11
|
+
// Per-block compression mainly helps slow storage (HDD): fewer bytes off disk per block, at the cost of a fast in-memory LZ4 decompress.
|
|
19
12
|
|
|
20
13
|
const BLOCK_SIZE = 256 * 1024;
|
|
21
14
|
const MAX_BLOCKS = Math.floor((512 * 1024 * 1024) / BLOCK_SIZE);
|
|
@@ -84,9 +77,7 @@ export class BlockCache {
|
|
|
84
77
|
}
|
|
85
78
|
}
|
|
86
79
|
|
|
87
|
-
// Reads + validates the file index. Rejects the WHOLE file if it isn't exactly the size its index
|
|
88
|
-
// implies — a truncated/partial write (e.g. a crash mid-write) is detected here rather than
|
|
89
|
-
// silently returning corrupted values for the rows near the end.
|
|
80
|
+
// Reads + validates the file index. Rejects the WHOLE file if it isn't exactly the size its index implies — a truncated/partial write (e.g. a crash mid-write) is detected here rather than silently returning corrupted values for the rows near the end.
|
|
90
81
|
private async readIndex(rawGetRange: GetRange, fileSize: number): Promise<FileIndex> {
|
|
91
82
|
let head = await rawGetRange(0, 4);
|
|
92
83
|
if (head.length < 4) throw new Error(`bulk file too short for an index header (${fileSize} bytes)`);
|
|
@@ -103,17 +94,14 @@ export class BlockCache {
|
|
|
103
94
|
offsets.push(offset);
|
|
104
95
|
offset += block.len;
|
|
105
96
|
}
|
|
106
|
-
// The blocks must account for exactly the rest of the file. Any mismatch means the file is
|
|
107
|
-
// truncated or otherwise corrupt — reject it entirely.
|
|
97
|
+
// The blocks must account for exactly the rest of the file. Any mismatch means the file is truncated or otherwise corrupt — reject it entirely.
|
|
108
98
|
if (offset !== fileSize) {
|
|
109
99
|
throw new Error(`bulk file is ${fileSize} bytes but its index implies ${offset} (truncated/corrupt)`);
|
|
110
100
|
}
|
|
111
101
|
return { ...parsed, offsets };
|
|
112
102
|
}
|
|
113
103
|
|
|
114
|
-
// Opens an immutable file: reads + validates its index (cached) and returns the logical
|
|
115
|
-
// (uncompressed) size plus a logical getRange that the caller can use exactly like an
|
|
116
|
-
// uncompressed file. `fileSize` is the actual on-disk byte length, used to detect truncation.
|
|
104
|
+
// Opens an immutable file: reads + validates its index (cached) and returns the logical (uncompressed) size plus a logical getRange that the caller can use exactly like an uncompressed file. `fileSize` is the actual on-disk byte length, used to detect truncation.
|
|
117
105
|
public async open(fileId: string, fileSize: number, rawGetRange: GetRange): Promise<{ uncompressedSize: number; getRange: GetRange }> {
|
|
118
106
|
let indexPromise = this.indexes.get(fileId);
|
|
119
107
|
if (!indexPromise) {
|
|
@@ -150,10 +138,7 @@ export class BlockCache {
|
|
|
150
138
|
let lastMeta = index.blocks[runEnd - 1];
|
|
151
139
|
let compEnd = index.offsets[runEnd - 1] + lastMeta.len;
|
|
152
140
|
let runCompressed = rawGetRange(compStart, compEnd);
|
|
153
|
-
// Hold this run's promises locally. Registering them in the LRU can evict earlier
|
|
154
|
-
// blocks of the same run (or of a concurrent run) before we get to await them, so
|
|
155
|
-
// reading them back out of the cache would silently drop blocks and return a short
|
|
156
|
-
// buffer. We still register in the LRU so concurrent reads dedupe onto them.
|
|
141
|
+
// Hold this run's promises locally. Registering them in the LRU can evict earlier blocks of the same run (or of a concurrent run) before we get to await them, so reading them back out of the cache would silently drop blocks and return a short buffer. We still register in the LRU so concurrent reads dedupe onto them.
|
|
157
142
|
let runPromises: Promise<Buffer>[] = [];
|
|
158
143
|
for (let i = runStart; i < runEnd; i++) {
|
|
159
144
|
let meta = index.blocks[i];
|
|
@@ -172,8 +157,7 @@ export class BlockCache {
|
|
|
172
157
|
|
|
173
158
|
let combined = parts.length === 1 && parts[0] || Buffer.concat(parts);
|
|
174
159
|
let sliceStart = start - firstBlock * blockSize;
|
|
175
|
-
// A short combined buffer means we lost blocks; subarray would clamp and hand back
|
|
176
|
-
// truncated data that every caller treats as valid. Fail loudly instead.
|
|
160
|
+
// A short combined buffer means we lost blocks; subarray would clamp and hand back truncated data that every caller treats as valid. Fail loudly instead.
|
|
177
161
|
if (combined.length < sliceStart + (end - start)) {
|
|
178
162
|
throw new Error(`Expected ${sliceStart + (end - start)} bytes of blocks for range [${start}, ${end}) of ${fileId}, was ${combined.length}`);
|
|
179
163
|
}
|