rpc

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AgentLoggerTag = "GOFER_AGENT"

Variables

View Source
var ErrNotStarted = errors.New("gofer 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 Gofer calls.

func NewAgent

func NewAgent(ctx context.Context, 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) Wait added in v0.2.0

func (s *Agent) Wait()

Wait waits until agent's context is cancelled.

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(ctx context.Context, network, address string) (*Gofer, error)

NewGofer returns a new Gofer instance.

func (*Gofer) Models

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

Models implements the gofer.Gofer interface.

func (*Gofer) Pairs

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

Pairs implements the gofer.Gofer interface.

func (*Gofer) Price

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

Price implements the gofer.Gofer interface.

func (*Gofer) Prices

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

Prices implements the gofer.Gofer interface.

func (*Gofer) Start

func (g *Gofer) Start() error

Start implements the gofer.StartableGofer interface.

func (*Gofer) Wait added in v0.2.0

func (g *Gofer) Wait()

Wait 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