tracker

package
v0.0.0-...-fea0fea Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 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 BoltTracker

type BoltTracker struct {
	// contains filtered or unexported fields
}

BoltTracker tracks/stores where each processor is up to (event wise). Using bboltDB for this... Have a bbolt bucket per processor.

func NewBoltTracker

func NewBoltTracker(path string, syncIntervalInMS int) *BoltTracker

if syncIntervalInMS == 0 it means write realtime and use boltDB as normal.

func (*BoltTracker) Close

func (t *BoltTracker) Close() error

func (*BoltTracker) Connect

func (t *BoltTracker) Connect() error

func (*BoltTracker) CreateBucket

func (t *BoltTracker) CreateBucket(bucketName string) error

func (*BoltTracker) Enabled

func (t *BoltTracker) Enabled() bool

func (*BoltTracker) Get

func (t *BoltTracker) Get(bucketName string, key []byte) []byte

func (*BoltTracker) GetKeyValueListForBucket

func (t *BoltTracker) GetKeyValueListForBucket(bucketNames []string) []TrackerKeyValue

func (*BoltTracker) GetKeysForBucket

func (t *BoltTracker) GetKeysForBucket(bucketName string) [][]byte

func (*BoltTracker) GetPosition

func (t *BoltTracker) GetPosition(processorName string, key string) int

GetInt gets from memory cache or the real bboltdb

func (*BoltTracker) UpdatePosition

func (t *BoltTracker) UpdatePosition(processName string, key string, value int) error

UpdatePosition updates a key in a given bucket.. assumption key is string and value is int. Does the byte array conversion dance. If t.useMemoryTracker is true, then write to the BoltTracker Map.. this will get synced later. if t.useMemoryTracker is false, just write to boltdb directly.

func (*BoltTracker) UseMemoryTracker

func (t *BoltTracker) UseMemoryTracker() bool

type JsonTracker

type JsonTracker struct {
	// contains filtered or unexported fields
}

JsonTracker just reads/writes the data directly to a local file. Seeing if this is any quicker than bboltdb

func NewJsonTracker

func NewJsonTracker(path string) *JsonTracker

func (*JsonTracker) GetPosition

func (t *JsonTracker) GetPosition(processorName string, key string) int

GetPostition get data from json file

func (*JsonTracker) UpdatePosition

func (t *JsonTracker) UpdatePosition(processName string, key string, value int) error

func (*JsonTracker) UseMemoryTracker

func (t *JsonTracker) UseMemoryTracker() bool

probably need to modify interface to get rid of this.

type MemoryTrackerKeyValue

type MemoryTrackerKeyValue struct {
	Key    string
	Value  int
	Stored bool
}

type NullTracker

type NullTracker struct {
}

NullTracker... for when we dont actually want to track. Saves putting a bunch of logic elsewhere... yes, slightly less efficient but can deal with it.

func NewNullTracker

func NewNullTracker(path string, syncIntervalInMS int) *NullTracker

func (*NullTracker) Enabled

func (t *NullTracker) Enabled() bool

func (*NullTracker) GetPosition

func (t *NullTracker) GetPosition(processorName string, key string) int

func (*NullTracker) UpdatePosition

func (t *NullTracker) UpdatePosition(processName string, key string, value int) error

func (*NullTracker) UseMemoryTracker

func (t *NullTracker) UseMemoryTracker() bool

type TrackerDetails

type TrackerDetails struct {
	Key   string `json:"Key"`
	Value int    `json:"Value"`
}

type TrackerInterface

type TrackerInterface interface {
	UseMemoryTracker() bool
	Enabled() bool
	UpdatePosition(processorName string, key string, value int) error
	GetPosition(processorName string, key string) int
}

type TrackerKeyValue

type TrackerKeyValue struct {
	Key   []byte
	Value []byte
}

Jump to

Keyboard shortcuts

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