store

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package store defines the content-hash-keyed persistent cache used by the indexer to skip re-parsing unchanged files. NewMem gives a process-local cache; Open backs the same interface with a single-file SQLite database (modernc.org/sqlite, cgo-free) so the cache survives across runs. The graph itself is always fully loaded to memory, so no relational queries are needed here — store stays a dumb KV blob cache; gob-encoding index.ParseResult is the caller's job (see internal/index.parseCached).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Path string
	Hash [32]byte // sha256 of file contents
	Blob []byte   // gob-encoded index.ParseResult
}

Entry caches the parse result of one file, keyed by its content hash.

type Store

type Store interface {
	Get(path string, hash [32]byte) (Entry, bool)
	Put(e Entry) error
	Flush() error
	Close() error
}

Store is a minimal KV cache. Get returns ok=false on miss or hash mismatch. Put may buffer writes; Flush makes any buffered writes durable. Callers that need every prior Put visible to a fresh Store handle (e.g. after process restart) must Flush (or Close, which flushes) first.

func NewMem

func NewMem() Store

NewMem returns a process-local Store.

func Open

func Open(path string) (Store, error)

Open opens (creating as needed) a SQLite-backed Store at path. It targets a single process at a time — no WAL/multi-writer tuning, unlike internal/coord's shared coordination DB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL