manager

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: EUPL-1.2 Imports: 25 Imported by: 0

Documentation

Overview

Package manager coordinates the various boxes and indexes of a Zettelstore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(u *url.URL, authManager auth.BaseManager, cdata *ConnectData) (box.ManagedBox, error)

Connect returns a handle to the specified box.

func NewZidMapper added in v0.18.0

func NewZidMapper(fetcher zidfetcher) *zidMapper

NewZidMapper creates a new ZipMapper.

func Register

func Register(scheme string, create createFunc)

Register the encoder for later retrieval.

Types

type ConnectData

type ConnectData struct {
	Number   int // number of the box, starting with 1.
	Config   config.Config
	Enricher box.Enricher
	Notify   chan<- box.UpdateInfo
	Mapper   Mapper
}

ConnectData contains all administration related values.

type ErrInvalidScheme

type ErrInvalidScheme struct{ Scheme string }

ErrInvalidScheme is returned if there is no box with the given scheme.

func (*ErrInvalidScheme) Error

func (err *ErrInvalidScheme) Error() string

type Manager

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

Manager is a coordinating box.

func New

func New(boxURIs []*url.URL, authManager auth.BaseManager, rtConfig config.Config) (*Manager, error)

New creates a new managing box.

func (*Manager) AllowRenameZettel

func (mgr *Manager) AllowRenameZettel(ctx context.Context, zid id.Zid) bool

AllowRenameZettel returns true, if box will not disallow renaming the zettel.

func (*Manager) CanCreateZettel

func (mgr *Manager) CanCreateZettel(ctx context.Context) bool

CanCreateZettel returns true, if box could possibly create a new zettel.

func (*Manager) CanDeleteZettel

func (mgr *Manager) CanDeleteZettel(ctx context.Context, zid id.Zid) bool

CanDeleteZettel returns true, if box could possibly delete the given zettel.

func (*Manager) CanUpdateZettel

func (mgr *Manager) CanUpdateZettel(ctx context.Context, zettel zettel.Zettel) bool

CanUpdateZettel returns true, if box could possibly update the given zettel.

func (*Manager) CreateZettel

func (mgr *Manager) CreateZettel(ctx context.Context, zettel zettel.Zettel) (id.Zid, error)

CreateZettel creates a new zettel.

func (*Manager) DeleteZettel

func (mgr *Manager) DeleteZettel(ctx context.Context, zid id.Zid) error

DeleteZettel removes the zettel from the box.

func (*Manager) Dump

func (mgr *Manager) Dump(w io.Writer)

Dump internal data structures to a Writer.

func (*Manager) Enrich

func (mgr *Manager) Enrich(ctx context.Context, m *meta.Meta, boxNumber int)

Enrich computes additional properties and updates the given metadata.

func (*Manager) FetchZids

func (mgr *Manager) FetchZids(ctx context.Context) (*id.Set, error)

FetchZids returns the set of all zettel identifer managed by the box.

func (*Manager) GetAllZettel

func (mgr *Manager) GetAllZettel(ctx context.Context, zid id.Zid) ([]zettel.Zettel, error)

GetAllZettel retrieves a specific zettel from all managed boxes.

func (*Manager) GetMeta

func (mgr *Manager) GetMeta(ctx context.Context, zid id.Zid) (*meta.Meta, error)

func (*Manager) GetZettel

func (mgr *Manager) GetZettel(ctx context.Context, zid id.Zid) (zettel.Zettel, error)

GetZettel retrieves a specific zettel.

func (*Manager) HasZettel added in v0.13.0

func (mgr *Manager) HasZettel(ctx context.Context, zid id.Zid) bool

func (*Manager) Location

func (mgr *Manager) Location() string

Location returns some information where the box is located.

func (*Manager) ReIndex added in v0.15.0

func (mgr *Manager) ReIndex(ctx context.Context, zid id.Zid) error

ReIndex data of the given zettel.

func (*Manager) ReadStats

func (mgr *Manager) ReadStats(st *box.Stats)

ReadStats populates st with box statistics.

func (*Manager) Refresh added in v0.2.1

func (mgr *Manager) Refresh(ctx context.Context) error

Refresh internal box data.

func (*Manager) RegisterObserver

func (mgr *Manager) RegisterObserver(f box.UpdateFunc)

RegisterObserver registers an observer that will be notified if a zettel was found to be changed.

func (*Manager) RenameZettel

func (mgr *Manager) RenameZettel(ctx context.Context, curZid, newZid id.Zid) error

RenameZettel changes the current zid to a new zid.

func (*Manager) SearchContains

func (mgr *Manager) SearchContains(s string) *id.Set

SearchContains returns all zettel that contains the given string. The string must be normalized through Unicode NKFD, trimmed and not empty.

func (*Manager) SearchEqual

func (mgr *Manager) SearchEqual(word string) *id.Set

SearchEqual returns all zettel that contains the given exact word. The word must be normalized through Unicode NKFD, trimmed and not empty.

func (*Manager) SearchPrefix

func (mgr *Manager) SearchPrefix(prefix string) *id.Set

SearchPrefix returns all zettel that have a word with the given prefix. The prefix must be normalized through Unicode NKFD, trimmed and not empty.

func (*Manager) SearchSuffix

func (mgr *Manager) SearchSuffix(suffix string) *id.Set

SearchSuffix returns all zettel that have a word with the given suffix. The suffix must be normalized through Unicode NKFD, trimmed and not empty.

func (*Manager) SelectMeta

func (mgr *Manager) SelectMeta(ctx context.Context, metaSeq []*meta.Meta, q *query.Query) ([]*meta.Meta, error)

SelectMeta returns all zettel meta data that match the selection criteria. The result is ordered by descending zettel id.

func (*Manager) Start

func (mgr *Manager) Start(ctx context.Context) error

Start the box. Now all other functions of the box are allowed. Starting an already started box is not allowed.

func (*Manager) State added in v0.11.0

func (mgr *Manager) State() box.StartState

func (*Manager) Stop

func (mgr *Manager) Stop(ctx context.Context)

Stop the started box. Now only the Start() function is allowed.

func (*Manager) UpdateZettel

func (mgr *Manager) UpdateZettel(ctx context.Context, zettel zettel.Zettel) error

UpdateZettel updates an existing zettel.

type Mapper added in v0.18.0

type Mapper interface {
	Warnings(context.Context) (*id.Set, error) // Fetch problematic zettel identifier

	OldToNewMapping(ctx context.Context) (map[id.Zid]id.ZidN, error)
}

Mapper allows to inspect the mapping between old-style and new-style zettel identifier.

Directories

Path Synopsis
Package mapstore stored the index in main memory via a Go map.
Package mapstore stored the index in main memory via a Go map.
Package store contains general index data for storing a zettel index.
Package store contains general index data for storing a zettel index.

Jump to

Keyboard shortcuts

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