Files
modules/indexes-search/hyper-p2p-trie-prefix/docs/architecture.md
T
2026-05-20 23:36:32 -04:00

1.0 KiB

Architecture: hyper-p2p-trie-prefix

Category: indexes-search
Protocol: trie-prefix/v1 (local-only)

Purpose

Prefix trie for autocomplete and lexicographic completion lists.

Structure

_root: TrieNode
_words: Set<lowercase word>  // fast has() / list()

Wire messages

type fields behavior
Local-only module

Insert path

Walk/create child per character → mark terminal → add to _words.

Remove path

Walk to terminal → clear terminal → walk stack backward decrementing count → delete child when count === 0 and not terminal.

prefixSearch

DFS from node at end of prefix string; collect paths where terminal.

Lifecycle

new → mutations → close (new empty root).

Composition

  • Feed from hyper-p2p-fulltext-lite token streams for suggest UI
  • No encryption or P2P; replicate word lists at app layer if needed

Limits

  • Lowercase ASCII-oriented normalization only
  • No payload values on nodes (words only)