rpc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AgentLoggerTag = "GOFER_AGENT"

Variables

This section is empty.

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 Gofer calls.

func NewAgent

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

NewAgent returns a new Agent instance.

func (*Agent) Start

func (s *Agent) Start() error

Start starts the RPC server.

func (*Agent) Stop

func (s *Agent) Stop()

Stop stops the RPC server.

type AgentConfig

type AgentConfig struct {
	// Gofer instance which will be used by the agent. If this instance
	// implements the gofer.StartableGofer interface, the Start and Stop
	// methods are called whenever corresponding Agent's Start and
	// Stop are called.
	Gofer gofer.Gofer
	// 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 []gofer.Pair
}

type FeedResp

type FeedResp struct {
	Warnings feeder.Warnings
}

type Gofer

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

Gofer implements the gofer.Gofer interface. It uses a remote RPC server to fetch prices and models.

func NewGofer

func NewGofer(network, address string) *Gofer

Agent returns a new Gofer instance.

func (*Gofer) Models

func (c *Gofer) Models(pairs ...gofer.Pair) (map[gofer.Pair]*gofer.Model, error)

Models implements the gofer.Gofer interface.

func (*Gofer) Pairs

func (c *Gofer) Pairs() ([]gofer.Pair, error)

Pairs implements the gofer.Gofer interface.

func (*Gofer) Price

func (c *Gofer) Price(pair gofer.Pair) (*gofer.Price, error)

Price implements the gofer.Gofer interface.

func (*Gofer) Prices

func (c *Gofer) Prices(pairs ...gofer.Pair) (map[gofer.Pair]*gofer.Price, error)

Prices implements the gofer.Gofer interface.

func (*Gofer) Start

func (c *Gofer) Start() error

Start implements the gofer.StartableGofer interface.

func (*Gofer) Stop

func (c *Gofer) Stop() error

Stop implements the gofer.StartableGofer interface.

type NodesArg

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

type NodesResp

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

type Nothing

type Nothing = struct{}

type PairsResp

type PairsResp struct {
	Pairs []gofer.Pair
}

type PricesArg

type PricesArg struct {
	Pairs []gofer.Pair
}

type PricesResp

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

Jump to

Keyboard shortcuts

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