Help us shape the future of Go! Take the 2026 Go Developer Survey

ledger

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECSClient

type ECSClient interface {
	ecsiface.ECSAPI
}

type EcsMetadata

type EcsMetadata struct {
	ContainerInstanceArn string
	Cluster              string
}

type FakeTicker

type FakeTicker struct {
	Ticker *time.Ticker
	// contains filtered or unexported fields
}

FakeTicker allows us to manually control when a send happens on the channel. The Ticker property allows us to adhere to the *time.Ticker interface.

func NewFakeTicker

func NewFakeTicker() *FakeTicker

func (*FakeTicker) Stop

func (f *FakeTicker) Stop()

func (*FakeTicker) Tick

func (f *FakeTicker) Tick(ctx context.Context)

type HealthConfig

type HealthConfig struct {
	DisableECSBehavior      bool          // whether or not to disable container instance attributing
	MaxHealthyLatency       time.Duration // the max latency which is considered healthy
	AttributeName           string        // the attribute name to indicate ledger latency health
	HealthyAttributeValue   string        // if ledger latency is healthy use this attribute value
	UnhealthyAttributeValue string        // if ledger latency is unhealthy use this attribute value
	PollInterval            time.Duration // how often to check for ledger latency
	AWSRegion               string        // which region to use for setting instance atts
}

HealthConfig configures the behavior of the container instance attribute setting. Ledger latency health will be reflected in container instance attributes.

type Monitor

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

Monitor is the main type which performs the ledger health monitoring.

func NewLedgerMonitor

func NewLedgerMonitor(cfg HealthConfig, llf latencyFunc, opts ...MonitorOpt) (*Monitor, error)

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context)

type MonitorOpt

type MonitorOpt func(monitor *Monitor)

func WithCheckCallback

func WithCheckCallback(fn func()) MonitorOpt

func WithECSClient

func WithECSClient(ecsClient ECSClient) MonitorOpt

func WithECSMetadataFunc

func WithECSMetadataFunc(fn ecsMetadataFunc) MonitorOpt

func WithTicker

func WithTicker(ticker *time.Ticker) MonitorOpt

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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