Documentation
¶
Index ¶
- Variables
- type Config
- type Engine
- func (engine *Engine) AttachBackgroundCallback(callback func() bool) *Engine
- func (engine *Engine) SetLogger(logger *slog.Logger)
- func (engine *Engine) Start() error
- func (engine *Engine) Stop()
- func (engine *Engine) StringtoConfigTOML(tomlString string) error
- func (engine *Engine) StringtoConfigYAML(yamlString string) error
- type Event
- type EventCallback
- type EventHandle
- type EventManager
- type Ignore
Constants ¶
This section is empty.
Variables ¶
View Source
var CallbackMap = map[notify.Event]Event{ notify.InCloseWrite: InCloseWrite, notify.InModify: InModify, notify.InMovedTo: InMovedTo, notify.InMovedFrom: InMovedFrom, notify.InCreate: InCreate, notify.InDelete: InDelete, notify.Write: Write, notify.Create: Create, notify.Remove: Remove, notify.Rename: Rename, }
View Source
var EventMap = map[notify.Event]eventInfo{ notify.InCloseWrite: {Name: "InCloseWrite", Reload: true}, notify.InModify: {Name: "InModify", Reload: true}, notify.InMovedTo: {Name: "InMovedTo", Reload: true}, notify.InMovedFrom: {Name: "InMovedFrom", Reload: true}, notify.InCreate: {Name: "InCreate", Reload: true}, notify.InDelete: {Name: "InDelete", Reload: true}, notify.Write: {Name: "Write", Reload: true}, notify.Create: {Name: "Create", Reload: false}, notify.Remove: {Name: "Remove", Reload: false}, notify.Rename: {Name: "Rename", Reload: false}, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { RootPath string `toml:"root_path" yaml:"root_path"` BackgroundStruct process.Execute `toml:"background" yaml:"background"` BackgroundCallback func() bool `toml:"-" yaml:"-"` Ignore Ignore `toml:"ignore" yaml:"ignore"` ExecStruct []process.Execute `toml:"executes" yaml:"executes"` ExecList []string `toml:"exec_list" yaml:"exec_list"` LogLevel string `toml:"log_level" yaml:"log_level"` Debounce int `toml:"debounce" yaml:"debounce"` Callback func(*EventCallback) EventHandle Slog *slog.Logger // contains filtered or unexported fields }
type Engine ¶
type Engine struct { PrimaryProcess process.Process BgProcess process.Process Chan chan notify.EventInfo Active bool Config Config `toml:"config" yaml:"config"` ProcessLogFile *os.File ProcessLogPipe io.ReadCloser ProcessManager *process.ProcessManager // contains filtered or unexported fields }
func NewEngine ¶
func NewEngine(rootPath, execCommand, logLevel string, execList []string, ignore Ignore, debounce int, chunkSize string) (*Engine, error)
This is out of date
func NewEngineFromConfig ¶
func NewEngineFromTOML ¶
func NewEngineFromYAML ¶ added in v0.4.1
func (*Engine) AttachBackgroundCallback ¶ added in v0.4.4
func (*Engine) StringtoConfigTOML ¶ added in v0.4.8
func (*Engine) StringtoConfigYAML ¶ added in v0.4.8
type Event ¶
type Event int
Event is used to determine what type of event was triggered
const ( Create Event = iota Write Remove Rename // Windows Specific Actions ActionModified ActionRenamedNewName ActionRenamedOldName ActionAdded ActionRemoved ChangeLastWrite ChangeAttributes ChangeSize ChangeDirName ChangeFileName ChangeSecurity ChangeCreation ChangeLastAccess // Linux Specific Actions InCloseWrite InModify InMovedTo InMovedFrom InCreate InDelete )
type EventCallback ¶
type EventCallback struct { Type Event // Event enum Time time.Time // time.Now() when event was triggered Path string // Full path to the modified file }
Called whenever a change is detected in the filesystem By default we ignore file rename/remove and a bunch of other events that would likely cause breaking changes on a reload see eventmap_[oos].go for default rules
type EventHandle ¶
type EventHandle int
EventHandle is used to determine how to handle a reload callback
const ( EventContinue EventHandle = iota EventBypass EventIgnore )
type EventManager ¶ added in v0.6.0
type EventManager struct {
// contains filtered or unexported fields
}
func NewEventManager ¶ added in v0.6.0
func NewEventManager(engine *Engine, debounce int) *EventManager
func (*EventManager) HandleEvent ¶ added in v0.6.0
func (em *EventManager) HandleEvent(ei notify.EventInfo)
Click to show internal directories.
Click to hide internal directories.