rpcbroadcaster

package
v0.107.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCBroadcaster

type RPCBroadcaster struct {
	Clients   map[string]*RPCClient
	Log       *zap.Logger
	Responses chan []any
	// contains filtered or unexported fields
}

RPCBroadcaster represents a generic RPC broadcaster.

func NewRPCBroadcaster

func NewRPCBroadcaster(log *zap.Logger, sendTimeout time.Duration) *RPCBroadcaster

NewRPCBroadcaster returns a new RPC broadcaster instance.

func (*RPCBroadcaster) NewRPCClient

func (r *RPCBroadcaster) NewRPCClient(addr string, method SendMethod, timeout time.Duration, ch chan []any) *RPCClient

NewRPCClient returns a new rpc client for the provided address and method.

func (*RPCBroadcaster) Run

func (r *RPCBroadcaster) Run()

Run implements oracle.Broadcaster.

func (*RPCBroadcaster) SendParams added in v0.99.1

func (r *RPCBroadcaster) SendParams(params []any)

SendParams sends a request using all clients if the broadcaster is active.

func (*RPCBroadcaster) Shutdown

func (r *RPCBroadcaster) Shutdown()

Shutdown implements oracle.Broadcaster. The same instance can't be Run again after the shutdown.

type RPCClient

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

RPCClient represent an rpc client for a single node.

type SendMethod

type SendMethod func(*rpcclient.Client, []any) error

SendMethod represents an rpc method for sending data to other nodes.

Jump to

Keyboard shortcuts

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