@dikolab/kbdb 0.4.3 → 0.6.0
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/CLA.md +68 -0
- package/LICENSE +676 -12
- package/LICENSING.md +58 -0
- package/README.md +50 -27
- package/README.md.bak +320 -0
- package/dist/README.md +320 -0
- package/dist/{chunk-BJXEVALU.mjs → chunk-QLJ33C74.mjs} +44 -44
- package/dist/chunk-QLJ33C74.mjs.map +7 -0
- package/dist/cli.cjs +550 -232
- package/dist/cli.cjs.map +4 -4
- package/dist/cli.d.ts +0 -8
- package/dist/cli.mjs +483 -154
- package/dist/cli.mjs.map +4 -4
- package/dist/kbdb-worker.cjs +36 -5
- package/dist/kbdb-worker.cjs.map +3 -3
- package/dist/mod.cjs +89 -30
- package/dist/mod.cjs.map +4 -4
- package/dist/mod.mjs +88 -30
- package/dist/mod.mjs.map +4 -4
- package/dist/src/cli.d.ts +0 -8
- package/dist/src/shared/cli/constants/defaults.constant.d.ts +1 -1
- package/dist/src/shared/cli/constants/recfile-command-field-map.constant.d.ts +8 -0
- package/dist/src/shared/cli/constants/recfile-field-maps.constant.d.ts +21 -0
- package/dist/src/shared/cli/functions/compute-directory-level.function.d.ts +14 -0
- package/dist/src/shared/cli/functions/dispatch-command.function.d.ts +2 -28
- package/dist/src/shared/cli/functions/format-command-output.function.d.ts +14 -0
- package/dist/src/shared/cli/functions/format-db-not-found.function.d.ts +20 -0
- package/dist/src/shared/cli/functions/format-output.function.d.ts +1 -0
- package/dist/src/shared/cli/functions/format-recfile-output.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/render-recfile-value.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/resolve-db-dir.function.d.ts +24 -0
- package/dist/src/shared/cli/functions/resolve-recfile-key.function.d.ts +9 -0
- package/dist/src/shared/cli/functions/run-db-path.function.d.ts +10 -0
- package/dist/src/shared/cli/functions/run-export.function.d.ts +8 -4
- package/dist/src/shared/cli/functions/run-import.function.d.ts +4 -0
- package/dist/src/shared/cli/functions/run-learn.function.d.ts +12 -0
- package/dist/src/shared/cli/index.d.ts +4 -1
- package/dist/src/shared/cli/typings/cli-options.interface.d.ts +9 -2
- package/dist/src/shared/cli/typings/db-resolution.interface.d.ts +9 -0
- package/dist/src/shared/cli/typings/recfile-field-map.type.d.ts +10 -0
- package/dist/src/shared/version/constants/version.constant.d.ts +1 -1
- package/dist/src/shared/wasm-codec/functions/decode-option-u8.function.d.ts +9 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-records.function.d.ts +4 -0
- package/dist/src/shared/wasm-codec/functions/encode-add-section-params.function.d.ts +2 -45
- package/dist/src/shared/wasm-codec/functions/encode-update-section-params.function.d.ts +10 -1
- package/dist/src/shared/wasm-codec/index.d.ts +1 -1
- package/dist/src/shared/wasm-codec/typings/add-section-input.model.d.ts +6 -0
- package/dist/src/shared/wasm-codec/typings/section-record-trailing.model.d.ts +5 -0
- package/dist/src/shared/wasm-codec/typings/section-record.model.d.ts +5 -0
- package/dist/src/shared/worker-client/functions/build-deno-permissions.function.d.ts +11 -0
- package/dist/src/shared/worker-client/functions/read-crash-reason.function.d.ts +9 -0
- package/dist/src/shared/worker-client/functions/resolve-spawn-script.function.d.ts +6 -0
- package/dist/src/shared/worker-client/functions/spawn-daemon.function.d.ts +1 -1
- package/dist/src/shared/worker-client/typings/section.model.d.ts +5 -0
- package/dist/src/shared/worker-client/typings/worker-client-options.interface.d.ts +0 -6
- package/dist/src/shared/worker-daemon/functions/count-files.function.d.ts +12 -0
- package/dist/src/shared/worker-daemon/functions/handle-import.function.d.ts +2 -0
- package/dist/src/shared/worker-daemon/functions/handle-read-ops.function.d.ts +8 -0
- package/dist/src/shared/worker-daemon/functions/validate-daemon-path.function.d.ts +15 -0
- package/dist/src/worker.d.ts +0 -7
- package/dist/wasm/default-embedding/kbdb_default_embedding_bg.wasm +0 -0
- package/dist/wasm/default-embedding/package.json +1 -1
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/dist/wasm/fs-database/package.json +1 -1
- package/dist/wasm/fs-migration/kbdb_fs_migration_bg.wasm +0 -0
- package/dist/wasm/fs-migration/package.json +1 -1
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/dist/wasm/kb-worker/package.json +1 -1
- package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
- package/dist/wasm/query-parser/package.json +1 -1
- package/dist/worker.d.ts +0 -7
- package/dist/worker.mjs +37 -6
- package/dist/worker.mjs.map +3 -3
- package/package.json +13 -12
- package/dist/chunk-BJXEVALU.mjs.map +0 -7
- package/dist/src/shared/cli/functions/resolve-raw-db-path.function.d.ts +0 -10
- package/docs/details/README.md +0 -30
- package/docs/details/agent-tooling.md +0 -132
- package/docs/details/cli.md +0 -777
- package/docs/details/knowledge-base.md +0 -180
- package/docs/details/library-api.md +0 -495
- package/docs/details/mcp-server.md +0 -482
- package/docs/details/search-and-ranking.md +0 -575
- package/docs/details/storage.md +0 -531
- package/docs/goals/agents.md +0 -751
- package/docs/goals/architecture.svg +0 -198
- package/docs/goals/auto-capture.md +0 -378
- package/docs/goals/benchmarking.md +0 -296
- package/docs/goals/cli.md +0 -2654
- package/docs/goals/concurrency.md +0 -259
- package/docs/goals/content-composer.md +0 -609
- package/docs/goals/content-parser.md +0 -279
- package/docs/goals/database.md +0 -1679
- package/docs/goals/document.md +0 -368
- package/docs/goals/hybrid-search.md +0 -465
- package/docs/goals/mcp.md +0 -1541
- package/docs/goals/overview.md +0 -124
- package/docs/goals/query-parser.md +0 -373
- package/docs/goals/query-result.md +0 -860
- package/docs/goals/semantic-dedup.md +0 -233
- package/docs/goals/skills.md +0 -810
- package/docs/goals/sync.md +0 -217
- package/docs/goals/worker-client.md +0 -1005
- package/docs/goals/worker-daemon.md +0 -1547
- package/docs/modules/overview.md +0 -319
- package/docs/modules/rust/embedding/module.md +0 -91
- package/docs/modules/rust/fs-database/functions/document.md +0 -48
- package/docs/modules/rust/fs-database/functions/integrity.md +0 -79
- package/docs/modules/rust/fs-database/functions/io.md +0 -87
- package/docs/modules/rust/fs-database/functions/module.md +0 -22
- package/docs/modules/rust/fs-database/functions/query-exec.md +0 -44
- package/docs/modules/rust/fs-database/functions/section.md +0 -76
- package/docs/modules/rust/fs-database/indexes/btree.md +0 -35
- package/docs/modules/rust/fs-database/indexes/corpus.md +0 -61
- package/docs/modules/rust/fs-database/indexes/inverted.md +0 -60
- package/docs/modules/rust/fs-database/indexes/module.md +0 -64
- package/docs/modules/rust/fs-database/indexes/positional.md +0 -39
- package/docs/modules/rust/fs-database/indexes/vectors.md +0 -110
- package/docs/modules/rust/fs-database/module.md +0 -150
- package/docs/modules/rust/fs-database/types/catalog.md +0 -53
- package/docs/modules/rust/fs-database/types/module.md +0 -12
- package/docs/modules/rust/fs-database/types/section.md +0 -127
- package/docs/modules/rust/kb-worker/functions/compose.md +0 -57
- package/docs/modules/rust/kb-worker/functions/module.md +0 -20
- package/docs/modules/rust/kb-worker/functions/retrieve.md +0 -194
- package/docs/modules/rust/kb-worker/functions/search.md +0 -173
- package/docs/modules/rust/kb-worker/functions/write.md +0 -172
- package/docs/modules/rust/kb-worker/module.md +0 -171
- package/docs/modules/rust/kb-worker/types/cache.md +0 -90
- package/docs/modules/rust/kb-worker/types/context.md +0 -26
- package/docs/modules/rust/kb-worker/types/module.md +0 -16
- package/docs/modules/rust/kb-worker/types/status.md +0 -29
- package/docs/modules/rust/kb-worker/types/token.md +0 -50
- package/docs/modules/rust/overview.md +0 -531
- package/docs/modules/rust/query-parser/functions/extract.md +0 -56
- package/docs/modules/rust/query-parser/functions/module.md +0 -18
- package/docs/modules/rust/query-parser/functions/parse.md +0 -33
- package/docs/modules/rust/query-parser/functions/pipeline.md +0 -9
- package/docs/modules/rust/query-parser/functions/rank.md +0 -85
- package/docs/modules/rust/query-parser/module.md +0 -131
- package/docs/modules/rust/query-parser/types/cache.md +0 -39
- package/docs/modules/rust/query-parser/types/keyphrase.md +0 -71
- package/docs/modules/rust/query-parser/types/module.md +0 -18
- package/docs/modules/rust/query-parser/types/token.md +0 -46
- package/docs/modules/rust/shared/content-composer/functions.md +0 -114
- package/docs/modules/rust/shared/content-composer/module.md +0 -147
- package/docs/modules/rust/shared/content-composer/types.md +0 -93
- package/docs/modules/rust/shared/content-parser/functions.md +0 -72
- package/docs/modules/rust/shared/content-parser/module.md +0 -99
- package/docs/modules/rust/shared/content-parser/types.md +0 -71
- package/docs/modules/rust/shared/corpus/module.md +0 -24
- package/docs/modules/rust/shared/corpus/types.md +0 -141
- package/docs/modules/rust/shared/document/module.md +0 -25
- package/docs/modules/rust/shared/document/types.md +0 -154
- package/docs/modules/rust/shared/encode/module.md +0 -22
- package/docs/modules/rust/shared/encode/traits.md +0 -304
- package/docs/modules/rust/shared/error/module.md +0 -28
- package/docs/modules/rust/shared/error/types.md +0 -302
- package/docs/modules/rust/shared/kbid/module.md +0 -24
- package/docs/modules/rust/shared/kbid/types.md +0 -147
- package/docs/modules/rust/shared/memory/functions.md +0 -209
- package/docs/modules/rust/shared/memory/module.md +0 -24
- package/docs/modules/rust/shared/module.md +0 -196
- package/docs/modules/rust/shared/pipeline/functions.md +0 -141
- package/docs/modules/rust/shared/pipeline/module.md +0 -62
- package/docs/modules/rust/shared/pipeline/types.md +0 -43
- package/docs/modules/rust/shared/query/module.md +0 -27
- package/docs/modules/rust/shared/query/types.md +0 -236
- package/docs/modules/rust/shared/section/module.md +0 -25
- package/docs/modules/rust/shared/section/types.md +0 -294
- package/docs/modules/rust/shared/term/module.md +0 -25
- package/docs/modules/rust/shared/term/types.md +0 -139
- package/docs/modules/typescript/cli.md +0 -131
- package/docs/modules/typescript/kbdb-worker.md +0 -150
- package/docs/modules/typescript/overview.md +0 -400
- package/docs/modules/typescript/shared/auto-capture/module.md +0 -73
- package/docs/modules/typescript/shared/cli/constants.md +0 -23
- package/docs/modules/typescript/shared/cli/functions.md +0 -809
- package/docs/modules/typescript/shared/cli/module.md +0 -138
- package/docs/modules/typescript/shared/cli/typings.md +0 -197
- package/docs/modules/typescript/shared/embedding/functions.md +0 -200
- package/docs/modules/typescript/shared/embedding/module.md +0 -77
- package/docs/modules/typescript/shared/embedding/typings.md +0 -124
- package/docs/modules/typescript/shared/hash/functions.md +0 -20
- package/docs/modules/typescript/shared/hash/module.md +0 -21
- package/docs/modules/typescript/shared/log/constants.md +0 -82
- package/docs/modules/typescript/shared/log/functions.md +0 -131
- package/docs/modules/typescript/shared/log/module.md +0 -153
- package/docs/modules/typescript/shared/log/typings.md +0 -82
- package/docs/modules/typescript/shared/mcp/classes.md +0 -179
- package/docs/modules/typescript/shared/mcp/functions.md +0 -386
- package/docs/modules/typescript/shared/mcp/module.md +0 -160
- package/docs/modules/typescript/shared/mcp/typings.md +0 -529
- package/docs/modules/typescript/shared/module.md +0 -110
- package/docs/modules/typescript/shared/platform/functions.md +0 -42
- package/docs/modules/typescript/shared/platform/module.md +0 -25
- package/docs/modules/typescript/shared/runtime/functions.md +0 -26
- package/docs/modules/typescript/shared/runtime/module.md +0 -27
- package/docs/modules/typescript/shared/runtime/typings.md +0 -13
- package/docs/modules/typescript/shared/version/module.md +0 -27
- package/docs/modules/typescript/shared/wasm-codec/functions.md +0 -391
- package/docs/modules/typescript/shared/wasm-codec/module.md +0 -98
- package/docs/modules/typescript/shared/worker-client/classes.md +0 -264
- package/docs/modules/typescript/shared/worker-client/functions.md +0 -175
- package/docs/modules/typescript/shared/worker-client/module.md +0 -92
- package/docs/modules/typescript/shared/worker-client/typings.md +0 -511
- package/docs/modules/typescript/shared/worker-daemon/classes.md +0 -239
- package/docs/modules/typescript/shared/worker-daemon/constants.md +0 -37
- package/docs/modules/typescript/shared/worker-daemon/functions.md +0 -234
- package/docs/modules/typescript/shared/worker-daemon/module.md +0 -118
- package/docs/modules/typescript/shared/worker-daemon/typings.md +0 -132
- package/docs/overview.md +0 -191
- package/docs/release-notes/0.1.0.md +0 -189
- package/docs/release-notes/0.1.1.md +0 -46
- package/docs/release-notes/0.1.2.md +0 -38
- package/docs/release-notes/0.1.3.md +0 -42
- package/docs/release-notes/0.2.0.md +0 -147
- package/docs/release-notes/0.3.0.md +0 -89
- package/docs/release-notes/0.3.1.md +0 -121
- package/docs/release-notes/0.3.2.md +0 -64
- package/docs/release-notes/0.4.0.md +0 -80
- package/docs/release-notes/0.4.1.md +0 -149
- package/docs/release-notes/0.4.3.md +0 -60
- package/docs/release-notes/README.md +0 -13
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# functions::section -- Section CRUD
|
|
2
|
-
|
|
3
|
-
*Content-addressable section file operations: read,
|
|
4
|
-
add, update, remove.*
|
|
5
|
-
|
|
6
|
-
## Source
|
|
7
|
-
|
|
8
|
-
`engine/crates/fs-database/src/section/mod.rs`
|
|
9
|
-
|
|
10
|
-
## Functions
|
|
11
|
-
|
|
12
|
-
```rust
|
|
13
|
-
pub fn read_section(kbid: &KbId)
|
|
14
|
-
-> Result<SectionRecord, FsError>;
|
|
15
|
-
|
|
16
|
-
pub fn read_sections(kbids: &[KbId])
|
|
17
|
-
-> Result<Vec<SectionRecord>, FsError>;
|
|
18
|
-
|
|
19
|
-
pub fn add_section(params: &AddSectionParams)
|
|
20
|
-
-> Result<AddSectionResult, FsError>;
|
|
21
|
-
|
|
22
|
-
pub fn update_section(
|
|
23
|
-
kbid: &KbId, new_content: &[u8],
|
|
24
|
-
) -> Result<UpdateSectionResult, FsError>;
|
|
25
|
-
|
|
26
|
-
pub fn remove_section(kbid: &KbId)
|
|
27
|
-
-> Result<bool, FsError>;
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### `add_section`
|
|
31
|
-
|
|
32
|
-
1. Compute kb-id from content via `compute_kbid`.
|
|
33
|
-
2. **Supersession check**: if `source_key` is
|
|
34
|
-
provided and a section with the same `source_key`
|
|
35
|
-
already exists, set `supersedes` to the old
|
|
36
|
-
section's kbid, set `updated_at` to the current
|
|
37
|
-
timestamp, remove the old kbid from document
|
|
38
|
-
manifests, and mark the old section for GC. The
|
|
39
|
-
new section replaces the old one as the current
|
|
40
|
-
version.
|
|
41
|
-
3. Create shard directory if needed (`host_mkdir`).
|
|
42
|
-
4. Serialize TOML header + `---` separator + body.
|
|
43
|
-
TOML header includes: kbid, docids, section_type,
|
|
44
|
-
title, description, size, created_at, checksum,
|
|
45
|
-
token_count, heading_token_count,
|
|
46
|
-
body_token_count, code_token_count, source_key,
|
|
47
|
-
source_path, source_mtime, updated_at, tags,
|
|
48
|
-
supersedes.
|
|
49
|
-
5. Write atomically via `atomic_write`.
|
|
50
|
-
6. **Near-duplicate detection**: compute Jaccard
|
|
51
|
-
coefficient on stemmed term sets against existing
|
|
52
|
-
sections. Sections with similarity >= 0.85 are
|
|
53
|
-
reported as `near_duplicates` in the result
|
|
54
|
-
(advisory, not a block).
|
|
55
|
-
7. Update catalog via `increment_sections(1)`.
|
|
56
|
-
|
|
57
|
-
Validation: image sections (`image/*` type) require
|
|
58
|
-
a `title` in `AddSectionParams`. Text sections
|
|
59
|
-
without a `title` emit a `heading_missing` warning
|
|
60
|
-
in the result.
|
|
61
|
-
|
|
62
|
-
### `update_section`
|
|
63
|
-
|
|
64
|
-
1. Read existing section to determine type.
|
|
65
|
-
2. Create new section file (new kb-id).
|
|
66
|
-
3. Call `update_section_ref` to update document
|
|
67
|
-
manifest references from old to new kb-id.
|
|
68
|
-
4. Mark old section file for garbage collection.
|
|
69
|
-
5. Update catalog.
|
|
70
|
-
|
|
71
|
-
### `remove_section`
|
|
72
|
-
|
|
73
|
-
1. Delete the section file.
|
|
74
|
-
2. Remove kb-id from any document manifests.
|
|
75
|
-
3. Update catalog via `increment_sections(-1)`.
|
|
76
|
-
4. Trigger index update to remove terms.
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# indexes::btree -- B+ Tree
|
|
2
|
-
|
|
3
|
-
*Generic B+ tree implementation for ordered key-value
|
|
4
|
-
storage in binary index files.*
|
|
5
|
-
|
|
6
|
-
## Source
|
|
7
|
-
|
|
8
|
-
`engine/crates/fs-database/src/index/btree.rs`
|
|
9
|
-
|
|
10
|
-
## Type Definition
|
|
11
|
-
|
|
12
|
-
```rust
|
|
13
|
-
pub struct BPlusTree<K, V> {
|
|
14
|
-
// on-disk B+ tree with configurable page size
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
impl<K: Ord + Encode, V: Encode> BPlusTree<K, V> {
|
|
18
|
-
pub fn open(data: &[u8])
|
|
19
|
-
-> Result<Self, IndexError>;
|
|
20
|
-
pub fn lookup(&self, key: &K)
|
|
21
|
-
-> Option<&V>;
|
|
22
|
-
pub fn range(&self, start: &K, end: &K)
|
|
23
|
-
-> Vec<(&K, &V)>;
|
|
24
|
-
pub fn insert(&mut self, key: K, value: V);
|
|
25
|
-
pub fn remove(&mut self, key: &K) -> bool;
|
|
26
|
-
pub fn serialize(&self) -> Vec<u8>;
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Page size is tuned for WASM memory constraints.
|
|
31
|
-
Interior nodes store keys and child pointers. Leaf
|
|
32
|
-
nodes store keys and values with sibling links for
|
|
33
|
-
range scans.
|
|
34
|
-
|
|
35
|
-
Used by both `InvertedIndex` and `PositionalIndex`.
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# indexes::corpus -- Corpus Statistics
|
|
2
|
-
|
|
3
|
-
*Corpus-wide term statistics for IDF computation.
|
|
4
|
-
Stored in `indexes/corpus.dat`.*
|
|
5
|
-
|
|
6
|
-
## Source
|
|
7
|
-
|
|
8
|
-
`engine/crates/fs-database/src/index/corpus.rs`
|
|
9
|
-
|
|
10
|
-
## Type Definition
|
|
11
|
-
|
|
12
|
-
```rust
|
|
13
|
-
pub struct CorpusStats {
|
|
14
|
-
pub total_sections: u32,
|
|
15
|
-
pub total_terms: u32,
|
|
16
|
-
pub term_doc_freq: HashMap<Term, u32>,
|
|
17
|
-
pub avg_section_length: f32,
|
|
18
|
-
pub avg_heading_length: f32,
|
|
19
|
-
pub avg_body_length: f32,
|
|
20
|
-
pub avg_code_length: f32,
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
This is the **full** corpus stats struct with the
|
|
25
|
-
per-term document frequency map. The lightweight
|
|
26
|
-
`CorpusStats` in `kbdb-shared` (see
|
|
27
|
-
[shared/corpus](../../shared/corpus/types.md))
|
|
28
|
-
contains only the scalar fields that cross module
|
|
29
|
-
boundaries.
|
|
30
|
-
|
|
31
|
-
Per-field average lengths enable accurate BM25F
|
|
32
|
-
per-field length normalization. Each field's
|
|
33
|
-
average is computed from the corresponding
|
|
34
|
-
per-field token counts stored in section headers.
|
|
35
|
-
|
|
36
|
-
## Methods
|
|
37
|
-
|
|
38
|
-
```rust
|
|
39
|
-
impl CorpusStats {
|
|
40
|
-
pub fn idf(&self, term: &Term) -> f32;
|
|
41
|
-
pub fn update_add(
|
|
42
|
-
&mut self,
|
|
43
|
-
terms: &[Term],
|
|
44
|
-
field_token_counts: &FieldTokenCounts,
|
|
45
|
-
);
|
|
46
|
-
pub fn update_remove(
|
|
47
|
-
&mut self,
|
|
48
|
-
terms: &[Term],
|
|
49
|
-
field_token_counts: &FieldTokenCounts,
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
`idf` computes inverse document frequency:
|
|
55
|
-
`ln((N - df(t) + 0.5) / (df(t) + 0.5) + 1)`.
|
|
56
|
-
|
|
57
|
-
`update_add` increments document frequency counters
|
|
58
|
-
for each term and updates per-field average length
|
|
59
|
-
accumulators using the section's field token counts.
|
|
60
|
-
`update_remove` decrements them and adjusts the
|
|
61
|
-
per-field averages accordingly.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# indexes::inverted -- Inverted Index
|
|
2
|
-
|
|
3
|
-
*Maps normalized terms to lists of
|
|
4
|
-
(kb-id, heading_tf, body_tf, code_tf) posting
|
|
5
|
-
entries. Stored in `indexes/terms.idx`.*
|
|
6
|
-
|
|
7
|
-
## Source
|
|
8
|
-
|
|
9
|
-
`engine/crates/fs-database/src/index/inverted.rs`
|
|
10
|
-
|
|
11
|
-
## Type Definitions
|
|
12
|
-
|
|
13
|
-
```rust
|
|
14
|
-
pub struct InvertedIndex {
|
|
15
|
-
tree: BPlusTree<Term, PostingList>,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
pub struct PostingList {
|
|
19
|
-
pub entries: Vec<Posting>,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
pub struct Posting {
|
|
23
|
-
pub kbid: KbId,
|
|
24
|
-
pub heading_tf: f32,
|
|
25
|
-
pub body_tf: f32,
|
|
26
|
-
pub code_tf: f32,
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Each `Posting` stores per-field term frequencies
|
|
31
|
-
instead of a single aggregate weight. Storing
|
|
32
|
-
per-field TFs separately enables query-time field
|
|
33
|
-
weight tuning (heading 2.0x, body 1.0x, code 1.5x)
|
|
34
|
-
without rebuilding indexes. See
|
|
35
|
-
[FieldTf](../../shared/query/types.md) for the
|
|
36
|
-
shared struct used across module boundaries.
|
|
37
|
-
|
|
38
|
-
## Methods
|
|
39
|
-
|
|
40
|
-
```rust
|
|
41
|
-
impl InvertedIndex {
|
|
42
|
-
pub fn lookup_term(&self, term: &Term)
|
|
43
|
-
-> Option<&PostingList>;
|
|
44
|
-
|
|
45
|
-
pub fn add_terms(
|
|
46
|
-
&mut self,
|
|
47
|
-
kbid: &KbId,
|
|
48
|
-
terms: &[(Term, FieldTf)],
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
pub fn remove_section(&mut self, kbid: &KbId);
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
`add_terms` inserts or updates per-field TF
|
|
56
|
-
entries for a section. Each `FieldTf` value
|
|
57
|
-
contains the heading, body, and code term
|
|
58
|
-
frequencies computed during per-field
|
|
59
|
-
tokenization. `remove_section` removes all
|
|
60
|
-
postings for a given kb-id across all terms.
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# fs-database/indexes -- B+ Tree Index Subsystem
|
|
2
|
-
|
|
3
|
-
*Binary index files in `indexes/`. Optimized for read
|
|
4
|
-
speed -- O(log n) term lookups.*
|
|
5
|
-
|
|
6
|
-
## Source
|
|
7
|
-
|
|
8
|
-
`engine/crates/fs-database/src/index/`
|
|
9
|
-
|
|
10
|
-
## Modules
|
|
11
|
-
|
|
12
|
-
- **[btree](btree.md)** -- Generic `BPlusTree<K, V>`
|
|
13
|
-
implementation. On-disk ordered key-value storage
|
|
14
|
-
with configurable page size.
|
|
15
|
-
- **[inverted](inverted.md)** -- `InvertedIndex`.
|
|
16
|
-
Maps normalized terms to posting lists (kb-id +
|
|
17
|
-
weight). Stored in `indexes/terms.idx`.
|
|
18
|
-
- **[positional](positional.md)** -- `PositionalIndex`.
|
|
19
|
-
Maps (term, kb-id) pairs to position lists for
|
|
20
|
-
phrase query support. Stored in
|
|
21
|
-
`indexes/positions.idx`.
|
|
22
|
-
- **[corpus](corpus.md)** -- `CorpusStats`. Corpus-wide
|
|
23
|
-
term statistics for IDF computation. Stored in
|
|
24
|
-
`indexes/corpus.dat`.
|
|
25
|
-
- **[references](references.md)** -- `ReferenceIndex`.
|
|
26
|
-
Bidirectional graph of content marker references
|
|
27
|
-
between sections. Stored in `indexes/references.idx`.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
### Reference Graph Index (`references.idx`)
|
|
32
|
-
|
|
33
|
-
Bidirectional index mapping content marker
|
|
34
|
-
references between sections. Built at section
|
|
35
|
-
insertion time by parsing content markers via
|
|
36
|
-
`extract_content_markers()` from `kbdb-shared`.
|
|
37
|
-
|
|
38
|
-
**Index entry format:**
|
|
39
|
-
|
|
40
|
-
| Field | Type | Description |
|
|
41
|
-
|-------------------|--------|-----------------------|
|
|
42
|
-
| `source_kbid` | KbId | Section with marker |
|
|
43
|
-
| `target_id` | String | Referenced kbid/docid |
|
|
44
|
-
| `marker_type` | u8 | ContentMarkerType enum value |
|
|
45
|
-
| `context_snippet` | String | ~150 chars around marker |
|
|
46
|
-
| `direction` | u8 | 0 = forward, 1 = back |
|
|
47
|
-
|
|
48
|
-
**Operations:**
|
|
49
|
-
|
|
50
|
-
- **Build**: On section add/update, extract markers,
|
|
51
|
-
generate context snippets (~150 chars of the
|
|
52
|
-
surrounding sentence/paragraph), write one forward
|
|
53
|
-
entry per marker plus one back-reference entry at
|
|
54
|
-
each target.
|
|
55
|
-
- **Remove**: On section delete, remove all forward
|
|
56
|
-
entries where `source_kbid` matches and all back
|
|
57
|
-
entries where `target_id` matches the deleted
|
|
58
|
-
section's kbid.
|
|
59
|
-
- **Lookup**: Given a kbid, return all forward
|
|
60
|
-
references (markers in this section's content) and
|
|
61
|
-
all back-references (markers in other sections
|
|
62
|
-
pointing to this section). O(1) via B+ tree index.
|
|
63
|
-
- **Rebuild**: Regenerated from section content
|
|
64
|
-
alongside other index files during `rebuild`.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# indexes::positional -- Positional Index
|
|
2
|
-
|
|
3
|
-
*Maps (term, kb-id) pairs to position lists for
|
|
4
|
-
phrase query support. Stored in
|
|
5
|
-
`indexes/positions.idx`.*
|
|
6
|
-
|
|
7
|
-
## Source
|
|
8
|
-
|
|
9
|
-
`engine/crates/fs-database/src/index/positional.rs`
|
|
10
|
-
|
|
11
|
-
## Type Definition
|
|
12
|
-
|
|
13
|
-
```rust
|
|
14
|
-
pub struct PositionalIndex {
|
|
15
|
-
tree: BPlusTree<(Term, KbId), Vec<u32>>,
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Methods
|
|
20
|
-
|
|
21
|
-
```rust
|
|
22
|
-
impl PositionalIndex {
|
|
23
|
-
pub fn positions(
|
|
24
|
-
&self, term: &Term, kbid: &KbId,
|
|
25
|
-
) -> Option<&[u32]>;
|
|
26
|
-
|
|
27
|
-
pub fn add_positions(
|
|
28
|
-
&mut self,
|
|
29
|
-
kbid: &KbId,
|
|
30
|
-
term_positions: &[(Term, Vec<u32>)],
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
pub fn remove_section(&mut self, kbid: &KbId);
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Position values are zero-based token offsets. Used
|
|
38
|
-
for phrase matching (verifying adjacent term
|
|
39
|
-
positions) and proximity scoring.
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# indexes::vectors -- Vector Embedding Index
|
|
2
|
-
|
|
3
|
-
*Maps kb-ids to embedding vectors for similarity search. Stored in
|
|
4
|
-
`indexes/vectors.idx` with metadata in `indexes/vectors-meta.toml`.*
|
|
5
|
-
|
|
6
|
-
## Source
|
|
7
|
-
|
|
8
|
-
`engine/crates/fs-database/src/index/vectors.rs`
|
|
9
|
-
|
|
10
|
-
## Implementation Boundary
|
|
11
|
-
|
|
12
|
-
Unlike other index files which are written by the Rust/WASM engine,
|
|
13
|
-
the vector index is written and read by TypeScript. The Rust module
|
|
14
|
-
defines the binary format specification and provides read/write
|
|
15
|
-
utilities for potential future use, but the primary producer is the
|
|
16
|
-
TypeScript embedding module. This separation exists because embedding
|
|
17
|
-
computation requires network I/O to call external API providers, and
|
|
18
|
-
the WASM target (`wasm32-unknown-unknown`) has no network access.
|
|
19
|
-
ONNX models are also too large to fit in WASM linear memory.
|
|
20
|
-
|
|
21
|
-
## Binary Format: vectors.idx
|
|
22
|
-
|
|
23
|
-
Fixed-width binary file. A 32-byte header is followed by N records,
|
|
24
|
-
one per section. Record size is fixed for a given file because all
|
|
25
|
-
embeddings share the same `dimensions` value from the header.
|
|
26
|
-
|
|
27
|
-
**Header (32 bytes):**
|
|
28
|
-
|
|
29
|
-
| Offset | Size | Type | Field |
|
|
30
|
-
|--------|------|-----------|--------------------------------|
|
|
31
|
-
| 0 | 4 | u32 LE | magic (`0x56454358` = "VECX") |
|
|
32
|
-
| 4 | 4 | u32 LE | version (1) |
|
|
33
|
-
| 8 | 4 | u32 LE | dimensions |
|
|
34
|
-
| 12 | 4 | u32 LE | record_count |
|
|
35
|
-
| 16 | 16 | [u8; 16] | reserved (zero-filled) |
|
|
36
|
-
|
|
37
|
-
**Record (variable, but fixed per file):**
|
|
38
|
-
|
|
39
|
-
| Offset | Size | Type | Field |
|
|
40
|
-
|--------|---------------|----------------|---------------------------|
|
|
41
|
-
| 0 | 64 | [u8; 64] | kbid (UTF-8, null-padded) |
|
|
42
|
-
| 64 | dims × 4 | [f32 LE; dims] | embedding vector |
|
|
43
|
-
|
|
44
|
-
Record size = 64 + (dimensions × 4). For 384-dimensional embeddings,
|
|
45
|
-
each record is 1,600 bytes.
|
|
46
|
-
|
|
47
|
-
## Metadata: vectors-meta.toml
|
|
48
|
-
|
|
49
|
-
```toml
|
|
50
|
-
model = "all-MiniLM-L6-v2"
|
|
51
|
-
dimensions = 384
|
|
52
|
-
record_count = 1042
|
|
53
|
-
version = 1
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The metadata file is read before opening `vectors.idx`. If the
|
|
57
|
-
`model` field differs from the current embedding provider's model
|
|
58
|
-
name, the vector index is considered stale and must be rebuilt before
|
|
59
|
-
it can be used for search.
|
|
60
|
-
|
|
61
|
-
## Type Definitions
|
|
62
|
-
|
|
63
|
-
```rust
|
|
64
|
-
pub struct VectorIndex {
|
|
65
|
-
dimensions: u32,
|
|
66
|
-
entries: Vec<VectorEntry>,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
pub struct VectorEntry {
|
|
70
|
-
pub kbid: KbId,
|
|
71
|
-
pub vector: Vec<f32>,
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
`VectorIndex` owns all loaded entries in memory. `dimensions` is
|
|
76
|
-
stored separately from the per-entry vector length so that the header
|
|
77
|
-
value can be validated against each record during a read. Both structs
|
|
78
|
-
are not exposed at the WASM boundary -- the index is consumed
|
|
79
|
-
internally by `search` and `lookup`.
|
|
80
|
-
|
|
81
|
-
## Methods
|
|
82
|
-
|
|
83
|
-
```rust
|
|
84
|
-
impl VectorIndex {
|
|
85
|
-
pub fn read_from(path: &str) -> Result<Self, FsError>;
|
|
86
|
-
pub fn write_to(&self, path: &str) -> Result<(), FsError>;
|
|
87
|
-
pub fn lookup(&self, kbid: &KbId) -> Option<&[f32]>;
|
|
88
|
-
pub fn search(
|
|
89
|
-
&self,
|
|
90
|
-
query_vector: &[f32],
|
|
91
|
-
limit: usize,
|
|
92
|
-
) -> Vec<(KbId, f32)>;
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
`read_from` parses the binary file header, validates the magic bytes
|
|
97
|
-
and version, then reads all records into memory. `write_to` serializes
|
|
98
|
-
the header followed by each entry in record order. `lookup` returns
|
|
99
|
-
the stored embedding slice for a single kb-id, or `None` if the kb-id
|
|
100
|
-
is not present. `search` computes cosine similarity between
|
|
101
|
-
`query_vector` and every stored entry, then returns the top `limit`
|
|
102
|
-
results as `(KbId, score)` pairs sorted by descending similarity.
|
|
103
|
-
|
|
104
|
-
## Rebuild Semantics
|
|
105
|
-
|
|
106
|
-
`vectors.idx` is derived data and can be regenerated from section
|
|
107
|
-
content at any time. During rebuild, the TypeScript layer iterates all
|
|
108
|
-
sections, computes embeddings via the configured `EmbeddingProvider`,
|
|
109
|
-
and writes the binary file. If no embedding provider is configured,
|
|
110
|
-
`vectors.idx` is not generated and similarity search is unavailable.
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
# fs-database -- Filesystem Storage Engine
|
|
2
|
-
|
|
3
|
-
*Rust crate that manages the `.kbdb` directory:
|
|
4
|
-
section CRUD, document manifests, B+ tree indexes,
|
|
5
|
-
and content-addressable storage. Compiles to
|
|
6
|
-
`fs-database.wasm`.*
|
|
7
|
-
|
|
8
|
-
## Crate
|
|
9
|
-
|
|
10
|
-
| Field | Value |
|
|
11
|
-
|-------------|------------------------------------|
|
|
12
|
-
| Name | `kbdb-fs-database` |
|
|
13
|
-
| Path | `engine/crates/fs-database/` |
|
|
14
|
-
| Crate type | `cdylib` (WASM) + `rlib` (tests) |
|
|
15
|
-
| WASM output | `dist/wasm/fs-database.wasm` |
|
|
16
|
-
| Depends on | `kbdb-shared` |
|
|
17
|
-
|
|
18
|
-
`kbdb-fs-database` is a **standalone** WASM module. It
|
|
19
|
-
does not import `kbdb-query-parser` or `kbdb-worker` at
|
|
20
|
-
the WASM level. `kb-worker.wasm` imports this module's
|
|
21
|
-
exports and orchestrates it alongside
|
|
22
|
-
`query-parser.wasm`.
|
|
23
|
-
|
|
24
|
-
See [Database](../../../goals/database.md) for the
|
|
25
|
-
full behavioral specification.
|
|
26
|
-
|
|
27
|
-
## Workspace Position
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
engine/
|
|
31
|
-
├── Cargo.toml # workspace root
|
|
32
|
-
└── crates/
|
|
33
|
-
├── shared/ # kbdb-shared
|
|
34
|
-
├── fs-database/ # this crate
|
|
35
|
-
├── query-parser/ # kbdb-query-parser
|
|
36
|
-
└── kb-worker/ # kbdb-worker
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Directory Layout
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
engine/crates/fs-database/
|
|
43
|
-
├── Cargo.toml
|
|
44
|
-
└── src/
|
|
45
|
-
├── lib.rs # crate root, WASM exports
|
|
46
|
-
├── io.rs # host import wrappers
|
|
47
|
-
├── mem.rs # shared-memory helpers
|
|
48
|
-
├── catalog.rs # catalog.toml read/write
|
|
49
|
-
├── section/
|
|
50
|
-
│ ├── mod.rs # section CRUD facade
|
|
51
|
-
│ ├── hash.rs # SHA-256 hashing, kb-id
|
|
52
|
-
│ ├── parse.rs # TOML frontmatter parser
|
|
53
|
-
│ └── shard.rs # hash-sharded path logic
|
|
54
|
-
├── document.rs # document manifest CRUD
|
|
55
|
-
├── index/
|
|
56
|
-
│ ├── mod.rs # index facade
|
|
57
|
-
│ ├── btree.rs # B+ tree implementation
|
|
58
|
-
│ ├── inverted.rs # term → kb-id mappings
|
|
59
|
-
│ ├── positional.rs # term position data
|
|
60
|
-
│ └── corpus.rs # corpus-wide statistics
|
|
61
|
-
├── query_exec.rs # execute query plans
|
|
62
|
-
├── integrity.rs # checksum verify, GC
|
|
63
|
-
└── atomic.rs # temp-file + rename
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Modules
|
|
67
|
-
|
|
68
|
-
### [types/](types/module.md) -- Structs
|
|
69
|
-
|
|
70
|
-
- **[catalog](types/catalog.md)** -- `Catalog` struct.
|
|
71
|
-
Database table of contents.
|
|
72
|
-
- **[section](types/section.md)** -- `SectionHeader`,
|
|
73
|
-
frontmatter parse/serialize, shard path resolution.
|
|
74
|
-
|
|
75
|
-
### [functions/](functions/module.md) -- Operations
|
|
76
|
-
|
|
77
|
-
- **[io](functions/io.md)** -- Host import wrappers,
|
|
78
|
-
return conventions, shared memory protocol.
|
|
79
|
-
- **[section](functions/section.md)** -- Section CRUD
|
|
80
|
-
(`read`, `add`, `update`, `remove`), content
|
|
81
|
-
hashing, atomic writes.
|
|
82
|
-
- **[document](functions/document.md)** -- Document
|
|
83
|
-
manifest CRUD, `update_section_ref`.
|
|
84
|
-
- **[query-exec](functions/query-exec.md)** -- Execute
|
|
85
|
-
query plans against indexes, return raw matches.
|
|
86
|
-
- **[integrity](functions/integrity.md)** -- Integrity
|
|
87
|
-
checks, garbage collection, index rebuild.
|
|
88
|
-
|
|
89
|
-
### [indexes/](indexes/module.md) -- Index Subsystem
|
|
90
|
-
|
|
91
|
-
- **[btree](indexes/btree.md)** -- Generic B+ tree
|
|
92
|
-
for binary index files.
|
|
93
|
-
- **[inverted](indexes/inverted.md)** -- Term →
|
|
94
|
-
posting list mappings (`terms.idx`).
|
|
95
|
-
- **[positional](indexes/positional.md)** -- Term
|
|
96
|
-
position data for phrase queries
|
|
97
|
-
(`positions.idx`).
|
|
98
|
-
- **[corpus](indexes/corpus.md)** -- Corpus-wide
|
|
99
|
-
statistics for IDF (`corpus.dat`).
|
|
100
|
-
|
|
101
|
-
## WASM Exports
|
|
102
|
-
|
|
103
|
-
| Export | Description |
|
|
104
|
-
|------------------------|----------------------------|
|
|
105
|
-
| `db_init` | Open database, read catalog |
|
|
106
|
-
| `db_read_section` | Read section by kb-id |
|
|
107
|
-
| `db_read_sections` | Read multiple sections |
|
|
108
|
-
| `db_add_section` | Create section file |
|
|
109
|
-
| `db_update_section` | Replace section content |
|
|
110
|
-
| `db_remove_section` | Delete section file |
|
|
111
|
-
| `db_read_document` | Read document manifest |
|
|
112
|
-
| `db_write_document` | Create/update document |
|
|
113
|
-
| `db_remove_document` | Delete document manifest |
|
|
114
|
-
| `db_update_section_ref`| Replace kb-id in manifests |
|
|
115
|
-
| `db_index_add` | Add terms to inverted index |
|
|
116
|
-
| `db_index_remove` | Remove section from indexes |
|
|
117
|
-
| `db_index_rebuild` | Full index rebuild |
|
|
118
|
-
| `db_execute_plan` | Run query plan against indexes |
|
|
119
|
-
| `db_corpus_stats` | Return corpus statistics |
|
|
120
|
-
| `db_status` | Return database metadata |
|
|
121
|
-
| `db_check_integrity` | Run integrity checks |
|
|
122
|
-
| `db_garbage_collect` | Remove orphaned sections |
|
|
123
|
-
| `db_export` | Export database snapshot |
|
|
124
|
-
| `alloc` / `free` | Memory management (from `kbdb-shared`) |
|
|
125
|
-
|
|
126
|
-
## Dependencies
|
|
127
|
-
|
|
128
|
-
```toml
|
|
129
|
-
[dependencies]
|
|
130
|
-
kbdb-shared = { path = "../shared" }
|
|
131
|
-
sha2 = "0.10"
|
|
132
|
-
data-encoding = "2"
|
|
133
|
-
toml = { version = "0.8", default-features = false }
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Build
|
|
137
|
-
|
|
138
|
-
```sh
|
|
139
|
-
cd engine
|
|
140
|
-
wasm-pack build crates/fs-database \
|
|
141
|
-
--target no-modules \
|
|
142
|
-
--out-dir ../../../dist/wasm/fs-database
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Testing
|
|
146
|
-
|
|
147
|
-
```sh
|
|
148
|
-
cd engine && cargo test -p kbdb-fs-database
|
|
149
|
-
cd engine && wasm-pack test --node crates/fs-database
|
|
150
|
-
```
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# types::catalog -- Database Catalog
|
|
2
|
-
|
|
3
|
-
*The `Catalog` struct representing `catalog.toml` --
|
|
4
|
-
the database's table of contents.*
|
|
5
|
-
|
|
6
|
-
## Source
|
|
7
|
-
|
|
8
|
-
`engine/crates/fs-database/src/catalog.rs`
|
|
9
|
-
|
|
10
|
-
## Type Definition
|
|
11
|
-
|
|
12
|
-
```rust
|
|
13
|
-
pub struct Catalog {
|
|
14
|
-
pub version: u32,
|
|
15
|
-
pub created_at: String,
|
|
16
|
-
pub last_modified: String,
|
|
17
|
-
pub section_count: u32,
|
|
18
|
-
pub document_count: u32,
|
|
19
|
-
pub checksum: String,
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
| Field | Description |
|
|
24
|
-
|------------------|---------------------------------|
|
|
25
|
-
| `version` | Database format version |
|
|
26
|
-
| `created_at` | ISO 8601 creation timestamp |
|
|
27
|
-
| `last_modified` | ISO 8601 last write timestamp |
|
|
28
|
-
| `section_count` | Total sections in the database |
|
|
29
|
-
| `document_count` | Total documents in the database |
|
|
30
|
-
| `checksum` | SHA-256 integrity checksum |
|
|
31
|
-
|
|
32
|
-
The catalog is the first file `fs-database.wasm`
|
|
33
|
-
reads when opening a database. It is updated after
|
|
34
|
-
every write operation using atomic temp-file + rename.
|
|
35
|
-
|
|
36
|
-
## Functions
|
|
37
|
-
|
|
38
|
-
```rust
|
|
39
|
-
pub fn read_catalog() -> Result<Catalog, FsError>;
|
|
40
|
-
|
|
41
|
-
pub fn write_catalog(cat: &Catalog)
|
|
42
|
-
-> Result<(), FsError>;
|
|
43
|
-
|
|
44
|
-
pub fn increment_sections(delta: i32)
|
|
45
|
-
-> Result<Catalog, FsError>;
|
|
46
|
-
|
|
47
|
-
pub fn increment_documents(delta: i32)
|
|
48
|
-
-> Result<Catalog, FsError>;
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
`increment_sections` and `increment_documents` read
|
|
52
|
-
the catalog, adjust the count, update
|
|
53
|
-
`last_modified`, and write back atomically.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# fs-database/types -- Type Definitions
|
|
2
|
-
|
|
3
|
-
*Structs defined in the fs-database crate for catalog
|
|
4
|
-
metadata and section file parsing.*
|
|
5
|
-
|
|
6
|
-
## Modules
|
|
7
|
-
|
|
8
|
-
- **[catalog](catalog.md)** -- `Catalog` struct.
|
|
9
|
-
Database table of contents from `catalog.toml`.
|
|
10
|
-
- **[section](section.md)** -- `SectionHeader` struct
|
|
11
|
-
and `IntegrityReport`. TOML frontmatter
|
|
12
|
-
parse/serialize, hash-sharded path resolution.
|