@gscdump/engine 0.32.3 → 0.32.5
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/dist/iceberg/index.mjs +16 -2
- package/package.json +3 -3
package/dist/iceberg/index.mjs
CHANGED
|
@@ -219,11 +219,16 @@ async function createIcebergTables(conn, tables = ICEBERG_TABLES, encoding = "st
|
|
|
219
219
|
async function listIcebergTables(conn) {
|
|
220
220
|
return (await restCatalogListTables(conn.catalog, { namespace: conn.namespace })).map((t) => t.name).sort();
|
|
221
221
|
}
|
|
222
|
-
const SNAPSHOT_REF_TTL_MS =
|
|
222
|
+
const SNAPSHOT_REF_TTL_MS = 300 * 1e3;
|
|
223
223
|
const RESOLVED_FILES_TTL_MS = 1440 * 60 * 1e3;
|
|
224
|
+
const METADATA_TTL_MS = 1440 * 60 * 1e3;
|
|
225
|
+
const MAX_CACHED_METADATA_BYTES = 2 * 1024 * 1024;
|
|
224
226
|
function snapshotRefKey(namespace, table) {
|
|
225
227
|
return `gsc-snapref\0${namespace}\0${table}`;
|
|
226
228
|
}
|
|
229
|
+
function metadataRefKey(namespace, table, snapshotId) {
|
|
230
|
+
return `gsc-snapmeta\0${namespace}\0${table}\0${snapshotId}`;
|
|
231
|
+
}
|
|
227
232
|
function resolvedFilesKey(namespace, table, snapshotId, siteId, searchType, wantedMonths) {
|
|
228
233
|
return `gsc-files\0${namespace}\0${table}\0${snapshotId}\0${siteId}\0${searchType}\0${[...wantedMonths].sort((a, b) => a - b).join(",")}`;
|
|
229
234
|
}
|
|
@@ -267,7 +272,12 @@ async function loadSnapshotId(conn, opts, now) {
|
|
|
267
272
|
});
|
|
268
273
|
const raw = metadata["current-snapshot-id"];
|
|
269
274
|
const snapshotId = raw == null ? null : String(raw);
|
|
270
|
-
if (opts.cache)
|
|
275
|
+
if (opts.cache) {
|
|
276
|
+
await cachePut(opts.cache, snapshotRefKey(conn.namespace, opts.table), snapshotId, SNAPSHOT_REF_TTL_MS, now);
|
|
277
|
+
if (snapshotId != null) {
|
|
278
|
+
if (JSON.stringify(metadata).length <= MAX_CACHED_METADATA_BYTES) await cachePut(opts.cache, metadataRefKey(conn.namespace, opts.table, snapshotId), metadata, METADATA_TTL_MS, now);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
271
281
|
return {
|
|
272
282
|
snapshotId,
|
|
273
283
|
metadata
|
|
@@ -288,6 +298,10 @@ async function listIcebergDataFiles(conn, opts) {
|
|
|
288
298
|
endCache?.({ hit: cached !== void 0 });
|
|
289
299
|
if (cached !== void 0) return cached;
|
|
290
300
|
}
|
|
301
|
+
if (!metadata && opts.cache) {
|
|
302
|
+
const cachedMeta = await cacheGet(opts.cache, metadataRefKey(conn.namespace, opts.table, snapshotId), now);
|
|
303
|
+
if (cachedMeta != null) metadata = cachedMeta;
|
|
304
|
+
}
|
|
291
305
|
if (!metadata) {
|
|
292
306
|
const reloaded = await loadSnapshotId(conn, {
|
|
293
307
|
...opts,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.32.
|
|
4
|
+
"version": "0.32.5",
|
|
5
5
|
"description": "Append-only Parquet/DuckDB storage engine + planner + adapters for the gscdump pipeline. Node + edge runtimes; opt-in heavy peers.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -181,8 +181,8 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"drizzle-orm": "1.0.0-rc.3",
|
|
183
183
|
"proper-lockfile": "^4.1.2",
|
|
184
|
-
"
|
|
185
|
-
"gscdump": "0.32.
|
|
184
|
+
"gscdump": "0.32.5",
|
|
185
|
+
"@gscdump/contracts": "0.32.5"
|
|
186
186
|
},
|
|
187
187
|
"devDependencies": {
|
|
188
188
|
"@duckdb/duckdb-wasm": "^1.32.0",
|