discovery

package
v2.11.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package discovery is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

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

func New

func New(peerKey ed25519.PrivateKey, node *vnode.Node, bootNodes, bootSeeds []string, listenAddress string, db NodeDB) *Discovery

New create a Discovery implementation

func (*Discovery) Delete

func (d *Discovery) Delete(id vnode.NodeID, reason error)

func (*Discovery) GetNodes

func (d *Discovery) GetNodes(count int) (nodes []*vnode.Node)

func (*Discovery) Nodes

func (d *Discovery) Nodes() []*vnode.Node

func (*Discovery) NodesCount

func (d *Discovery) NodesCount() int

func (*Discovery) SetFinder

func (d *Discovery) SetFinder(f Finder)

func (*Discovery) Start

func (d *Discovery) Start() (err error)

func (*Discovery) Stop

func (d *Discovery) Stop() (err error)

func (*Discovery) SubscribeNode

func (d *Discovery) SubscribeNode(receiver func(n *vnode.Node)) (subId int)

func (*Discovery) Unsubscribe

func (d *Discovery) Unsubscribe(subId int)

type Finder

type Finder interface {
	Observer
	SetResolver(discv interface {
		GetNodes(count int) (nodes []*vnode.Node)
	})
	FindNeighbors(fromId, target vnode.NodeID, count int) []*vnode.EndPoint
}

type Mockreceiver added in v2.11.3

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

Mockreceiver is a mock of receiver interface.

func NewMockreceiver added in v2.11.3

func NewMockreceiver(ctrl *gomock.Controller) *Mockreceiver

NewMockreceiver creates a new mock instance.

func (*Mockreceiver) EXPECT added in v2.11.3

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

type MockreceiverMockRecorder added in v2.11.3

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

MockreceiverMockRecorder is the mock recorder for Mockreceiver.

type Mocksender added in v2.11.3

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

Mocksender is a mock of sender interface.

func NewMocksender added in v2.11.3

func NewMocksender(ctrl *gomock.Controller) *Mocksender

NewMocksender creates a new mock instance.

func (*Mocksender) EXPECT added in v2.11.3

func (m *Mocksender) EXPECT() *MocksenderMockRecorder

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

type MocksenderMockRecorder added in v2.11.3

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

MocksenderMockRecorder is the mock recorder for Mocksender.

type Mocksocket added in v2.11.3

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

Mocksocket is a mock of socket interface.

func NewMocksocket added in v2.11.3

func NewMocksocket(ctrl *gomock.Controller) *Mocksocket

NewMocksocket creates a new mock instance.

func (*Mocksocket) EXPECT added in v2.11.3

func (m *Mocksocket) EXPECT() *MocksocketMockRecorder

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

type MocksocketMockRecorder added in v2.11.3

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

MocksocketMockRecorder is the mock recorder for Mocksocket.

type Node

type Node struct {
	vnode.Node
	// contains filtered or unexported fields
}

type NodeDB

type NodeDB interface {
	StoreNode(node *vnode.Node) (err error)
	RemoveNode(id vnode.NodeID)
	ReadNodes(expiration int64) []*vnode.Node
	RetrieveActiveAt(id vnode.NodeID) int64
	StoreActiveAt(id vnode.NodeID, v int64)
	RetrieveCheckAt(id vnode.NodeID) int64
	StoreCheckAt(id vnode.NodeID, v int64)
	Close() error
	Clean(expiration int64)
}

type Observer

type Observer interface {
	Sub(sub Subscriber)
	UnSub(sub Subscriber)
}

type Request

type Request struct {
	Node  *vnode.Node `json:"node"`
	Count int         `json:"count"`
}

type Result

type Result struct {
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Data    []string `json:"data"`
}

type Subscriber

type Subscriber interface {
	// Sub return the unique id
	Sub(receiver func(n *vnode.Node)) (subId int)
	// UnSub received the id returned by Sub
	UnSub(subId int)
}

Subscriber can be subscribed by observer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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