Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeduplicateFrontmatter ¶
DeduplicateFrontmatter removes duplicate keys from YAML frontmatter, keeping the last value for each key.
Types ¶
type ScanResult ¶
type ScanResult struct {
Changed []lib.Task // tasks whose content changed (new or modified)
Deleted []lib.TaskIdentifier // task identifiers that were previously known but are now gone
}
ScanResult holds the outcome of a single vault scan cycle.
type VaultScanner ¶
type VaultScanner interface {
// Run starts the polling loop. Blocks until ctx is cancelled.
// Results are sent to the provided channel; the caller owns the channel.
Run(ctx context.Context, results chan<- ScanResult) error
// RunCycle executes a single scan cycle (git pull + file scan + optional commit/push).
// Exported for use in scanner_test package; prefer Run() in production.
RunCycle(ctx context.Context, results chan<- ScanResult)
// Resolve returns the vault-relative path of the task file carrying id, from the
// identifier→path index the last completed scan cycle — or, in trigger-only mode,
// the boot build — published, including entries recorded since that rebuild.
// It returns ("", false, nil) when the index does not hold id — an unknown
// identifier is not an error — and ("", false, err) naming both paths when two
// files carry id. The index is empty until the first cycle completes.
Resolve(ctx context.Context, id lib.TaskIdentifier) (string, bool, error)
// Record tells the resolver that relPath is the vault-relative path of the task
// file carrying id, so a later Resolve(id) hits instead of missing. The caller
// must have just established that fact — by writing that file or by a walk that
// found exactly one file carrying id. It returns nothing: recording is a cache
// fill, and a failure to record only costs a later walk. An empty id or empty
// relPath is ignored. A resolver that already knows of two or more paths for id
// keeps them, so a known duplicate is never hidden.
Record(ctx context.Context, id lib.TaskIdentifier, relPath string)
}
func NewGitRestVaultScanner ¶
func NewGitRestVaultScanner( gitClient gitclient.GitClient, taskDir string, pollInterval time.Duration, trigger <-chan struct{}, m metrics.Metrics, autoInject bool, ) VaultScanner
NewGitRestVaultScanner creates a VaultScanner that reads and writes vault files via the gitclient.GitClient interface methods (ListFiles, ReadFile, WriteFile). Use this constructor when git-rest HTTP mode is enabled.
Click to show internal directories.
Click to hide internal directories.