feeder

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "FEEDER"

Variables

This section is empty.

Functions

This section is empty.

Types

type Feedable

type Feedable interface {
	nodes.Node
	// OriginPair returns the origin and pair which are acceptable for
	// this Node.
	OriginPair() nodes.OriginPair
	// Ingest sets the Price for this Node. It may return error if
	// the OriginPrice contains incompatible origin or pair.
	Ingest(price nodes.OriginPrice) error
	// MinTTL is the amount of time during which the Price shouldn't be updated.
	MinTTL() time.Duration
	// MaxTTL is the maximum amount of time during which the Price can be used.
	// After that time, the Price method will return a OriginPrice with
	// a ErrPriceTTLExpired error.
	MaxTTL() time.Duration
	// Expired returns true if the Price is expired. This is based on the MaxTTL
	// value.
	Expired() bool
	// Price returns the Price assigned in the Ingest method. If the Price is
	// expired then a ErrPriceTTLExpired error will be set in
	// the OriginPrice.Error field.
	Price() nodes.OriginPrice
}

type Feeder

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

Feeder sets prices from origins to the Feedable nodes.

func NewFeeder

func NewFeeder(set *origins.Set, log log.Logger) *Feeder

NewFeeder creates new Feeder instance.

func (*Feeder) Feed

func (f *Feeder) Feed(ns []nodes.Node, t time.Time) Warnings

Feed sets Prices to Feedable nodes. This method takes list of root nodes and sets prices to all of their children that implement the Feedable interface. The t parameter represents the time against which the price expiration is compared.

type Warnings

type Warnings struct {
	List []error
}

Warnings contains a list of minor errors which occurred during fetching prices.

func (Warnings) ToError

func (w Warnings) ToError() error

Jump to

Keyboard shortcuts

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