events

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentEvent

type ContentEvent struct {
	File         string `json:"file"`
	FileNameHash string `json:"fileNameHash"`
	Timestamp    string `json:"ts"`
	ForceReload  bool   `json:"forceReload"`
	ReloadConfig bool   `json:"reloadConfig"`
}

type EventHandler

type EventHandler interface {
	OnEvent(ev ContentEvent) error
	Close() error
}

type EventHandlerFunc

type EventHandlerFunc func(ev ContentEvent) error

func (EventHandlerFunc) OnEvent

func (f EventHandlerFunc) OnEvent(ev ContentEvent) error

type EventHub

type EventHub struct {
	FileNameHash hash.Hash
	Logger       *log.Logger
	// contains filtered or unexported fields
}

func NewEventHub

func NewEventHub(logger *log.Logger, eventSource EventSource, fileNameHash hash.Hash, mutations ...EventMutation) *EventHub

func (*EventHub) Close

func (h *EventHub) Close() error

func (*EventHub) Subscribe

func (h *EventHub) Subscribe(handler EventHandler) (id uuid.UUID)

func (*EventHub) Unsubscribe

func (h *EventHub) Unsubscribe(id uuid.UUID) (err error)

type EventMutation

type EventMutation interface {
	OnEvent(in ContentEvent, ev fs.Event) (out ContentEvent)
}

type EventSource

type EventSource interface {
	io.Closer
	fs.FS
	Events() chan fs.Event
}

type MutationConfigReloadForFile

type MutationConfigReloadForFile string

func (MutationConfigReloadForFile) OnEvent

type MutationReloadForFile

type MutationReloadForFile string

func (MutationReloadForFile) OnEvent

func (t MutationReloadForFile) OnEvent(in ContentEvent, ev fs.Event) (out ContentEvent)

Jump to

Keyboard shortcuts

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