gofer

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(
	origin string,
	wp query.WorkerPool,
	cli pkgEthereum.Client,
	baseURL string,
	params yaml.Node,
) (origins.Handler, error)

Types

type ErrCyclicReference

type ErrCyclicReference struct {
	Pair provider.Pair
	Path []nodes.Node
}

func (ErrCyclicReference) Error

func (e ErrCyclicReference) Error() string

type Gofer

type Gofer struct {
	RPC           RPC                   `yaml:"rpc"` // Old configuration format, to remove in the future.
	RPCListenAddr string                `yaml:"rpcListenAddr"`
	RPCAgentAddr  string                `yaml:"rpcAgentAddr"`
	Origins       map[string]Origin     `yaml:"origins"`
	PriceModels   map[string]PriceModel `yaml:"priceModels"`
}

func (*Gofer) ConfigureAsyncGofer

func (c *Gofer) ConfigureAsyncGofer(cli ethereum.Client, logger log.Logger) (provider.Provider, error)

ConfigureAsyncGofer returns a new async gofer instance.

func (*Gofer) ConfigureGofer

func (c *Gofer) ConfigureGofer(cli ethereum.Client, logger log.Logger, noRPC bool) (provider.Provider, error)

ConfigureGofer returns a new async gofer instance.

func (*Gofer) ConfigurePriceHook

func (c *Gofer) ConfigurePriceHook(ctx context.Context, cli ethereum.Client) (provider.PriceHook, error)

func (*Gofer) ConfigureRPCAgent

func (c *Gofer) ConfigureRPCAgent(cli ethereum.Client, gof provider.Provider, logger log.Logger) (*rpc.Agent, error)

ConfigureRPCAgent returns a new rpc.Agent instance.

type MedianPriceModel

type MedianPriceModel struct {
	MinSourceSuccess int                    `yaml:"minimumSuccessfulSources"`
	PostPriceHook    map[string]interface{} `yaml:"postPriceHook"`
}

type Origin

type Origin struct {
	Type   string    `yaml:"type"`
	URL    string    `yaml:"url"` // TODO: Move it to the params field.
	Params yaml.Node `yaml:"params"`
}

type PriceModel

type PriceModel struct {
	Method  string     `yaml:"method"`
	Sources [][]Source `yaml:"sources"`
	Params  yaml.Node  `yaml:"params"`
	TTL     int        `yaml:"ttl"`
}

type RPC

type RPC struct {
	Address string `yaml:"address"`
}

type Source

type Source struct {
	Origin string `yaml:"origin"`
	Pair   string `yaml:"pair"`
	TTL    int    `yaml:"ttl"`
}

Jump to

Keyboard shortcuts

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