Files
fn_registry/functions/infra/vault_aggregate_index.md
T
egutierrez e3c8979e8d chore: auto-commit (95 archivos)
- cmd/fn/doctor.go
- cmd/fn/main.go
- cpp/apps/primitives_gallery/playground/tables/CMakeLists.txt
- cpp/apps/primitives_gallery/playground/tables/data_table.cpp
- cpp/apps/primitives_gallery/playground/tables/data_table_logic.cpp
- cpp/apps/primitives_gallery/playground/tables/data_table_logic.h
- cpp/apps/primitives_gallery/playground/tables/self_test.cpp
- cpp/apps/primitives_gallery/playground/tables/tql.cpp
- cpp/apps/primitives_gallery/playground/tables/viz.cpp
- cpp/apps/primitives_gallery/playground/tables/viz.h
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 00:50:34 +02:00

2.2 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, params, output
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path params output
vault_aggregate_index function go infra 1.0.0 impure func VaultAggregateIndex(repoRoot string) (AggregateReport, error) Agrega los índices de todos los vaults del registry en la tabla vault_files de registry.db. Lee cada vault_index.db (via VaultIndexOpen) y reemplaza las filas de forma atómica. Idempotente: re-ejecutar limpia y reescribe sin duplicar.
vault
index
aggregate
registry
vault_manifest_read_go_infra
vault_index_open_go_infra
sqlite_open_go_infra
vault_file_go_infra
false error_go_core
database/sql
fmt
os
path/filepath
time
true
TestVaultAggregateIndex_NoVaults
TestVaultAggregateIndex_VaultWithoutIndex
TestVaultAggregateIndex_HappyPath
TestVaultAggregateIndex_ReRunReplaces
functions/infra/vault_aggregate_index_test.go functions/infra/vault_aggregate_index.go
name desc
repoRoot Ruta absoluta a la raiz del fn_registry (contiene registry.db y projects/).
AggregateReport con VaultsProcessed, VaultsSkipped (sin vault_index.db), TotalFiles y Errors (errores no fatales por vault). Error fatal solo si registry.db no se puede abrir.

Ejemplo

report, err := infra.VaultAggregateIndex("/home/lucas/fn_registry")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Processed: %d vaults, %d files\n", report.VaultsProcessed, report.TotalFiles)
for _, e := range report.Errors {
    fmt.Println("warning:", e)
}

Notas

  • Requiere que registry/migrations/012_vault_files.sql haya sido aplicado (o que el indexer lo aplique al arrancar). La función aplica la migración de forma idempotente ella misma con CREATE TABLE IF NOT EXISTS.
  • Por cada vault: DELETE WHERE vault_id = ? + batch INSERT dentro de una transacción. Re-run siempre produce el mismo resultado.
  • Vaults sin vault_index.db se cuentan en VaultsSkipped y se omiten sin error.
  • El vault_id sigue el patrón <vault_name>_<project_id>, consistente con la tabla vaults de registry.db.