Documentation
¶
Index ¶
- type Config
- type File
- type Positions
- func (p *Positions) Get(path string) (int64, error)
- func (p *Positions) GetString(path string) string
- func (p *Positions) Put(path string, pos int64)
- func (p *Positions) PutString(path string, pos string)
- func (p *Positions) Remove(path string)
- func (p *Positions) Stop()
- func (p *Positions) SyncPeriod() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SyncPeriod time.Duration `yaml:"sync_period"`
PositionsFile string `yaml:"filename"`
}
Config describes where to get postition information from.
func (*Config) RegisterFlags ¶
func (cfg *Config) RegisterFlags(flags *flag.FlagSet)
RegisterFlags register flags.
type File ¶
type File struct {
Positions map[string]string `yaml:"positions"`
}
File format for the positions data.
type Positions ¶
type Positions struct {
// contains filtered or unexported fields
}
Positions tracks how far through each file we've read.
func (*Positions) Get ¶
func (p *Positions) Get(path string) (int64, error)
Get returns how far we've read through a file. Returns an error if the value stored for the file is not an integer.
func (*Positions) GetString ¶ added in v0.2.0
func (p *Positions) GetString(path string) string
GetString returns how far we've through a file as a string. JournalTarget writes a journal cursor to the positions file, while FileTarget writes an integer offset. Use Get to read the integer offset.
func (*Positions) Put ¶
func (p *Positions) Put(path string, pos int64)
Put records (asynchronously) how far we've read through a file.
func (*Positions) PutString ¶ added in v0.2.0
func (p *Positions) PutString(path string, pos string)
PutString records (asynchronsouly) how far we've read through a file. Unlike Put, it records a string offset and is only useful for JournalTargets which doesn't have integer offsets.
func (*Positions) Remove ¶
func (p *Positions) Remove(path string)
Remove removes the position tracking for a filepath
func (*Positions) SyncPeriod ¶
func (p *Positions) SyncPeriod() time.Duration
SyncPeriod returns how often the positions file gets resynced