state

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedSyncer added in v0.0.6

type CachedSyncer struct {
	SyncFinder    SyncFinder
	SyncCache     SyncCache
	Log           *zapctx.Logger
	CacheDuration time.Duration
}

func (*CachedSyncer) ToSync added in v0.0.6

func (c *CachedSyncer) ToSync(ctx context.Context) (map[TargetGroupARN]string, error)

type DynamoDBStorage

type DynamoDBStorage struct {
	TableName       string
	Log             *zapctx.Logger
	Client          *dynamodb.DynamoDB
	SyncCachePrefix string
}

func (*DynamoDBStorage) GetStates

func (d *DynamoDBStorage) GetStates(ctx context.Context, syncPairs []Keys) (map[Keys]State, error)

func (*DynamoDBStorage) GetSync

func (d *DynamoDBStorage) GetSync(ctx context.Context, currentTime time.Time) (map[TargetGroupARN]string, error)

func (*DynamoDBStorage) Store

func (d *DynamoDBStorage) Store(ctx context.Context, toStore map[Keys]State) error

func (*DynamoDBStorage) StoreSync

func (d *DynamoDBStorage) StoreSync(ctx context.Context, toStore map[TargetGroupARN]string, expireAt time.Time) error

type HardCodedSyncFinder

type HardCodedSyncFinder struct {
	TargetGroupARN TargetGroupARN
	Hostname       string
}

func (*HardCodedSyncFinder) ToSync

type Keys

type Keys struct {
	TargetGroupARN TargetGroupARN
	Hostname       string
}

func (Keys) String

func (k Keys) String() string

type LocalSyncCache

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

func (*LocalSyncCache) GetSync

func (l *LocalSyncCache) GetSync(_ context.Context, currentTime time.Time) (map[TargetGroupARN]string, error)

func (*LocalSyncCache) StoreSync

func (l *LocalSyncCache) StoreSync(_ context.Context, toStore map[TargetGroupARN]string, expireAt time.Time) error

type State

type State struct {
	Targets []Target
	Version int
}

type Storage

type Storage interface {
	// GetStates returns a state result for each state key
	GetStates(ctx context.Context, syncPairs []Keys) (map[Keys]State, error)
	// Store results for all the state keys
	Store(ctx context.Context, toStore map[Keys]State) error
}

type SyncCache

type SyncCache interface {
	StoreSync(ctx context.Context, toStore map[TargetGroupARN]string, expireAt time.Time) error
	GetSync(ctx context.Context, currentTime time.Time) (map[TargetGroupARN]string, error)
}

type SyncFinder

type SyncFinder interface {
	// Get the list of target groups -> hostname we should sync
	ToSync(ctx context.Context) (map[TargetGroupARN]string, error)
}

type TagSyncFinder

type TagSyncFinder struct {
	Client *resourcegroupstaggingapi.ResourceGroupsTaggingAPI
	TagKey string
	Log    *zapctx.Logger
}

func (*TagSyncFinder) ToSync

func (t *TagSyncFinder) ToSync(ctx context.Context) (map[TargetGroupARN]string, error)

type Target

type Target struct {
	IP           string
	TimesMissing int
}

type TargetGroupARN

type TargetGroupARN string

Jump to

Keyboard shortcuts

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