Documentation ¶
Index ¶
- func MakeDir(filename string) (dbdir string, err error)
- func RenameFile(fromName string, toName string) error
- type Config
- func (c *Config) Close()
- func (c *Config) Date() time.Time
- func (c *Config) ExtractTarGz(gzipStream io.Reader) (error, string)
- func (c *Config) ExtractZip() (error, string)
- func (c *Config) NotifyClose() <-chan struct{}
- func (c *Config) NotifyError() (errChan <-chan error)
- func (c *Config) NotifyInfo() <-chan string
- func (c *Config) NotifyOpen() (filename <-chan string)
- func (c *Config) Open() error
- func (c *Config) OpenURL() (*Config, error)
- func (c *Config) ProcessFile() (error, string)
- func (c *Config) SendError(err error)
- func (c *Config) SendInfo(message string)
- type Notifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenameFile ¶
Types ¶
type Config ¶
type Config struct { Notifier *Notifier // Holds all notification channels File string Archive string Closed bool // Mark this db as closed. UpdateInterval time.Duration RetryInterval time.Duration LastUpdated time.Time // Last time the db was updated. Mu sync.RWMutex // Protects all the above. // contains filtered or unexported fields }
func NewDefaultConfig ¶
func (*Config) Date ¶
Date returns the UTC date the database file was last modified. If no database file has been opened the behaviour of Date is undefined.
func (*Config) ExtractZip ¶
func (*Config) NotifyClose ¶
func (c *Config) NotifyClose() <-chan struct{}
NotifyClose returns a channel that is closed when the database is closed.
func (*Config) NotifyError ¶
NotifyError returns a channel that notifies when an error occurs while downloading or reloading a Config that points to a URL.
func (*Config) NotifyInfo ¶
NotifyInfo returns a channel that notifies informational messages while downloading or reloading.
func (*Config) NotifyOpen ¶
NotifyOpen returns a channel that notifies when a new database is loaded or reloaded. This can be used to monitor background updates when the Config points to a URL.
func (*Config) Open ¶
Open creates and initializes a DB from a local file.
The database file is monitored by fsnotify and automatically reloads when the file is updated or overwritten.
func (*Config) OpenURL ¶
OpenURL creates and initializes a DB from a URL. It automatically downloads and updates the file in background, and keeps a local copy on $TMPDIR.