boulder: Index | Files

package reloader

import ""

Package reloader provides a method to load a file whenever it changes.


Package Files


type Reloader Uses

type Reloader struct {
    // contains filtered or unexported fields

Reloader represents an ongoing reloader task.

func New Uses

func New(filename string, dataCallback func([]byte) error, errorCallback func(error)) (*Reloader, error)

New loads the filename provided, and calls the callback. It then spawns a goroutine to check for updates to that file, calling the callback again with any new contents. The first load, and the first call to callback, are run synchronously, so it is easy for the caller to check for errors and fail fast. New will return an error if it occurs on the first load. Otherwise all errors are sent to the callback.

func (*Reloader) Stop Uses

func (r *Reloader) Stop()

Stop stops an active reloader, release its resources.

Package reloader imports 3 packages (graph) and is imported by 48 packages. Updated 2017-01-31. Refresh now. Tools for package owners.