event

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type     Type
	FromPath connector.Path
	ToPath   connector.Path
}

func (Event) String

func (e Event) String() string

type EventHandler

type EventHandler interface {
	StackLength() int
	Append(event fsnotify.Event, sum string)
	Pop() fsnotify.Event

	Process() []Event
	// contains filtered or unexported methods
}

func NewEventHandler

func NewEventHandler() EventHandler

type EventManager

type EventManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Since OS events arrive synchronously and some events alone do not make sense, there was a need to set up a queue structure. Watchers written for OS periodically push events to the EventManager's stack and periodically handle these events within the Process method.

func (*EventManager) Append

func (e *EventManager) Append(event fsnotify.Event, sum string)

func (*EventManager) Pop

func (e *EventManager) Pop() fsnotify.Event

func (*EventManager) Process

func (e *EventManager) Process() []Event

This is where Event Manager processes the events in the main bus.Stack piece by piece. Determining the maximum number of events to be processed;

It is determined by how many events the operating system will send for a file transaction.

func (*EventManager) StackLength

func (e *EventManager) StackLength() int

type Type

type Type string
const (
	Remove Type = "remove"
	Write  Type = "write"
	Create Type = "create"
	Rename Type = "rename"
	Move   Type = "move"
)

func (Type) String

func (e Type) String() string

Jump to

Keyboard shortcuts

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