Documentation
¶
Index ¶
- func Create(name, dir string) error
- type Cortex
- func (c *Cortex) Add(t *trace.Trace) error
- func (c *Cortex) Archive(id string) error
- func (c *Cortex) ArchiveDir() string
- func (c *Cortex) Close() error
- func (c *Cortex) Get(id string) (*Row, error)
- func (c *Cortex) List(opts ListOptions) ([]Row, error)
- func (c *Cortex) Purge(days int) error
- func (c *Cortex) Recover(id string) error
- func (c *Cortex) Remove(id string) error
- func (c *Cortex) Search(query string, opts ListOptions) ([]Row, error)
- func (c *Cortex) Sync() (SyncResult, error)
- func (c *Cortex) TraceFile(id string, archived bool) string
- func (c *Cortex) TracesDir() string
- func (c *Cortex) Trash(id string) error
- func (c *Cortex) TrashDir() string
- func (c *Cortex) TrashFile(id string) string
- func (c *Cortex) Unarchive(id string) error
- func (c *Cortex) Update(id string) error
- type ListOptions
- type Manifest
- type Row
- type SyncResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cortex ¶
func Open ¶
Open opens an existing Cortex by directory path. It ensures required subdirectories exist and auto-purges expired trash.
func (*Cortex) ArchiveDir ¶
func (*Cortex) Purge ¶ added in v0.2.0
Purge permanently deletes traces that have been in the trash for more than days days. A days value of 0 is treated as 30.
func (*Cortex) Recover ¶ added in v0.2.0
Recover moves a trace out of the trash and back to the active traces directory.
func (*Cortex) Remove ¶
Remove permanently deletes a trace from disk and the database. Use Trash for recoverable deletion.
func (*Cortex) Sync ¶ added in v0.2.2
func (c *Cortex) Sync() (SyncResult, error)
Sync reconciles the database with the current state of the markdown files on disk. It walks traces/, archive/traces/, and trash/traces/, upserts every file it finds, and reports orphaned DB rows (not deleted — just reported).
func (*Cortex) Trash ¶ added in v0.2.0
Trash moves a trace to the trash directory for deferred deletion.
type ListOptions ¶
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
Purpose string `yaml:"purpose,omitempty"`
Owner string `yaml:"owner,omitempty"`
Created string `yaml:"created"`
Version int `yaml:"version"`
}
Manifest is the cortex.md file at the root of each Cortex.
func ReadManifest ¶ added in v0.2.2
ReadManifest parses the cortex.md manifest in the given cortex directory.
type Row ¶
type Row struct {
ID string
Title string
Type string
Author string
Tags []string
ArchivedAt string
TrashedAt string
CreatedAt string
UpdatedAt string
}
Row is a DB row joined with tags, returned by list/search operations.
type SyncResult ¶ added in v0.2.2
type SyncResult struct {
Added int // files found on disk but not in DB
Updated int // files found on disk and already in DB (re-synced)
Orphaned int // IDs in DB with no corresponding file on disk
}
SyncResult summarises what Sync found.