dispatcher

package
v0.0.0-...-1bfa4a9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger logrus.FieldLogger, timeout time.Duration, multiStore store.MultiAddrStore, opts phi.Options) phi.Task

New constructs a new `Dispatcher`.

Types

type Dispatcher

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

A Dispatcher is a task that is responsible for taking a request, sending it to a subset of the darknodes, waiting for the corresponding results, and the finally aggregating the results into a single result to be returned to the client of the lightnode. The addresses of known darknodes are stored in a store that is shared by the `Updater`, which will periodically update the store so that the addresses of the known darkndoes are kept up to date.

func (*Dispatcher) Handle

func (dispatcher *Dispatcher) Handle(_ phi.Task, message phi.Message)

Handle implements the `phi.Handler` interface.

type Iterator

type Iterator interface {
	Collect(id interface{}, cancel context.CancelFunc, responses <-chan jsonrpc.Response) jsonrpc.Response
}

Iterator reads response from the given channel, collects response and combines them to a single response depending on different strategies. It tries to cancel the ctx when it has the response.

func NewFirstResponseIterator

func NewFirstResponseIterator() Iterator

NewFirstResponseIterator creates a new firstResponseIterator.

func NewMajorityResponseIterator

func NewMajorityResponseIterator(logger logrus.FieldLogger) Iterator

NewMajorityResponseIterator returns a new majorityResponseIterator.

Jump to

Keyboard shortcuts

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