Documentation
¶
Overview ¶
Package store owns the SQLite database: connection, schema migration, project lifecycle, and a Writer that persists what indexers extract.
Index ¶
- type ProjectInfo
- type Store
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteProject(name string) error
- func (s *Store) ListProjects() ([]ProjectInfo, error)
- func (s *Store) NewWriter(project, root string) (*Writer, error)
- func (s *Store) ProjectSig(name string) (string, error)
- func (s *Store) SetProjectSig(name, sig string) error
- type Writer
- func (w *Writer) Commit(vcsRev string) error
- func (w *Writer) Edge(e index.Edge) error
- func (w *Writer) File(f index.FileRec) error
- func (w *Writer) Reference(r index.Reference) error
- func (w *Writer) Rollback() error
- func (w *Writer) Route(r index.Route) error
- func (w *Writer) Symbol(sym index.Symbol) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProjectInfo ¶
type ProjectInfo struct {
Name string
Root string
VcsRev string
IndexedAt time.Time
Symbols int
Edges int
Files int
}
ProjectInfo summarizes one indexed repo.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a handle to the codenav database.
func Open ¶
Open opens (creating if needed) the database at path and applies the schema. PRAGMAs are passed in the DSN so every connection inherits them; a single open connection keeps WAL writes simple for a CLI.
func (*Store) DeleteProject ¶
DeleteProject removes a project and all its rows (incl. FTS, which is not covered by foreign-key cascades because the FTS tables are virtual).
func (*Store) ListProjects ¶
func (s *Store) ListProjects() ([]ProjectInfo, error)
ListProjects returns all indexed projects with counts.
func (*Store) NewWriter ¶
NewWriter starts a fresh index of project at root. Any prior data for the project is removed first (M1 does full re-index).
func (*Store) ProjectSig ¶
ProjectSig returns the stored source signature for a project, or "" if the project is not indexed.
func (*Store) SetProjectSig ¶
SetProjectSig records the source signature after a successful index.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer persists one indexing run for a single project inside a transaction. References, edges and routes are buffered and resolved at Commit, once every symbol's id is known (definitions may appear after their use sites).
Writer implements index.Sink.
func (*Writer) Commit ¶
Commit resolves buffered references/edges/routes against the symbol table and finalizes the transaction.