feat: list_bases returns registered table storage prefixes

Return the additional storage bases for the current table snapshot
on native, memory, namespace, and Cloud clients.
This commit is contained in:
geruh
2026-08-21 00:48:38 -07:00
parent 047f431837
commit cfcbcfbc92
14 changed files with 418 additions and 43 deletions
+62
View File
@@ -1028,11 +1028,30 @@ describe("remote connection jobs surface", () => {
});
return;
}
if (path.endsWith("/bases/list/")) {
res.writeHead(200, { "Content-Type": "application/json" }).end(
JSON.stringify({
bases: [
{
path: "s3://bucket/media/",
isDatasetRoot: false,
},
],
}),
);
return;
}
res.writeHead(404).end();
},
async (db) => {
const table = await db.openTable("photos");
await table.addBases({ path: "s3://bucket/media/" });
expect(await table.listBases()).toEqual([
{
path: "s3://bucket/media/",
isDatasetRoot: false,
},
]);
},
);
expect(postedBodies).toEqual([
@@ -1046,4 +1065,47 @@ describe("remote connection jobs surface", () => {
},
]);
});
it("listBases returns a named dataset-root base", async () => {
await withMockDatabase(
(req, res) => {
const path = req.url ?? "";
if (path.endsWith("/describe/")) {
res.writeHead(200, { "Content-Type": "application/json" }).end(
JSON.stringify({
name: "photos",
version: 1,
schema: { fields: [] },
}),
);
return;
}
if (path.endsWith("/bases/list/")) {
res.writeHead(200, { "Content-Type": "application/json" }).end(
JSON.stringify({
bases: [
{
path: "s3://bucket/archive/",
name: "archive",
isDatasetRoot: true,
},
],
}),
);
return;
}
res.writeHead(404).end();
},
async (db) => {
const table = await db.openTable("photos");
expect(await table.listBases()).toEqual([
{
path: "s3://bucket/archive/",
name: "archive",
isDatasetRoot: true,
},
]);
},
);
});
});
+8 -2
View File
@@ -3413,7 +3413,7 @@ describe("table bases", () => {
});
afterEach(() => tmpDir.removeCallback());
it("addBases accepts a file uri", async () => {
it("listBases reflects added bases", async () => {
const conn = await connect(tmpDir.name);
const table = await conn.createEmptyTable(
"photos",
@@ -3421,6 +3421,12 @@ describe("table bases", () => {
);
const media = path.join(tmpDir.name, "media");
fs.mkdirSync(media);
await table.addBases(pathToFileURL(media).toString());
const location = pathToFileURL(media).toString();
expect(await table.listBases()).toEqual([]);
await table.addBases(location);
expect(await table.listBases()).toEqual([
{ path: location, isDatasetRoot: false },
]);
});
});