routing

package
v0.7.0-beta Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RouteAccount added in v0.5.1

func RouteAccount(net *config.Network, account *url.URL) (string, error)

func RouteEnvelopes added in v0.5.1

func RouteEnvelopes(routeAccount func(*url.URL) (string, error), envs ...*protocol.Envelope) (string, error)

Types

type ResponseSubmit

type ResponseSubmit struct {
	Code         uint32
	Data         []byte
	Log          string
	Info         string
	Codespace    string
	MempoolError string
}

ResponseSubmit is the response from a call to Submit.

type Router

type Router interface {
	RouteAccount(*url.URL) (string, error)
	Route(...*protocol.Envelope) (string, error)
	Query(ctx context.Context, subnet string, query []byte, opts client.ABCIQueryOptions) (*core.ResultABCIQuery, error)
	RequestAPIv2(ctx context.Context, subnetId, method string, params, result interface{}) error
	Submit(ctx context.Context, subnet string, tx *protocol.Envelope, pretend, async bool) (*ResponseSubmit, error)
}

Router defines a basic interface for routing and sending transactions.

TODO Route and Send should probably be handled separately.

type RouterInstance

type RouterInstance struct {
	*config.Network
	ConnectionManager connections.ConnectionManager
}

RouterInstance sends transactions to remote nodes via RPC calls.

func (*RouterInstance) Query

func (r *RouterInstance) Query(ctx context.Context, subnetId string, query []byte, opts client.ABCIQueryOptions) (*core.ResultABCIQuery, error)

Query queries the specified subnet. If the subnet matches this network's ID, the transaction is broadcasted via the local client. Otherwise the transaction is broadcasted via an RPC client.

func (*RouterInstance) RequestAPIv2 added in v1.0.0

func (r *RouterInstance) RequestAPIv2(ctx context.Context, subnetId, method string, params, result interface{}) error

func (*RouterInstance) Route

func (r *RouterInstance) Route(envs ...*protocol.Envelope) (string, error)

Route routes the account using modulo routing.

func (*RouterInstance) RouteAccount added in v0.5.1

func (r *RouterInstance) RouteAccount(account *url.URL) (string, error)

func (*RouterInstance) Submit

func (r *RouterInstance) Submit(ctx context.Context, subnetId string, tx *protocol.Envelope, pretend, async bool) (*ResponseSubmit, error)

Submit submits the transaction to the specified subnet. If the subnet matches this network's ID, the transaction is broadcasted via the local client. Otherwise the transaction is broadcasted via an RPC client.

Jump to

Keyboard shortcuts

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