Documentation ¶
Overview ¶
Package ws implements a workspace for file resources.
Index ¶
Constants ¶
const ( FlagDir uint64 = 1 << iota FlagLogical FlagMount FlagIgnore )
Variables ¶
var Skip = fmt.Errorf("skip")
Skip is returned by walk visitors to prevent visiting children of the resource in context.
Functions ¶
Types ¶
type Config ¶
type Config struct { // CapHint hints the expected peak resource capacity. CapHint uint // Watcher returns a new watcher given workspace control. // Mounting a path results in a snapshot if no Watcher is configured. Watcher func(Controller) (Watcher, error) // Handler handles events if set. Handler Handler // Filter filters resources if set. Filter Filter }
Config contains the configuration used to create new workspaces.
type Controller ¶
Controller provides an interface for the watcher to modify the workspace.
type Filter ¶
Filter checks new resources and returns true if the resources should be flagged as ignored. Resources with FlagIgnore remain in the workspace. Ignored directories are not read.
type Id ¶
type Id uint32
Id identifies a workspace resource uniquely. Having a fnv32 hash collision is considered a user error.
func NewId ¶
Creates a workspace id for path. Path must be absolute and clean (sans trailing slash).
func (Id) MarshalJSON ¶
func (*Id) UnmarshalJSON ¶
type Queue ¶
Queue implements a locked resource queue.
type Throttle ¶
type Throttle struct { sync.Mutex Tickers chan *time.Ticker // contains filtered or unexported fields }
Throttle manages a ticker and swaps two queue when worked. New tickers are sent to the Tickers channel and run as long as work is available.
func NewThrottle ¶
type Watcher ¶
Watcher provides and interface for workspace watchers.
func NewInotify ¶
func NewInotify(ctrler Controller) (Watcher, error)