Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.44 KB

File metadata and controls

41 lines (30 loc) · 2.44 KB

Storage & Indexing

This document describes PlainNAS data storage layout and the search indexing design.

Disk Manager

Disk enumeration and whole-disk formatting behavior is documented in docs/disk-manager.md.

Data directory

All paths below are under the data directory ~/.plainnas/data (see constants for defaults).

Database (Pebble)

Cache (memory + Pebble)

  • Persistent cache: simple TTL wrapper backed by Pebble (shared DB). See internal/cache/pebble.go
  • Thumbnails: generated on demand and cached in Pebble using a content-derived key (prefix thumb:) composed from path, size, quality, and file metadata.

File index (custom inverted index)

  • Path/name index: ~/.plainnas/data/searchidx (append-only build, mmap read-only). See internal/search/fs_index.go
  • Fuzzy support: additional ngram dictionaries and postings for name/path (name_ngram.*, path_ngram.*) enabling ASCII 2-gram and CJK bigram fallback.
  • Filters: bitmap-style postings for ext/size/mtime (filter.*) applied after intersections; pagination only on final IDs.
  • Structure: term dictionaries (JSON), postings (*.postings.dat) + offsets (*.postings.idx). Name and path tokens stored separately.
  • Query semantics: plain text queries search basenames only. For queries containing /: if it is an absolute path and exists on disk, it is resolved via the filesystem first (file -> [file], dir -> direct children). Otherwise it falls back to the path index.
  • Principles: Pebble is source of truth; index is discardable/rebuildable; search uses mmap without locks.
  • Performance knobs: SCAN_INDEXER_WORKERS, SCAN_PIPELINE_BUFFER.