filesystem

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReservedDirectoryNames = []string{config.FilesDirectoryName, config.MetaDataFolderName}
)

Functions

This section is empty.

Types

type File

type File struct {
	*content.ContentProvider
	// contains filtered or unexported fields
}

func (*File) Id

func (file *File) Id() string

func (*File) Name

func (file *File) Name() string

func (*File) Parent

func (file *File) Parent() route.Route

func (*File) Route

func (file *File) Route() route.Route

func (*File) String

func (file *File) String() string

type Index

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

func (*Index) Add

func (index *Index) Add(item dataaccess.Item) (bool, error)

func (*Index) Copy

func (index *Index) Copy() *Index

Copy creates a copy of the current index

func (*Index) GetAllChildren

func (index *Index) GetAllChildren(route route.Route, limitDepth bool, maxDepth int) []dataaccess.Item

Get all children that match the given expression

func (*Index) GetAllItems

func (index *Index) GetAllItems() []dataaccess.Item

GetAllItems returns a flat list of all items in the index.

func (*Index) GetDirectChildren

func (index *Index) GetDirectChildren(route route.Route) []dataaccess.Item

func (*Index) GetLeafes

func (index *Index) GetLeafes(route route.Route) []dataaccess.Item

func (*Index) GetParent

func (index *Index) GetParent(childRoute route.Route) dataaccess.Item

GetParent returns the parent of the specified route if there is one. Otherwise GetParent will return nil.

func (*Index) GetSubIndex

func (index *Index) GetSubIndex(subIndexStartRoute route.Route, limitDepth bool, maxDepth int) *Index

func (*Index) IsMatch

func (index *Index) IsMatch(r route.Route) (item dataaccess.Item, isMatch bool)

IsMatch checks if the specified route can be found in the index.

func (*Index) Remove

func (index *Index) Remove(itemRoute route.Route)

Remove removes the item with the supplied route from the index.

func (*Index) Size

func (index *Index) Size() int

Size returns the number if items in the index.

func (*Index) String

func (index *Index) String() string

type Item

type Item struct {
	*content.ContentProvider
	// contains filtered or unexported fields
}

An Item represents a single document in a repository.

func (*Item) CanHaveChildren

func (item *Item) CanHaveChildren() bool

Gets a flag inidicating whether this item can have children or not.

func (*Item) Directory

func (item *Item) Directory() string

func (*Item) Files

func (item *Item) Files() (files []dataaccess.File)

Get the files of this item. Returns a slice of zero or more files.

func (*Item) Id

func (item *Item) Id() string

func (*Item) Route

func (item *Item) Route() route.Route

Get the route of this item.

func (*Item) String

func (item *Item) String() string

func (*Item) Type

func (item *Item) Type() dataaccess.ItemType

Get the type of this item (e.g. "physical", "virtual", ...)

func (*Item) WatcherPaths

func (item *Item) WatcherPaths() []watcherPather

type ItemTree

type ItemTree struct {
	tree.Tree
}

func (*ItemTree) Delete

func (itemTree *ItemTree) Delete(itemRoute route.Route) (bool, error)

func (*ItemTree) GetChildItems

func (itemTree *ItemTree) GetChildItems(route route.Route) []dataaccess.Item

func (*ItemTree) GetItem

func (itemTree *ItemTree) GetItem(route route.Route) dataaccess.Item

func (*ItemTree) Insert

func (itemTree *ItemTree) Insert(item dataaccess.Item) (bool, error)

func (*ItemTree) Root

func (itemTree *ItemTree) Root() dataaccess.Item

func (*ItemTree) Walk

func (itemTree *ItemTree) Walk(expression func(item dataaccess.Item))

Walk visits every node in the current tree. Starting with the root, every child of the root and then recurses down the children.

type Repository

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

func NewRepository

func NewRepository(logger logger.Logger, directory string, config config.Config) (*Repository, error)

func (*Repository) Item

func (repository *Repository) Item(route route.Route) dataaccess.Item

func (*Repository) Items

func (repository *Repository) Items() []dataaccess.Item

func (*Repository) Path

func (repository *Repository) Path() string

func (*Repository) Routes

func (repository *Repository) Routes() []route.Route

func (*Repository) StartWatching

func (repository *Repository) StartWatching(route route.Route)

StartWatching starts the watcher for the item with the given route.

func (*Repository) StopWatching

func (repository *Repository) StopWatching(route route.Route)

StopWatching stops the watcher for the item with the given route.

func (*Repository) Subscribe

func (repository *Repository) Subscribe(updates chan dataaccess.Update)

Subscribe registers the supplied updates channel in the repository. All updates (new, modified or deleted items) in the repository will be passed down this channel.

Jump to

Keyboard shortcuts

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