exevent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActionExecutorCreator

func NewActionExecutorCreator(logger *zap.SugaredLogger) domain.ActionExecutorCreator

func NewEventSource

func NewEventSource(stClient domain.SyncthingClient, logger *zap.SugaredLogger) domain.EventSource

Types

type ActionExecutorCreator

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

func (*ActionExecutorCreator) CreateExecutor

func (c *ActionExecutorCreator) CreateExecutor(action *domain.HookAction, hookDef *domain.HookDefinition) (domain.EventHandler, error)

CreateExecutor creates executor handler based on given configuration.

Returned error could be domain.ErrInvalidActionType.

type ChannelCollector

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

ChannelCollector forwards all events to a channel and call next handler. The out channel will be closed once this collector is destroyed.

func NewChannelCollector

func NewChannelCollector() *ChannelCollector

func (*ChannelCollector) Destroy

func (c *ChannelCollector) Destroy()

func (*ChannelCollector) GetCh

func (c *ChannelCollector) GetCh() domain.EventCh

func (*ChannelCollector) GetNext

func (h *ChannelCollector) GetNext() domain.EventHandler

func (*ChannelCollector) Handle

func (c *ChannelCollector) Handle(event *domain.Event)

func (*ChannelCollector) SetNext

func (h *ChannelCollector) SetNext(next domain.EventHandler)

type CoolDownFilter

type CoolDownFilter struct {
	*CoolDownFilterOptions
	// contains filtered or unexported fields
}

func NewCoolDownFilter

func NewCoolDownFilter(cooldown int64, logger *zap.SugaredLogger, options ...CoolDownFilterOption) *CoolDownFilter

func (*CoolDownFilter) Destroy

func (h *CoolDownFilter) Destroy()

func (*CoolDownFilter) GetNext

func (h *CoolDownFilter) GetNext() domain.EventHandler

func (*CoolDownFilter) Handle

func (h *CoolDownFilter) Handle(event *domain.Event)

func (*CoolDownFilter) SetNext

func (h *CoolDownFilter) SetNext(next domain.EventHandler)

type CoolDownFilterOption

type CoolDownFilterOption func(opt *CoolDownFilterOptions)

func CoolDownFilterTimeProvider

func CoolDownFilterTimeProvider(provider domain.TimeProvider) CoolDownFilterOption

type CoolDownFilterOptions

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

type DirPathFilter

type DirPathFilter struct {
	*DirPathFilterOptions
	// contains filtered or unexported fields
}

DirPathFilter terminates all events except that the path matches expected base path (equals or subdir). Unable to retrieve the path or type from the event is considered a match failure.

func NewDirPathFilter

func NewDirPathFilter(basePath string, logger *zap.SugaredLogger, options ...DirPathFilterOption) *DirPathFilter

func (*DirPathFilter) Destroy

func (h *DirPathFilter) Destroy()

func (*DirPathFilter) GetNext

func (h *DirPathFilter) GetNext() domain.EventHandler

func (*DirPathFilter) Handle

func (d *DirPathFilter) Handle(event *domain.Event)

func (*DirPathFilter) SetNext

func (h *DirPathFilter) SetNext(next domain.EventHandler)

type DirPathFilterOption

type DirPathFilterOption func(opt *DirPathFilterOptions)

func DirPathFilterWithPathExtractor

func DirPathFilterWithPathExtractor(pathExtractor func(event *domain.Event) (string, error)) DirPathFilterOption

type DirPathFilterOptions

type DirPathFilterOptions struct {
	Logger   *zap.SugaredLogger
	BasePath string
	// extract path from the event, must start with '/'
	DirPathExtractor func(event *domain.Event) (string, error)
}

type EventSource

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

func (*EventSource) Subscribe

func (s *EventSource) Subscribe(eventType domain.EventType, params *domain.HookParameters, hookDef *domain.HookDefinition) (domain.EventCh, error)

Subscribe subscribes event of given type and apply filters based on params.

Returned error could be domain.IllegalEventParamError | domain.ErrNotValidNativeEventType

func (*EventSource) Unsubscribe

func (s *EventSource) Unsubscribe(eventCh domain.EventCh)

type ExecExecutor

type ExecExecutor struct {
	*ExecExecutorOptions
	// contains filtered or unexported fields
}

func NewExecExecutor

func NewExecExecutor(cmd []string, logger *zap.SugaredLogger, options ...ExecExecutorOption) *ExecExecutor

func (*ExecExecutor) Destroy

func (h *ExecExecutor) Destroy()

func (*ExecExecutor) GetNext

func (h *ExecExecutor) GetNext() domain.EventHandler

func (*ExecExecutor) Handle

func (h *ExecExecutor) Handle(event *domain.Event)

func (*ExecExecutor) SetNext

func (h *ExecExecutor) SetNext(next domain.EventHandler)

type ExecExecutorOption

type ExecExecutorOption func(opt *ExecExecutorOptions)

func ExecExecutorCmdExecutor

func ExecExecutorCmdExecutor(cmdExec cmdExecutor) ExecExecutorOption

type ExecExecutorOptions

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

type FolderIdFilter

type FolderIdFilter struct {
	*FolderIdFilterOptions
	// contains filtered or unexported fields
}

FolderIdFilter terminates all events except that the folder ID is the same as expected. Unable to retrieve the folderId from the event is considered a match failure.

func NewFolderIdFilter

func NewFolderIdFilter(folderId string, logger *zap.SugaredLogger, options ...FolderIdFilterOption) *FolderIdFilter

func (*FolderIdFilter) Destroy

func (h *FolderIdFilter) Destroy()

func (*FolderIdFilter) GetNext

func (h *FolderIdFilter) GetNext() domain.EventHandler

func (*FolderIdFilter) Handle

func (f *FolderIdFilter) Handle(event *domain.Event)

func (*FolderIdFilter) SetNext

func (h *FolderIdFilter) SetNext(next domain.EventHandler)

type FolderIdFilterOption

type FolderIdFilterOption func(opt *FolderIdFilterOptions)

func FolderIdFilterWithFolderIdExtractor

func FolderIdFilterWithFolderIdExtractor(folderIdExtractor func(event *domain.Event) (string, error)) FolderIdFilterOption

type FolderIdFilterOptions

type FolderIdFilterOptions struct {
	Logger            *zap.SugaredLogger
	FolderId          string
	FolderIdExtractor func(event *domain.Event) (string, error)
}

type MockcmdExecutor

type MockcmdExecutor struct {
	mock.Mock
}

MockcmdExecutor is an autogenerated mock type for the cmdExecutor type

func NewMockcmdExecutor

func NewMockcmdExecutor(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockcmdExecutor

NewMockcmdExecutor creates a new instance of MockcmdExecutor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockcmdExecutor) EXPECT

type MockcmdExecutor_Expecter

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

type MockcmdExecutor_exec_Call

type MockcmdExecutor_exec_Call struct {
	*mock.Call
}

MockcmdExecutor_exec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'exec'

func (*MockcmdExecutor_exec_Call) Return

func (*MockcmdExecutor_exec_Call) Run

func (_c *MockcmdExecutor_exec_Call) Run(run func(name string, arg ...string)) *MockcmdExecutor_exec_Call

func (*MockcmdExecutor_exec_Call) RunAndReturn

func (_c *MockcmdExecutor_exec_Call) RunAndReturn(run func(string, ...string) error) *MockcmdExecutor_exec_Call

type ToleranceFilter

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

func NewToleranceFilter

func NewToleranceFilter(tolerance int64, logger *zap.SugaredLogger) *ToleranceFilter

func (*ToleranceFilter) Destroy

func (h *ToleranceFilter) Destroy()

func (*ToleranceFilter) GetNext

func (h *ToleranceFilter) GetNext() domain.EventHandler

func (*ToleranceFilter) Handle

func (h *ToleranceFilter) Handle(event *domain.Event)

func (*ToleranceFilter) SetNext

func (h *ToleranceFilter) SetNext(next domain.EventHandler)

Jump to

Keyboard shortcuts

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