monitor

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package monitor identifies new backups as they become available. It watches a given backup directory, determining when a backup completes using a small state machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor struct {

	// Backups contains paths to newly completed backups. These paths will be
	// relative or absolute, depending on the path provided when creating the
	// monitor. Backups are safe to read immediately.
	Backups <-chan string

	// Errors contains errors returned by the underlying filesystem watcher.
	Errors <-chan error
	// contains filtered or unexported fields
}

Monitor encapsulates the output of watching for UniFi backups.

func New

func New(dir string) (*Monitor, error)

New creates a new monitor that watches for and returns new UniFi backups. If no error occurs while setting up the watcher, the provided directory will be monitored until Close() is called.

func (*Monitor) Close

func (m *Monitor) Close() error

Close terminates the underlying filesystem watcher, returning any error encountered, or nil if the close was successful. Regardless, the monitor should be considered unusable.

Jump to

Keyboard shortcuts

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