rpc

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AgentLoggerTag = "PRICE_PROVIDER_AGENT"

Variables

View Source
var ErrNotStarted = errors.New("price provider RPC client is not started")

Functions

This section is empty.

Types

type API

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

func (*API) Models

func (n *API) Models(arg *NodesArg, resp *NodesResp) error

func (*API) Pairs

func (n *API) Pairs(_ *Nothing, resp *PairsResp) error

func (*API) Prices

func (n *API) Prices(arg *PricesArg, resp *PricesResp) error

type Agent

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

Agent creates and manages an RPC server for remote Provider calls.

func NewAgent

func NewAgent(cfg AgentConfig) (*Agent, error)

NewAgent returns a new Agent instance.

func (*Agent) Start

func (s *Agent) Start(ctx context.Context) error

Start starts the RPC server.

func (*Agent) Wait

func (s *Agent) Wait() chan error

Wait waits until the context is canceled or until an error occurs.

type AgentConfig

type AgentConfig struct {
	// Provider instance which will be used by the agent.
	Provider provider.Provider
	// Network is used for the rpc.Listener function.
	Network string
	// Address is used for the rpc.Listener function.
	Address string
	Logger  log.Logger
}

type FeedArg

type FeedArg struct {
	Pairs []provider.Pair
}

type FeedResp

type FeedResp struct {
	Warnings feeder.Warnings
}

type NodesArg

type NodesArg struct {
	Format marshal.FormatType
	Pairs  []provider.Pair
}

type NodesResp

type NodesResp struct {
	Pairs map[provider.Pair]*provider.Model
}

type Nothing

type Nothing = struct{}

type PairsResp

type PairsResp struct {
	Pairs []provider.Pair
}

type PricesArg

type PricesArg struct {
	Pairs []provider.Pair
}

type PricesResp

type PricesResp struct {
	Prices map[provider.Pair]*provider.Price
}

type Provider

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

Provider implements the provider.Provider interface. It uses a remote RPC server to fetch prices and models.

func NewProvider

func NewProvider(network, address string) (*Provider, error)

NewProvider returns a new Provider instance.

func (*Provider) Models

func (g *Provider) Models(pairs ...provider.Pair) (map[provider.Pair]*provider.Model, error)

Models implements the provider.Provider interface.

func (*Provider) Pairs

func (g *Provider) Pairs() ([]provider.Pair, error)

Pairs implements the provider.Provider interface.

func (*Provider) Price

func (g *Provider) Price(pair provider.Pair) (*provider.Price, error)

Price implements the provider.Provider interface.

func (*Provider) Prices

func (g *Provider) Prices(pairs ...provider.Pair) (map[provider.Pair]*provider.Price, error)

Prices implements the provider.Provider interface.

func (*Provider) Start

func (g *Provider) Start(ctx context.Context) error

Start implements the supervisor.Service interface.

func (*Provider) Wait

func (g *Provider) Wait() chan error

Wait implements the supervisor.Service interface.

Jump to

Keyboard shortcuts

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