Documentation
¶
Index ¶
- Constants
- Variables
- func IsBrokerTopicNotFoundError(err error) bool
- func IsInvalidNotificationMuteRequestedError(err error) bool
- func IsInvalidPeriscopeRootPathError(err error) bool
- func IsInvalidResumeStateTransitionError(err error) bool
- func IsMissingHibernationDetacherFunctionError(err error) bool
- func IsNewItemAlreadyExtendedError(err error) bool
- func IsResumeControllerNotSetError(err error) bool
- func NewBrokerTopicNotFoundError(topic string) error
- func NewInvalidNotificationMuteRequestedError(notification string) error
- func NewInvalidPeriscopeRootPathError(tree, current string) error
- func NewInvalidResumeStateTransitionError(state string) error
- func NewItemAlreadyExtendedError(path string) error
- func NewMissingHibernationDetacherFunctionError(state string) error
- func NewResumeControllerNotSetError(from string) error
- type ActiveState
- type BeginHandler
- type ChainQueryStatusHook
- type ChainReadDirectoryHook
- type ChainSortHook
- type ChainSubPathHook
- type ChildFilterDef
- type ChildTraverseFilter
- type Client
- type Completion
- type Crate
- type DirectoryContents
- type EndHandler
- type Extension
- type FilterDef
- type Forest
- type FsDescription
- type HibernateHandler
- type HibernateOptions
- type HibernationBehaviour
- type Metric
- type MetricValue
- type Metrics
- type MutableMetric
- type NavigationMetric
- type Navigator
- type Node
- type Permissions
- type PolyFilterDef
- type QueryStatusHook
- type ReadDirectoryHook
- type Reporter
- type ResultCompletion
- type SampleFilterDef
- type SampleTraverseFilter
- type Servant
- type Session
- type SimpleHandler
- type SortHook
- type SubPathHook
- type SubPathInfo
- type Supervisor
- type TimeFunc
- type TraverseFilter
- type TraverseResult
Constants ¶
const ( FileSystemTimeFormat = "2006-01-02_15-04-05" PackageName = "agenor" )
Variables ¶
var ( Now TimeFunc Perms Permissions ResumeTail string )
var BenignNodeFilterDef = FilterDef{ Type: enums.FilterTypeRegex, Description: "benign allow all", Pattern: ".", Scope: enums.ScopeTree, }
var ErrDetectedSpawnStackOverflow = errors.New(
"spawn resume stack-overflow protection",
)
var ErrGuardianCantDecorateItemSealed = errors.New(
"can't decorate, last item is sealed",
)
ErrGuardianCantDecorateItemSealedError creates an untranslated error to indicate last item is sealed
var ErrNilForest = errors.New(
"forest is nil",
)
var ErrWrongPrimaryFacade = errors.New(
"wrong primary facade",
)
var ErrWrongResumeFacade = errors.New(
"wrong resume facade",
)
Functions ¶
func IsBrokerTopicNotFoundError ¶
IsBrokerTopicNotFoundError uses errors.Is to check if the err's error tree contains the core error: BrokerTopicNotFoundError
func IsInvalidNotificationMuteRequestedError ¶
IsInvalidNotificationMuteRequestedError uses errors.Is to check if the err's error tree contains the core error: InvalidNotificationMuteRequestedError
func IsInvalidPeriscopeRootPathError ¶
IsInvalidPeriscopeRootPathError uses errors.Is to check if the err's error tree contains the core error: InvalidPeriscopeRootPathError
func IsInvalidResumeStateTransitionError ¶
IsInvalidResumeStateTransitionError uses errors.Is to check if the err's error tree contains the core error: InvalidResumeStateTransitionNativeError
func IsMissingHibernationDetacherFunctionError ¶
IsMissingHibernationDetacherFunctionError uses errors.Is to check if the err's error tree contains the core error: MissingListenDetacherFunctionError
func IsNewItemAlreadyExtendedError ¶
IsNewItemAlreadyExtendedError uses errors.Is to check if the err's error tree contains the core error: NewItemAlreadyExtendedError
func IsResumeControllerNotSetError ¶
IsResumeControllerNotSetError uses errors.Is to check if the err's error tree contains the core error: ResumeControllerNotSetError
func NewBrokerTopicNotFoundError ¶
NewBrokerTopicNotFoundError creates an untranslated error to indicate the topic requested was not found; ie it wasn't registered.
func NewInvalidNotificationMuteRequestedError ¶
NewInvalidNotificationMuteRequestedError creates an untranslated error to indicate invalid notification mute requested (internal error)
func NewInvalidPeriscopeRootPathError ¶
NewInvalidPeriscopeRootPathError creates an untranslated error to indicate invalid periscope tree path, ie the current path is not a child directory relative to the tree path.
func NewInvalidResumeStateTransitionError ¶
NewInvalidResumeStateTransitionError creates an untranslated error to indicate in invalid resume state transition
func NewItemAlreadyExtendedError ¶
NewItemAlreadyExtendedError creates an untranslated error to indicate the node has already been extended
func NewMissingHibernationDetacherFunctionError ¶
NewMissingHibernationDetacherFunctionError creates an untranslated error to indicate hibernation detacher function nt defined
func NewResumeControllerNotSetError ¶
NewResumeControllerNotSetError creates an untranslated error to indicate resume controller not set
Types ¶
type ActiveState ¶
type ActiveState struct { Tree string TraverseDescription FsDescription ResumeDescription FsDescription Subscription enums.Subscription Hibernation enums.Hibernation CurrentPath string IsDir bool Depth int Metrics Metrics }
func (*ActiveState) Clone ¶
func (s *ActiveState) Clone() *ActiveState
type BeginHandler ¶
type BeginHandler func(tree string)
BeginHandler invoked before traversal begins
type ChainQueryStatusHook ¶
type ChainQueryStatusHook func(result fs.FileInfo, err error, qsys fs.StatFS, path string, ) (fs.FileInfo, error)
ChainQueryStatusHook chainable version of QueryStatusHook
type ChainReadDirectoryHook ¶
type ChainReadDirectoryHook func(result []fs.DirEntry, err error, rsys fs.ReadDirFS, dirname string, ) ([]fs.DirEntry, error)
ChainReadDirectoryHook chainable version of
type ChainSortHook ¶
ChainSortHook chainable version of SortHook
type ChainSubPathHook ¶
type ChainSubPathHook func(result string, info *SubPathInfo, ) string
ChainSubPathHook chainable version of SubPathHook
type ChildFilterDef ¶
type ChildFilterDef struct { // Type specifies the type of filter (mandatory) Type enums.FilterType // Description describes filter (optional) Description string // Pattern filter definition (mandatory) Pattern string // Negate, reverses the applicability of the filter (Defaults to false) Negate bool }
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type ChildTraverseFilter ¶
type ChildTraverseFilter interface { // Description describes filter Description() string // Validate ensures the filter definition is valid, returns // error when invalid Validate() error // Source, filter definition (comes from filter definition Pattern) Source() string // Matching returns the collection of files contained within this // item's directory that matches this filter. Matching(children []fs.DirEntry) []fs.DirEntry }
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type Completion ¶
type Completion func() bool
Completion
func (Completion) IsComplete ¶
func (fn Completion) IsComplete() bool
type DirectoryContents ¶
type DirectoryContents interface { All() []fs.DirEntry Directories() []fs.DirEntry Files() []fs.DirEntry }
DirectoryContents represents the contents of a directory's contents and handles sorting order which by default is different between various operating systems. This abstraction removes the differences in sorting behaviour on different platforms.
type EndHandler ¶
type EndHandler func(result TraverseResult)
EndHandler invoked at the end of traversal
type Extension ¶
type Extension struct { Depth int // traversal depth relative to the tree IsLeaf bool // defines whether this node a leaf node Name string // derived as the leaf segment from filepath.Split Parent string // derived as the directory from filepath.Split SubPath string // represents the path between the tree and the current item Scope enums.FilterScope // type of directory corresponding to the Filter Scope Custom any // to be set and used by the client }
Extension provides extended information if the client requests it by setting the DoExtend boolean in the traverse options.
type FilterDef ¶
type FilterDef struct { // Type specifies the type of filter (mandatory) Type enums.FilterType // Description describes filter (optional) Description string // Pattern filter definition (mandatory) Pattern string // Scope which file system entries this filter applies to (defaults // to ScopeAllEn) Scope enums.FilterScope // Negate, reverses the applicability of the filter (Defaults to false) Negate bool // IfNotApplicable, when the filter does not apply to a directory entry, // this value determines whether the callback is invoked for this entry // or not (defaults to true). IfNotApplicable enums.TriStateBool // Poly allows for the definition of a PolyFilter which contains separate // filters that target files and directories separately. If present, then // all other fields are redundant, since the filter definitions inside // Poly should be referred to instead. Poly *PolyFilterDef }
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type Forest ¶
type Forest struct { // T is the file system that contains just the functionality required // for traversal. It can also represent other file systems including afero, // providing the appropriate adapters are in place. T tfs.TraversalFS // R is the file system required for resume operations, ie we load // and save resume state via this file system instance, which is // distinct from the traversal file system. R tfs.TraversalFS }
Forest contains the logical file systems required for navigation.
type FsDescription ¶
type FsDescription struct {
IsRelative bool
}
FsDescription description of a file system
type HibernateHandler ¶
type HibernateHandler func(description string)
HibernateHandler is a generic handler that is used by hibernation to indicate wake or sleep.
type HibernateOptions ¶
type HibernateOptions struct { // WakeAt defines a filter for hibernation wake condition WakeAt *FilterDef // SleepAt defines a filter for hibernation sleep condition SleepAt *FilterDef // Behaviour contains hibernation behavioural aspects Behaviour HibernationBehaviour }
HibernateOptions
func (*HibernateOptions) IsHibernateActive ¶
func (o *HibernateOptions) IsHibernateActive() bool
type HibernationBehaviour ¶
type HibernationBehaviour struct { // InclusiveWake when wake occurs, permit client callback to // be invoked for the current node. Inclusive, true by default InclusiveWake bool // InclusiveSleep when sleep occurs, permit client callback to // be invoked for the current node. Exclusive, false by default. InclusiveSleep bool }
HibernationBehaviour
type Metric ¶
type Metric interface { Type() enums.Metric Value() MetricValue }
Metric represents query access to the metric. The client registering the metric should maintain it's mutate access to the metric so they can update it.
type MetricValue ¶
type MetricValue = uint
type Metrics ¶
type Metrics map[enums.Metric]*NavigationMetric
type MutableMetric ¶
type MutableMetric interface { Metric Tick() MetricValue Times(increment uint) MetricValue }
MutableMetric represents write access to the metric
type NavigationMetric ¶
type NavigationMetric struct {}
func (*NavigationMetric) Tick ¶
func (m *NavigationMetric) Tick() MetricValue
func (*NavigationMetric) Times ¶
func (m *NavigationMetric) Times(increment uint) MetricValue
func (*NavigationMetric) Type ¶
func (m *NavigationMetric) Type() enums.Metric
func (*NavigationMetric) Value ¶
func (m *NavigationMetric) Value() MetricValue
type Node ¶
type Node struct { Path string Entry fs.DirEntry // contains a FileInfo via Info() function Info fs.FileInfo // optional file info instance Extension Extension // extended information about the directory entry Error error Children []fs.DirEntry Parent *Node // contains filtered or unexported fields }
Node represents a file system node event and represents each file system entity encountered during traversal. The event representing the tree node does not have a DirEntry because it is not created as a result of a readDir invoke. Therefore, the client has to know that when its function is called back, there will be no DirEntry for the tree node.
func (*Node) IsDirectory ¶
IsDirectory indicates wether this node is a directory.
type PolyFilterDef ¶
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type QueryStatusHook ¶
QueryStatusHook function signature that enables the default to be overridden. (By default, uses Lstat)
type ReadDirectoryHook ¶
ReadDirectoryHook hook function to define implementation of how a directory's entries are read. A default implementation is preset, so does not have to be set by the client.
type Reporter ¶
type Reporter interface {
Count(enums.Metric) MetricValue
}
Reporter represents query access to the metrics Supervisor
type ResultCompletion ¶
type ResultCompletion interface {
IsComplete() bool
}
ResultCompletion used to determine if the result really represents final navigation completion.
type SampleFilterDef ¶
type SampleFilterDef struct { // Type specifies the type of filter (mandatory) Type enums.FilterType // Description describes filter (optional) Description string // Pattern filter definition (mandatory except if using Custom) Pattern string // Scope which file system entries this filter applies to; // for sampling, only ScopeFile and ScopeDirectory are valid. Scope enums.FilterScope // Negate, reverses the applicability of the filter (Defaults to false) Negate bool // Poly allows for the definition of a PolyFilter which contains separate // filters that target files and directories separately. If present, then // all other fields are redundant, since the filter definitions inside // Poly should be referred to instead. Poly *PolyFilterDef // Custom client defined sampling filter // Custom SampleTraverseFilter }
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type SampleTraverseFilter ¶
type SampleTraverseFilter interface { // Description describes filter Description() string // Validate ensures the filter definition is valid, panics when invalid Validate() error // Matching returns the collection of files contained within this // item's directory that matches this filter. Matching(children []fs.DirEntry) []fs.DirEntry }
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type Servant ¶
type Servant interface {
Node() *Node
}
Servant provides the client with facility to request properties about the current navigation node.
type Session ¶
type Session interface { ResultCompletion StartedAt() time.Time Elapsed() time.Duration }
Session represents a traversal session and keeps tracks of timing.
type SimpleHandler ¶
type SimpleHandler func()
SimpleHandler is a function that takes no parameters and can be used by any notification with this signature.
type SortHook ¶
SortHook hook function to define how directory entries are sorted. Does not have to be set explicitly. This will be set according to the IsCaseSensitive on the TraverseOptions, but can be overridden if needed.
type SubPathInfo ¶
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
func NewSupervisor ¶
func NewSupervisor() *Supervisor
func (*Supervisor) Count ¶
func (s *Supervisor) Count(mt enums.Metric) MetricValue
func (*Supervisor) Single ¶
func (s *Supervisor) Single(mt enums.Metric) *NavigationMetric
type TraverseFilter ¶
type TraverseFilter interface { // Description describes filter Description() string // Validate ensures the filter definition is valid, returns // error when invalid Validate() error // Source, filter definition (comes from filter definition Pattern) Source() string // IsMatch does this node match the filter IsMatch(node *Node) bool // IsApplicable is this filter applicable to this node's scope IsApplicable(node *Node) bool // Scope, what items this filter applies to Scope() enums.FilterScope }
TraverseFilter filter that can be applied to file system entries. When specified, the callback will only be invoked for file system nodes that pass the filter.
type TraverseResult ¶
TraverseResult