directory

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package directory manages the directory part of a file store.

Package directory manages the directory part of a file store.

Package directory manages the directory part of a file store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID          domain.ZettelID
	MetaSpec    MetaSpec // location of meta information
	MetaPath    string   // file path of meta information
	ContentPath string   // file path of zettel content
	ContentExt  string   // (normalized) file extension of zettel content
	Duplicates  bool     // multiple content files
}

Entry stores everything for a directory entry.

type MetaSpec

type MetaSpec int

MetaSpec defines all possibilities where meta data can be stored.

const (
	MetaSpecUnknown MetaSpec = iota
	MetaSpecNone             // no meta information
	MetaSpecFile             // meta information is in meta file
	MetaSpecHeader           // meta information is in header
)

Constants for MetaSpec

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service specifies a directory service.

func NewService

func NewService(directoryPath string, reloadTime time.Duration) *Service

NewService creates a new directory service.

func (*Service) DeleteEntry

func (srv *Service) DeleteEntry(id domain.ZettelID)

DeleteEntry removes a zettel ID from the directory of entries.

func (*Service) GetEntries

func (srv *Service) GetEntries() []Entry

GetEntries returns an unsorted list of all current directory entries.

func (*Service) GetEntry

func (srv *Service) GetEntry(id domain.ZettelID) Entry

GetEntry returns the entry with the specified zettel ID. If there is no such zettel ID, an empty entry is returned.

func (*Service) GetNew

func (srv *Service) GetNew() Entry

GetNew returns an entry with a new zettel ID.

func (*Service) RenameEntry

func (srv *Service) RenameEntry(curEntry, newEntry *Entry) error

RenameEntry notifies the directory of an renamed entry.

func (*Service) Start

func (srv *Service) Start()

Start makes the directory service operational.

func (*Service) Stop

func (srv *Service) Stop()

Stop stops the directory service.

func (*Service) Subscribe

func (srv *Service) Subscribe(changeFunc func(domain.ZettelID))

Subscribe to invalidation events.

func (*Service) UpdateEntry

func (srv *Service) UpdateEntry(entry *Entry)

UpdateEntry notifies the directory of an updated entry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL