Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnmodified = errors.New("unmodified")
ErrUnmodified is the error to signal that the source has not been modified since the last sync.
Functions ¶
func ExpBackoff ¶
ExpBackoff returns an OnSourceError handler which does exponential backoff starting with base, doubles for every retry, and stops retrying after 'stop' attempts.
Types ¶
type Runner ¶
type Runner struct {
// If given, OnSourceError is called if there is any error fetching from
// the source. tries is how many times has been tried and failed. It should
// return the wait time before trying again, or zero to stop retrying.
OnSourceError func(err error, tries int) time.Duration
// If given, OnSinkError is called if there is any error writing to any of
// the sinks. There is no retry logic as sinks are local and considered to
// be more reliable than the source.
OnSinkError func(sink Sink, err error)
Validate func(data []byte) error
// contains filtered or unexported fields
}
Runner runs the logic to synchronizes data from the source to the sinks
func NewWithValidator ¶
Like New but with a function that validates data before sending it to the sinks
type Sink ¶
Sink represents somewhere the data can be written to
type Source ¶
type Source interface {
// Fetch fetches the data from the source if modified since the designated time.
Fetch(ifNewerThan time.Time) (io.ReadCloser, error)
}
Source represents somewhere any data can be fetched from
func FromFileWithPreprocessor ¶
func FromFileWithPreprocessor(path string, preprocessor func(io.ReadCloser) (io.ReadCloser, error)) Source
FromFileWithPreprocessor constructs a source from the given file path, while modifying the file data using preprocessor function
Click to show internal directories.
Click to hide internal directories.