@elaraai/e3-api-server 1.0.97 → 1.0.98
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/README.md +57 -4
- package/dist/src/handlers/dataflow.d.ts +9 -1
- package/dist/src/handlers/dataflow.d.ts.map +1 -1
- package/dist/src/handlers/dataflow.js +19 -4
- package/dist/src/handlers/dataflow.js.map +1 -1
- package/dist/src/handlers/dataset-batches.d.ts +203 -0
- package/dist/src/handlers/dataset-batches.d.ts.map +1 -0
- package/dist/src/handlers/dataset-batches.js +442 -0
- package/dist/src/handlers/dataset-batches.js.map +1 -0
- package/dist/src/handlers/dataset-place.d.ts +104 -0
- package/dist/src/handlers/dataset-place.d.ts.map +1 -0
- package/dist/src/handlers/dataset-place.js +282 -0
- package/dist/src/handlers/dataset-place.js.map +1 -0
- package/dist/src/handlers/dataset-reads.d.ts +205 -0
- package/dist/src/handlers/dataset-reads.d.ts.map +1 -0
- package/dist/src/handlers/dataset-reads.js +350 -0
- package/dist/src/handlers/dataset-reads.js.map +1 -0
- package/dist/src/handlers/datasets.d.ts +19 -30
- package/dist/src/handlers/datasets.d.ts.map +1 -1
- package/dist/src/handlers/datasets.js +84 -549
- package/dist/src/handlers/datasets.js.map +1 -1
- package/dist/src/handlers/datasets.spec.js +968 -14
- package/dist/src/handlers/datasets.spec.js.map +1 -1
- package/dist/src/handlers/index.d.ts +5 -1
- package/dist/src/handlers/index.d.ts.map +1 -1
- package/dist/src/handlers/index.js +4 -1
- package/dist/src/handlers/index.js.map +1 -1
- package/dist/src/handlers/key-search.d.ts +102 -0
- package/dist/src/handlers/key-search.d.ts.map +1 -0
- package/dist/src/handlers/key-search.js +351 -0
- package/dist/src/handlers/key-search.js.map +1 -0
- package/dist/src/handlers/segments.d.ts +124 -0
- package/dist/src/handlers/segments.d.ts.map +1 -0
- package/dist/src/handlers/segments.js +278 -0
- package/dist/src/handlers/segments.js.map +1 -0
- package/dist/src/handlers/workspaces.spec.js +1 -0
- package/dist/src/handlers/workspaces.spec.js.map +1 -1
- package/dist/src/portable.spec.js +3 -2
- package/dist/src/portable.spec.js.map +1 -1
- package/dist/src/routes/dataset-path.d.ts +16 -0
- package/dist/src/routes/dataset-path.d.ts.map +1 -1
- package/dist/src/routes/dataset-path.js +18 -0
- package/dist/src/routes/dataset-path.js.map +1 -1
- package/dist/src/routes/datasets.d.ts.map +1 -1
- package/dist/src/routes/datasets.js +228 -2
- package/dist/src/routes/datasets.js.map +1 -1
- package/dist/src/routes/executions.js +1 -1
- package/dist/src/routes/executions.js.map +1 -1
- package/dist/src/routes/transfer.d.ts.map +1 -1
- package/dist/src/routes/transfer.js +11 -5
- package/dist/src/routes/transfer.js.map +1 -1
- package/dist/src/stopping-run.d.ts +24 -3
- package/dist/src/stopping-run.d.ts.map +1 -1
- package/dist/src/stopping-run.js +29 -7
- package/dist/src/stopping-run.js.map +1 -1
- package/dist/src/stopping-run.spec.js +30 -1
- package/dist/src/stopping-run.spec.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* What every paged read of a dataset shares: the datasets opened for it, the
|
|
7
|
+
* refusals it answers with, and the rows it reads — a span of a collection's
|
|
8
|
+
* rows, the rows of a Dict by key — through the kept decoded segments
|
|
9
|
+
* (`segments.ts`), each segment read once.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { SortedMap, SortedSet, isVariant, none, segmentKeyTypeOf, some, toEastTypeValue } from '@elaraai/east';
|
|
14
|
+
import { DatasetSegments, recordIndexNames, resolveRecordIndex, workspaceGetDatasetStatus, } from '@elaraai/e3-core/portable';
|
|
15
|
+
import { backendIdOf, comparators, decodedSegments, SegmentCorruptError } from './segments.js';
|
|
16
|
+
/** Elements returned per page when the request names no limit. */
|
|
17
|
+
export const PAGE_DEFAULT_LIMIT = 1_000;
|
|
18
|
+
/** Hard cap on elements per page — and on the queries, keys or runs one batch
|
|
19
|
+
* read takes, and the entries it answers. */
|
|
20
|
+
export const PAGE_MAX_LIMIT = 10_000;
|
|
21
|
+
/** Default cap on a page's share of the source blob, in bytes. The
|
|
22
|
+
* effective limit shrinks so `limit × avgElementBytes` stays under the
|
|
23
|
+
* budget, bounding page payloads even for very wide rows. Deployments with
|
|
24
|
+
* tighter response limits (e.g. Lambda proxy's 6 MB, base64-inflated) pass
|
|
25
|
+
* a smaller budget through the route options. */
|
|
26
|
+
export const PAGE_BYTE_BUDGET_DEFAULT = 4 * 1024 * 1024;
|
|
27
|
+
const SEGMENTS_CACHE_MAX_ENTRIES = 64;
|
|
28
|
+
/** Cap on the cache's total retained bytes. The newest entry always stays
|
|
29
|
+
* (serving the request needs it regardless), so one giant index can still
|
|
30
|
+
* be held — but never alongside others. */
|
|
31
|
+
const SEGMENTS_CACHE_MAX_BYTES = 16 * 1024 * 1024;
|
|
32
|
+
const segmentsCache = new Map();
|
|
33
|
+
let segmentsCacheBytes = 0;
|
|
34
|
+
/** Evicts oldest entries until the count and byte budgets hold, always
|
|
35
|
+
* keeping at least the newest entry. */
|
|
36
|
+
function evictSegments() {
|
|
37
|
+
while (segmentsCache.size > 1 &&
|
|
38
|
+
(segmentsCache.size > SEGMENTS_CACHE_MAX_ENTRIES || segmentsCacheBytes > SEGMENTS_CACHE_MAX_BYTES)) {
|
|
39
|
+
const oldest = segmentsCache.keys().next().value;
|
|
40
|
+
segmentsCacheBytes -= segmentsCache.get(oldest).bytes;
|
|
41
|
+
segmentsCache.delete(oldest);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Opens (or reuses) a stored collection, LRU-cached per backend, repository
|
|
45
|
+
* and content hash, and bounded by retained bytes.
|
|
46
|
+
*
|
|
47
|
+
* All three key parts are load-bearing. An opened dataset holds the backend
|
|
48
|
+
* it reads segment objects through, and a manifest names objects that exist
|
|
49
|
+
* in the repository it was read from and nowhere else — so two backends, or
|
|
50
|
+
* two repositories, that happen to hold the same bytes under the same name
|
|
51
|
+
* must not share an entry. `size` is the object's, when the caller knows it;
|
|
52
|
+
* the opener reads it on a miss otherwise. */
|
|
53
|
+
export async function cachedSegments(storage, repoPath, hash, size) {
|
|
54
|
+
const key = `${backendIdOf(storage)}\u0000${repoPath}\u0000${hash}`;
|
|
55
|
+
const cached = segmentsCache.get(key);
|
|
56
|
+
if (cached) {
|
|
57
|
+
segmentsCache.delete(key);
|
|
58
|
+
segmentsCache.set(key, cached); // refresh recency
|
|
59
|
+
return cached.segments;
|
|
60
|
+
}
|
|
61
|
+
const segments = await DatasetSegments.open(storage, repoPath, hash, size);
|
|
62
|
+
// counts + prefix sums at 8 bytes each, plus the manifest's stored fences.
|
|
63
|
+
let bytes = 16 * segments.segmentCount;
|
|
64
|
+
for (const entry of segments.manifest.entries)
|
|
65
|
+
bytes += entry.fence.byteLength + 80;
|
|
66
|
+
segmentsCache.set(key, { segments, bytes });
|
|
67
|
+
segmentsCacheBytes += bytes;
|
|
68
|
+
evictSegments();
|
|
69
|
+
return segments;
|
|
70
|
+
}
|
|
71
|
+
/** The `Cache-Control` of a hash-pinned answer: kept for a year, never
|
|
72
|
+
* revalidated, by the caches {@link PinnedCache} lets keep it. */
|
|
73
|
+
export function pinnedCacheControl(cache) {
|
|
74
|
+
return `${cache ?? 'private'}, max-age=31536000, immutable`;
|
|
75
|
+
}
|
|
76
|
+
/** The opener's refusal of a collection stored as one blob, which an older
|
|
77
|
+
* e3 wrote: answered as `dataset_not_indexed`, in the refusal's own words. */
|
|
78
|
+
export const BLOB_REFUSAL = /^the collection [0-9a-f]{64} is stored as one blob:/;
|
|
79
|
+
/** A refusal, answered as JSON: its type, its message and its status. */
|
|
80
|
+
export function pageError(type, message, status = 400, headers) {
|
|
81
|
+
return new Response(JSON.stringify({ error: { type, message } }), {
|
|
82
|
+
status,
|
|
83
|
+
headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-store', ...headers },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A stored collection opened for a read, or the refusal of one stored as one
|
|
88
|
+
* blob, which an older e3 wrote: `dataset_not_indexed`, in the opener's own
|
|
89
|
+
* words. Any other failure is a real one, and raised as it is.
|
|
90
|
+
*
|
|
91
|
+
* @param storage - Storage backend
|
|
92
|
+
* @param repoPath - Repository identifier
|
|
93
|
+
* @param hash - The collection's hash, or a record state naming its primary
|
|
94
|
+
* @param size - The object's size, when the caller knows it
|
|
95
|
+
* @returns The opened collection, or the refusal
|
|
96
|
+
*/
|
|
97
|
+
export async function openForRead(storage, repoPath, hash, size) {
|
|
98
|
+
try {
|
|
99
|
+
return await cachedSegments(storage, repoPath, hash, size);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
// Only the opener's refusal of a blob-stored collection means "not
|
|
103
|
+
// indexed". Anything else (storage I/O, a missing or corrupt object) is
|
|
104
|
+
// a real failure and must surface as one.
|
|
105
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
106
|
+
if (!BLOB_REFUSAL.test(message))
|
|
107
|
+
throw err;
|
|
108
|
+
return pageError('dataset_not_indexed', message);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The dataset a paged read names, or the refusal its status calls for: no
|
|
113
|
+
* path, a dataset with no value yet, or a pin to content it no longer holds,
|
|
114
|
+
* refused with 409 naming the content it holds now.
|
|
115
|
+
*
|
|
116
|
+
* @param storage - Storage backend
|
|
117
|
+
* @param repoPath - Repository identifier
|
|
118
|
+
* @param workspace - Workspace name
|
|
119
|
+
* @param treePath - The dataset's path
|
|
120
|
+
* @param hash - The content hash the read is pinned to, if any
|
|
121
|
+
* @param what - How the refusal of an empty path names the read
|
|
122
|
+
* @returns The dataset, or the refusal
|
|
123
|
+
*/
|
|
124
|
+
export async function readDataset(storage, repoPath, workspace, treePath, hash, what) {
|
|
125
|
+
if (treePath.length === 0) {
|
|
126
|
+
return pageError('bad_request', `Path required for ${what}`);
|
|
127
|
+
}
|
|
128
|
+
const status = await workspaceGetDatasetStatus(storage, repoPath, workspace, treePath);
|
|
129
|
+
if (status.refType === 'unassigned') {
|
|
130
|
+
return pageError('dataset_unassigned', 'Dataset is unassigned (pending task output)', 404);
|
|
131
|
+
}
|
|
132
|
+
if (status.refType === 'null' || !status.hash) {
|
|
133
|
+
return pageError('dataset_null', 'Dataset is null', 404);
|
|
134
|
+
}
|
|
135
|
+
// A hash-pinned read must never answer with different bytes — refuse stale
|
|
136
|
+
// pins (the client refetches status for the current hash) so a hash-keyed
|
|
137
|
+
// URL is a pure function of the response and caches stay sound.
|
|
138
|
+
if (hash !== undefined && hash !== status.hash) {
|
|
139
|
+
return pageError('dataset_hash_mismatch', `Dataset content is ${status.hash}, not ${hash} — refetch status and retry`, 409, { 'X-Content-SHA256': status.hash });
|
|
140
|
+
}
|
|
141
|
+
const typeValue = isVariant(status.datasetType)
|
|
142
|
+
? status.datasetType
|
|
143
|
+
: toEastTypeValue(status.datasetType);
|
|
144
|
+
return { hash: status.hash, size: status.size ?? undefined, typeValue };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The segment holding row `row` of a collection: the first whose prefix sum
|
|
148
|
+
* passes it.
|
|
149
|
+
*
|
|
150
|
+
* @param cumulative - The collection's prefix sums of its segments' counts
|
|
151
|
+
* @param row - A row inside the collection
|
|
152
|
+
* @returns The segment's index
|
|
153
|
+
*/
|
|
154
|
+
export function segmentOfRow(cumulative, row) {
|
|
155
|
+
let lo = 0;
|
|
156
|
+
let hi = cumulative.length - 1;
|
|
157
|
+
while (lo < hi) {
|
|
158
|
+
const mid = (lo + hi) >> 1;
|
|
159
|
+
if (cumulative[mid] <= row)
|
|
160
|
+
lo = mid + 1;
|
|
161
|
+
else
|
|
162
|
+
hi = mid;
|
|
163
|
+
}
|
|
164
|
+
return lo;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The elements of a collection's rows in some spans, in order — an Array's
|
|
168
|
+
* items, a Set's elements, a Dict's `[key, value]` pairs — every segment the
|
|
169
|
+
* spans touch read once, several at a time, through the kept decoded
|
|
170
|
+
* segments.
|
|
171
|
+
*
|
|
172
|
+
* @param storage - The backend the collection is read through
|
|
173
|
+
* @param repo - The repository it is in
|
|
174
|
+
* @param segments - The opened collection
|
|
175
|
+
* @param spans - The rows, each span inside the collection
|
|
176
|
+
* @returns The elements, span after span
|
|
177
|
+
* @throws {SegmentCorruptError} When a segment does not hold what its manifest
|
|
178
|
+
* says of it
|
|
179
|
+
*/
|
|
180
|
+
export async function elementsOf(storage, repo, segments, spans) {
|
|
181
|
+
const { cumulative } = segments;
|
|
182
|
+
const touched = [];
|
|
183
|
+
for (const { from, to } of spans) {
|
|
184
|
+
if (to <= from)
|
|
185
|
+
continue;
|
|
186
|
+
for (let s = segmentOfRow(cumulative, from), last = segmentOfRow(cumulative, to - 1); s <= last; s++)
|
|
187
|
+
touched.push(s);
|
|
188
|
+
}
|
|
189
|
+
const decoded = await decodedSegments(storage, repo, segments, touched);
|
|
190
|
+
const kind = segments.typeValue.type;
|
|
191
|
+
const out = [];
|
|
192
|
+
for (const { from, to } of spans) {
|
|
193
|
+
let row = from;
|
|
194
|
+
while (row < to) {
|
|
195
|
+
const s = segmentOfRow(cumulative, row);
|
|
196
|
+
const base = s === 0 ? 0 : cumulative[s - 1];
|
|
197
|
+
const end = Math.min(to, cumulative[s]);
|
|
198
|
+
const segment = decoded.get(s);
|
|
199
|
+
for (let i = row - base; i < end - base; i++) {
|
|
200
|
+
if (kind === 'Dict')
|
|
201
|
+
out.push([segment.keys[i], segment.values[i]]);
|
|
202
|
+
else if (kind === 'Set')
|
|
203
|
+
out.push(segment.keys[i]);
|
|
204
|
+
else
|
|
205
|
+
out.push(segment.value[i]);
|
|
206
|
+
}
|
|
207
|
+
row = end;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return out;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* A collection's elements as a value of the collection's own type: the items
|
|
214
|
+
* as an array, the elements as a `SortedSet` or the pairs as a `SortedMap`,
|
|
215
|
+
* under the key type's comparator.
|
|
216
|
+
*
|
|
217
|
+
* @param typeValue - The collection's type: an Array, a Set or a Dict
|
|
218
|
+
* @param elements - Its elements, in canonical order
|
|
219
|
+
* @returns The value
|
|
220
|
+
*/
|
|
221
|
+
export function collectionOf(typeValue, elements) {
|
|
222
|
+
const keyType = segmentKeyTypeOf(typeValue);
|
|
223
|
+
if (keyType === null)
|
|
224
|
+
return [...elements];
|
|
225
|
+
const cmp = comparators(keyType);
|
|
226
|
+
if (typeValue.type === 'Set')
|
|
227
|
+
return new SortedSet(elements, cmp);
|
|
228
|
+
return new SortedMap(elements, cmp);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The rows a Dict holds under some keys — each read from the segment its fence
|
|
232
|
+
* places the key in, every such segment read once, several at a time, through
|
|
233
|
+
* the kept decoded segments.
|
|
234
|
+
*
|
|
235
|
+
* @param storage - The backend the Dict is read through
|
|
236
|
+
* @param repo - The repository it is in
|
|
237
|
+
* @param segments - The opened Dict
|
|
238
|
+
* @param keys - The keys, in any order
|
|
239
|
+
* @returns Each key's row, or none, in the keys' order
|
|
240
|
+
* @throws {SegmentCorruptError} When a segment does not hold what its manifest
|
|
241
|
+
* says of it
|
|
242
|
+
*/
|
|
243
|
+
export async function rowsByKey(storage, repo, segments, keys) {
|
|
244
|
+
const owners = await Promise.all(keys.map((key) => segments.segmentFor(key)));
|
|
245
|
+
const decoded = await decodedSegments(storage, repo, segments, owners);
|
|
246
|
+
return keys.map((key, i) => {
|
|
247
|
+
const row = decoded.get(owners[i]).value.get(key);
|
|
248
|
+
return row === undefined ? none : some(row);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A corrupt segment, answered as the refusal of the read that met it: a window
|
|
253
|
+
* or a search over a collection that is not canonical (`dataset_not_canonical`),
|
|
254
|
+
* or one writer segment that does not decode alone (`dataset_not_segmented`).
|
|
255
|
+
* Any other failure — a store's — is raised as it is.
|
|
256
|
+
*
|
|
257
|
+
* @param err - What a read threw
|
|
258
|
+
* @param type - The refusal's type
|
|
259
|
+
* @returns The refusal
|
|
260
|
+
* @throws The failure, when it is not a segment's
|
|
261
|
+
*/
|
|
262
|
+
export function corruptRefusal(err, type) {
|
|
263
|
+
if (err instanceof SegmentCorruptError)
|
|
264
|
+
return pageError(type, err.message);
|
|
265
|
+
throw err;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* One of a record's indexes, resolved at its state for a read, or the refusal
|
|
269
|
+
* of a name the state does not hold, naming the indexes it does — or of a
|
|
270
|
+
* joined read of a summary (#1039), whose entries stand for many rows and name
|
|
271
|
+
* none.
|
|
272
|
+
*
|
|
273
|
+
* @param storage - Storage backend
|
|
274
|
+
* @param repoPath - Repository identifier
|
|
275
|
+
* @param workspace - Workspace name
|
|
276
|
+
* @param treePath - The record's path
|
|
277
|
+
* @param stateHash - The record's state
|
|
278
|
+
* @param name - The index
|
|
279
|
+
* @param join - Whether the read fills each entry's row from the record
|
|
280
|
+
* @returns The resolved index, or the 404 refusal, or the 400 refusal of a joined summary
|
|
281
|
+
*/
|
|
282
|
+
export async function indexOf(storage, repoPath, workspace, treePath, stateHash, name, join = false) {
|
|
283
|
+
const refPath = treePath.map((s) => s.value).join('/');
|
|
284
|
+
const resolved = await resolveRecordIndex(storage, repoPath, workspace, refPath, stateHash, name);
|
|
285
|
+
if (resolved !== null && join && resolved.summary) {
|
|
286
|
+
return pageError('bad_request', `index '${name}' of '${refPath}' is a summary: each entry stands for every row of its key and names none to join — read it without join`);
|
|
287
|
+
}
|
|
288
|
+
if (resolved !== null)
|
|
289
|
+
return resolved;
|
|
290
|
+
const declared = await recordIndexNames(storage, repoPath, stateHash);
|
|
291
|
+
return pageError('index_not_found', `Dataset '${refPath}' has no index '${name}'`
|
|
292
|
+
+ (declared.length > 0 ? ` — it has ${declared.join(', ')}` : ' — it declares none'), 404);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The collection a key search of a dataset searches, or the refusal of one it
|
|
296
|
+
* cannot: an index the state does not hold, or a collection with no key order.
|
|
297
|
+
*
|
|
298
|
+
* @remarks
|
|
299
|
+
* An index selector searches the index's own collection, whose rows the answer
|
|
300
|
+
* is in — the same row space an index page serves — and its forms address the
|
|
301
|
+
* index key, which the collection sorts by first.
|
|
302
|
+
*
|
|
303
|
+
* @param storage - Storage backend
|
|
304
|
+
* @param repoPath - Repository identifier
|
|
305
|
+
* @param workspace - Workspace name
|
|
306
|
+
* @param treePath - The dataset's path
|
|
307
|
+
* @param dataset - The dataset, as its status reads
|
|
308
|
+
* @param index - The index searched, if any
|
|
309
|
+
* @returns The collection, or the refusal
|
|
310
|
+
*/
|
|
311
|
+
export async function searchTarget(storage, repoPath, workspace, treePath, dataset, index) {
|
|
312
|
+
let typeValue = dataset.typeValue;
|
|
313
|
+
let hash = dataset.hash;
|
|
314
|
+
let size = dataset.size;
|
|
315
|
+
if (index !== undefined) {
|
|
316
|
+
const resolved = await indexOf(storage, repoPath, workspace, treePath, dataset.hash, index);
|
|
317
|
+
if (resolved instanceof Response)
|
|
318
|
+
return resolved;
|
|
319
|
+
typeValue = resolved.collectionType;
|
|
320
|
+
hash = resolved.manifest;
|
|
321
|
+
size = undefined;
|
|
322
|
+
}
|
|
323
|
+
const kind = typeValue.type;
|
|
324
|
+
if (kind !== 'Set' && kind !== 'Dict') {
|
|
325
|
+
return pageError('dataset_not_searchable', `Key search addresses Set or Dict datasets; this dataset holds ${kind}`);
|
|
326
|
+
}
|
|
327
|
+
const keyType = kind === 'Dict'
|
|
328
|
+
? typeValue.value.key
|
|
329
|
+
: typeValue.value;
|
|
330
|
+
return {
|
|
331
|
+
keyType,
|
|
332
|
+
indexed: index !== undefined,
|
|
333
|
+
keysNoun: index !== undefined ? `the keys of index '${index}'` : "this dataset's keys",
|
|
334
|
+
hash,
|
|
335
|
+
size,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Opens the collection a key search searches, or refuses one stored as one
|
|
340
|
+
* blob, which an older e3 wrote.
|
|
341
|
+
*
|
|
342
|
+
* @param storage - Storage backend
|
|
343
|
+
* @param repoPath - Repository identifier
|
|
344
|
+
* @param target - The collection
|
|
345
|
+
* @returns The opened collection, or the refusal
|
|
346
|
+
*/
|
|
347
|
+
export async function openTarget(storage, repoPath, target) {
|
|
348
|
+
return openForRead(storage, repoPath, target.hash, target.size ?? (await storage.objects.stat(repoPath, target.hash)).size);
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=dataset-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset-reads.js","sourceRoot":"","sources":["../../../src/handlers/dataset-reads.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAmC,MAAM,eAAe,CAAC;AAEhJ,OAAO,EACL,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,yBAAyB,GACjF,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE/F,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC;8CAC8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC;;;;kDAIkD;AAClD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAcxD,MAAM,0BAA0B,GAAG,EAAE,CAAC;AACtC;;4CAE4C;AAC5C,MAA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EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9H,CAAC"}
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import { type EastTypeValue } from '@elaraai/east';
|
|
6
6
|
import { type TreePath } from '@elaraai/e3-types';
|
|
7
7
|
import type { StorageBackend, TransferBackend } from '@elaraai/e3-core/portable';
|
|
8
|
+
import { type PinnedCache } from './dataset-reads.js';
|
|
9
|
+
import { type KeySearchQuery } from './key-search.js';
|
|
10
|
+
export { PAGE_BYTE_BUDGET_DEFAULT, type PinnedCache } from './dataset-reads.js';
|
|
8
11
|
/**
|
|
9
12
|
* List dataset fields at the given path.
|
|
10
13
|
*/
|
|
@@ -26,12 +29,6 @@ export declare const DOWNLOAD_REDIRECT_BYTES: number;
|
|
|
26
29
|
* redirect responses from `redirect: 'manual'`.
|
|
27
30
|
*/
|
|
28
31
|
export declare function getDataset(storage: StorageBackend, repoPath: string, workspace: string, treePath: TreePath, repo?: string, requestUrl?: string, transferBackend?: TransferBackend, segments?: boolean): Promise<Response>;
|
|
29
|
-
/** Default cap on a page's share of the source blob, in bytes. The
|
|
30
|
-
* effective limit shrinks so `limit × avgElementBytes` stays under the
|
|
31
|
-
* budget, bounding page payloads even for very wide rows. Deployments with
|
|
32
|
-
* tighter response limits (e.g. Lambda proxy's 6 MB, base64-inflated) pass
|
|
33
|
-
* a smaller budget through the route options. */
|
|
34
|
-
export declare const PAGE_BYTE_BUDGET_DEFAULT: number;
|
|
35
32
|
/** Window addressing for {@link getDatasetPage} and {@link getValuePage}: an
|
|
36
33
|
* element window (`offset`/`limit`) or one writer segment (`segment`),
|
|
37
34
|
* optionally pinned to a content hash. */
|
|
@@ -47,11 +44,11 @@ export interface DatasetPageWindow {
|
|
|
47
44
|
/** Fill each window entry's `row` from the primary.
|
|
48
45
|
*
|
|
49
46
|
* The window's primary keys are grouped by the primary segment that holds
|
|
50
|
-
* them, and each segment is read and decoded once,
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
47
|
+
* them, and each segment is read and decoded once, through the decoded
|
|
48
|
+
* segments the API process keeps: a page reads at most one segment per row,
|
|
49
|
+
* and one whose entries cluster costs far fewer reads than its row count. A
|
|
50
|
+
* view that renders from the index's covering projection alone leaves this
|
|
51
|
+
* off and never touches the primary. */
|
|
55
52
|
join?: boolean;
|
|
56
53
|
/** Content hash the window is addressed against. When it matches the
|
|
57
54
|
* current value the response is immutable (`Cache-Control: immutable`) —
|
|
@@ -61,14 +58,6 @@ export interface DatasetPageWindow {
|
|
|
61
58
|
* rather than answered with different bytes, keeping caches sound. */
|
|
62
59
|
hash?: string;
|
|
63
60
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Who may keep a hash-pinned answer, which never changes: `private`, the
|
|
66
|
-
* caller's own cache alone (a browser's), or `public`, any cache between it
|
|
67
|
-
* and the server as well (a CDN's). `private` unless a host says otherwise,
|
|
68
|
-
* since an answer holds the rows of a workspace its caller was let read; a
|
|
69
|
-
* host whose data any caller may read opts in to `public`.
|
|
70
|
-
*/
|
|
71
|
-
export type PinnedCache = 'private' | 'public';
|
|
72
61
|
/** Server-side limits for {@link getDatasetPage} and {@link getValuePage}, and
|
|
73
62
|
* who may keep a pinned window. */
|
|
74
63
|
export interface DatasetPageLimits {
|
|
@@ -88,10 +77,12 @@ export interface DatasetPageLimits {
|
|
|
88
77
|
* ranges. Segment windows return one writer batch verbatim.
|
|
89
78
|
*
|
|
90
79
|
* Collection datasets are stored as segment manifests by every writer at
|
|
91
|
-
* every size, so every window decodes only the touched segments
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
80
|
+
* every size, so every window decodes only the touched segments — each once,
|
|
81
|
+
* through the decoded segments the API process keeps (Set/Dict windows check
|
|
82
|
+
* each segment against the manifest's fences, and refuse a non-canonical one
|
|
83
|
+
* as corrupt). A collection stored as one blob is an older e3's and is refused
|
|
84
|
+
* as `dataset_not_indexed`, naming the fix — there is no whole-decode
|
|
85
|
+
* fallback.
|
|
95
86
|
*
|
|
96
87
|
* The window is the stored value's ({@link getValuePage}): the dataset's
|
|
97
88
|
* status and pin are checked here first, and an index window is a record's.
|
|
@@ -128,10 +119,7 @@ export declare function getValuePage(storage: StorageBackend, repoPath: string,
|
|
|
128
119
|
* leading fields in declaration order) optionally combined with `prefix`
|
|
129
120
|
* continuing into the next (String) field. Every form addresses one
|
|
130
121
|
* contiguous row range in the canonical key order. */
|
|
131
|
-
export interface DatasetFindQuery {
|
|
132
|
-
key?: string;
|
|
133
|
-
prefix?: string;
|
|
134
|
-
fields?: string[];
|
|
122
|
+
export interface DatasetFindQuery extends KeySearchQuery {
|
|
135
123
|
/** Search one of a record's secondary indexes instead of the record itself.
|
|
136
124
|
* The rows the answer names are then the index's, in index order, and the
|
|
137
125
|
* key, prefix and fields forms address the index key (`ik`), the key the
|
|
@@ -156,9 +144,10 @@ export interface DatasetFindQuery {
|
|
|
156
144
|
* {@link getDatasetPage} element windows serve — so the result plugs
|
|
157
145
|
* straight into the paged preview's scroll position. The search
|
|
158
146
|
* binary-searches the manifest's segment fences (each segment's first key)
|
|
159
|
-
* with the key type's East comparator, then
|
|
160
|
-
* segment (exact key) or the two edge segments (a range —
|
|
161
|
-
* exact key is through an index: every entry under it)
|
|
147
|
+
* with the key type's East comparator, then binary-searches the keys of at
|
|
148
|
+
* most the one owning segment (exact key) or the two edge segments (a range —
|
|
149
|
+
* which is what an exact key is through an index: every entry under it), each
|
|
150
|
+
* read and decoded once, through the decoded segments the API process keeps.
|
|
162
151
|
*
|
|
163
152
|
* Responds with JSON `{ found, row, count }`: `row` is the match's global
|
|
164
153
|
* element index (for a prefix, the range's first row; for a miss, the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../src/handlers/datasets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../src/handlers/datasets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqG,KAAK,aAAa,EAAe,MAAM,eAAe,CAAC;AACnK,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAWvE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjF,OAAO,EAEyF,KAAK,WAAW,EAC/G,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA+B,KAAK,cAAc,EAAgB,MAAM,iBAAiB,CAAC;AAGjG,OAAO,EAAE,wBAAwB,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhF;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;iEACiE;AACjE,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,eAAe,EACjC,QAAQ,UAAQ,GACf,OAAO,CAAC,QAAQ,CAAC,CAiGnB;AAGD;;2CAE2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;oFAGgF;IACh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