positions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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]int64 `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 New

func New(logger log.Logger, cfg Config) (*Positions, error)

New makes a new Positions.

func (*Positions) Get

func (p *Positions) Get(path string) int64

Get returns how far we've read through a file.

func (*Positions) Put

func (p *Positions) Put(path string, pos int64)

Put records (asynchronously) how far we've read through a file.

func (*Positions) Remove

func (p *Positions) Remove(path string)

Remove removes the position tracking for a filepath

func (*Positions) Stop

func (p *Positions) Stop()

Stop the Position tracker.

func (*Positions) SyncPeriod

func (p *Positions) SyncPeriod() time.Duration

SyncPeriod returns how often the positions file gets resynced

Jump to

Keyboard shortcuts

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