Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileMonitor ¶
type FileMonitor struct { // log Log zerolog.Logger // list of subscribers and their states Subsciptions []Subscription }
FileMonitor detects changes since the last check and notifies subscribers
func (*FileMonitor) Monitor ¶
func (m *FileMonitor) Monitor()
Check if changes in files require any action
func (*FileMonitor) Run ¶
func (m *FileMonitor) Run(watcher *fsnotify.Watcher)
Run activates a go routine that calls Monitor() upon changes in $DATA_DIR/adminconfig directory where DATA_DIR environment variable defines the root directory of the data.
func (*FileMonitor) Subscribe ¶
func (m *FileMonitor) Subscribe(subscriber Subscriber) error
Subscribe to get notifications on file changes
type FileMonitorOptions ¶
type Subscriber ¶
type Subscriber interface { GetOptions() FileMonitorOptions OnError(err error) OnNotify() }
type Subscription ¶
type Subscription struct { Entity Subscriber Options FileMonitorOptions LastModified time.Time NumFiles int }
Click to show internal directories.
Click to hide internal directories.