peer

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package peer is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidTopic error returned when the requested topic is not valid.
	ErrInvalidTopic = errors.New("topic not valid")

	// ErrInvalidRange error returned when max-min range is not valid.
	ErrInvalidRange = errors.New("invalid range, Min should be lower or equal to Max")

	// ErrDiscovererNotProvided error when discoverer is not being provided.
	ErrDiscovererNotProvided = errors.New("discoverer not provided")
)

Functions

This section is empty.

Types

type DiscoverRequest

type DiscoverRequest struct {
	Topic string `json:"topic"`
	Max   int    `json:"max"`
	Min   int    `json:"min"`
}

DiscoverRequest json request for peer_discover.

type Discoverer

type Discoverer interface {
	Discover(topic string, max, min int) error
}

Discoverer manages peer discovery.

type MockDiscoverer

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

MockDiscoverer is a mock of Discoverer interface

func NewMockDiscoverer

func NewMockDiscoverer(ctrl *gomock.Controller) *MockDiscoverer

NewMockDiscoverer creates a new mock instance

func (*MockDiscoverer) Discover

func (m *MockDiscoverer) Discover(topic string, max, min int) error

Discover mocks base method

func (*MockDiscoverer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

type MockDiscovererMockRecorder

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

MockDiscovererMockRecorder is the mock recorder for MockDiscoverer

func (*MockDiscovererMockRecorder) Discover

func (mr *MockDiscovererMockRecorder) Discover(topic, max, min interface{}) *gomock.Call

Discover indicates an expected call of Discover

type PublicAPI

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

PublicAPI represents a set of APIs from the `web3.peer` namespace.

func NewAPI

func NewAPI(s *Service) *PublicAPI

NewAPI creates an instance of the peer API.

func (*PublicAPI) Discover

func (api *PublicAPI) Discover(context context.Context, req DiscoverRequest) (err error)

Discover is an implementation of `peer_discover` or `web3.peer.discover` API.

type Service

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

Service it manages all endpoints for peer operations.

func New

func New() *Service

New returns a new Service.

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs returns a list of new APIs.

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns a new protocols list. In this case, there are none.

func (*Service) SetDiscoverer

func (s *Service) SetDiscoverer(d Discoverer)

SetDiscoverer sets discoverer for the API calls.

func (*Service) Start

func (s *Service) Start(server *p2p.Server) error

Start is run when a service is started. It does nothing in this case but is required by `node.Service` interface.

func (*Service) Stop

func (s *Service) Stop() error

Stop is run when a service is stopped. It does nothing in this case but is required by `node.Service` interface.

Jump to

Keyboard shortcuts

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