Documentation
¶
Overview ¶
Package gitlocal implements the Backend interface using the local filesystem with a Git repository for history. Each write operation produces one commit.
Index ¶
- func AcquireGitLock(configDir string) error
- func ReleaseGitLock(configDir string)
- type Backend
- func (b *Backend) AddLink(fromID, toID, annotation, linkType, linkStatus string) error
- func (b *Backend) AddLinks(fromID string, targets []backend.LinkTarget) error
- func (b *Backend) BulkUpdateLinks(fromID string, updates []backend.LinkUpdate) error
- func (b *Backend) BulkWrite(notes []*note.Note) error
- func (b *Backend) Delete(id string) error
- func (b *Backend) List() ([]*note.Note, error)
- func (b *Backend) Promote(id string, to note.Status) error
- func (b *Backend) Read(id string) (*note.Note, error)
- func (b *Backend) RemoveLink(fromID, toID string) error
- func (b *Backend) RemoveLinkByType(fromID, toID, linkType string) error
- func (b *Backend) Update(n *note.Note) error
- func (b *Backend) UpdateLink(fromID, toID string, annotation, linkType, linkStatus *string) error
- func (b *Backend) Write(n *note.Note) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquireGitLock ¶ added in v0.123.1
acquireGitLock spins until it wins an O_EXCL lock file, stealing stale locks from dead processes. Holds the lock for the duration of the git operation. AcquireGitLock is the exported form for use in tests.
func ReleaseGitLock ¶ added in v0.123.1
func ReleaseGitLock(configDir string)
ReleaseGitLock is the exported form for use in tests.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend stores notes as Markdown files in a Git-backed directory. mu serialises add+commit pairs so concurrent goroutines in the same process do not interleave staging. Cross-process isolation is handled by the commit queue.
func New ¶
New returns a Backend rooted at dir, using the default nn config directory for the commit queue.
func NewWithConfigDir ¶ added in v0.123.0
NewWithConfigDir returns a Backend rooted at dir using configDir for the commit queue. Used in tests to isolate queue state.
func (*Backend) AddLinks ¶
func (b *Backend) AddLinks(fromID string, targets []backend.LinkTarget) error
AddLinks adds multiple annotated links from fromID in a single git commit.
func (*Backend) BulkUpdateLinks ¶
func (b *Backend) BulkUpdateLinks(fromID string, updates []backend.LinkUpdate) error
BulkUpdateLinks applies multiple link updates to fromID in a single git commit.
func (*Backend) BulkWrite ¶ added in v0.14.0
BulkWrite writes all notes and commits in a single commit.
func (*Backend) RemoveLink ¶
RemoveLink removes the link from fromID to toID and commits.
func (*Backend) RemoveLinkByType ¶ added in v0.35.1
RemoveLinkByType removes only edges from fromID to toID with the given type.
func (*Backend) UpdateLink ¶
UpdateLink modifies the annotation, type, and/or status of an existing link without removing it. nil pointer arguments mean "leave unchanged".