Merge pull request 'feat: add uwf cas reindex command' (#334) from feat/cas-reindex into main
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
|||||||
cmdCasGet,
|
cmdCasGet,
|
||||||
cmdCasHas,
|
cmdCasHas,
|
||||||
cmdCasPut,
|
cmdCasPut,
|
||||||
|
cmdCasReindex,
|
||||||
cmdCasRefs,
|
cmdCasRefs,
|
||||||
cmdCasSchemaGet,
|
cmdCasSchemaGet,
|
||||||
cmdCasSchemaList,
|
cmdCasSchemaList,
|
||||||
@@ -239,6 +240,16 @@ cas
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cas
|
||||||
|
.command("reindex")
|
||||||
|
.description("Rebuild type index from all CAS nodes")
|
||||||
|
.action(() => {
|
||||||
|
const storageRoot = resolveStorageRoot();
|
||||||
|
runAction(async () => {
|
||||||
|
writeOutput(await cmdCasReindex(storageRoot));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const casSchema = cas.command("schema").description("CAS schema operations");
|
const casSchema = cas.command("schema").description("CAS schema operations");
|
||||||
|
|
||||||
casSchema
|
casSchema
|
||||||
|
|||||||
@@ -115,6 +115,17 @@ export async function cmdCasSchemaList(
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function cmdCasReindex(
|
||||||
|
storageRoot: string,
|
||||||
|
): Promise<{ status: string }> {
|
||||||
|
const indexDir = join(storageRoot, "cas", "_index");
|
||||||
|
const { rmSync } = await import("node:fs");
|
||||||
|
rmSync(indexDir, { recursive: true, force: true });
|
||||||
|
// Re-open store to trigger migration rebuild
|
||||||
|
openStore(storageRoot);
|
||||||
|
return { status: "reindexed" };
|
||||||
|
}
|
||||||
|
|
||||||
export async function cmdCasSchemaGet(
|
export async function cmdCasSchemaGet(
|
||||||
storageRoot: string,
|
storageRoot: string,
|
||||||
hash: string,
|
hash: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user