browse

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package browse lists the OKF tree by walking it on disk and annotating each file with the index metadata mnemos holds for it. The disk walk is the source of truth for what exists (so not-yet-indexed files are visible); the index supplies title/type/tags/collection and the "indexed" flag. It adds no retrieval logic of its own — it reuses the ingest scanner predicate and the storage document lister.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	URI        string   `json:"uri"`
	Indexed    bool     `json:"indexed"`
	Collection string   `json:"collection,omitempty"`
	Title      string   `json:"title,omitempty"`
	Type       string   `json:"type,omitempty"`
	Tags       []string `json:"tags,omitempty"`
	ModifiedAt string   `json:"modified_at,omitempty"`
	SizeBytes  int64    `json:"size_bytes"`
}

Entry is one file in the OKF tree with its index annotation. Collection, Title, Type, Tags, and ModifiedAt are populated only when the file is indexed.

func List

func List(ctx context.Context, db *sql.DB, treeRoot string, include, exclude, secExclude []string, o Options) ([]Entry, error)

List walks treeRoot and returns entries sorted by uri, annotated from the index. include/exclude/secExclude are the indexing globs (the same sets the ingest scanner uses); a file is listed when Options.All is set or it matches those globs. The internal .mnemos directory is always skipped.

type Options

type Options struct {
	Collection    string
	PathPrefix    string
	FileType      string
	All           bool
	IndexedOnly   bool
	UnindexedOnly bool
	Limit         int
}

Options narrows a List call. Empty string fields are ignored. All includes every file on disk (not just indexable ones); IndexedOnly / UnindexedOnly restrict to files that are / are not in the index.

type TreeNode

type TreeNode struct {
	Name     string
	IsDir    bool
	Entry    *Entry
	Children []*TreeNode
}

TreeNode is a node in the directory tree built from a flat entry list. Directory nodes have Entry == nil; file nodes carry their Entry.

func BuildTree

func BuildTree(entries []Entry) *TreeNode

BuildTree groups entries into a directory tree derived from their uri path segments. Children are ordered directories-first then by name. The returned root node represents the tree root (its Name is empty).

Jump to

Keyboard shortcuts

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