mock

package
v1.17.6-rc3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrTuple

type AddrTuple struct {
	Addr swarm.Address // the peer address
	PO   uint8         // the po
}

type Mock

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

func NewMockKademlia

func NewMockKademlia(o ...Option) *Mock

func (*Mock) AddPeers

func (m *Mock) AddPeers(addr ...swarm.Address)

AddPeers is called when a peers are added to the topology backlog for further processing by connectivity strategy.

func (*Mock) AddRevPeers added in v1.17.4

func (m *Mock) AddRevPeers(addrs ...AddrTuple)

func (*Mock) Announce added in v1.0.0

func (m *Mock) Announce(_ context.Context, _ swarm.Address, _ bool) error

func (*Mock) AnnounceTo added in v1.1.0

func (m *Mock) AnnounceTo(_ context.Context, _, _ swarm.Address, _ bool) error

func (*Mock) Close

func (m *Mock) Close() error

func (*Mock) ClosestPeer

func (m *Mock) ClosestPeer(addr swarm.Address, _ bool, _ topology.Select, skipPeers ...swarm.Address) (peerAddr swarm.Address, err error)

func (*Mock) Connected

func (m *Mock) Connected(_ context.Context, peer p2p.Peer, _ bool) error

Connected is called when a peer dials in.

func (*Mock) Disconnected

func (m *Mock) Disconnected(peer p2p.Peer)

Disconnected is called when a peer disconnects.

func (*Mock) EachConnectedPeer added in v1.14.0

func (m *Mock) EachConnectedPeer(f topology.EachPeerFunc, _ topology.Select) error

EachConnectedPeer iterates from closest bin to farthest

func (*Mock) EachConnectedPeerRev added in v1.14.0

func (m *Mock) EachConnectedPeerRev(f topology.EachPeerFunc, _ topology.Select) error

EachPeerRev iterates from farthest bin to closest

func (*Mock) EachNeighbor

func (m *Mock) EachNeighbor(topology.EachPeerFunc) error

func (*Mock) EachNeighborRev

func (m *Mock) EachNeighborRev(topology.EachPeerFunc) error

func (*Mock) Halt added in v0.6.2

func (d *Mock) Halt()

func (*Mock) IsReachable added in v1.15.0

func (m *Mock) IsReachable() bool

func (*Mock) NeighborhoodDepth

func (m *Mock) NeighborhoodDepth() uint8

func (*Mock) ResetPeers

func (m *Mock) ResetPeers()

func (*Mock) SetStorageRadius added in v1.17.0

func (m *Mock) SetStorageRadius(uint8)

PeerIterator iterates from closest bin to farthest

func (*Mock) Snapshot

func (m *Mock) Snapshot() *topology.KadParams

func (*Mock) SubscribeTopologyChange added in v1.8.0

func (m *Mock) SubscribeTopologyChange() (c <-chan struct{}, unsubscribe func())

func (*Mock) Trigger

func (m *Mock) Trigger()

func (*Mock) UpdatePeerHealth added in v1.16.0

func (m *Mock) UpdatePeerHealth(swarm.Address, bool, time.Duration)

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithDepth

func WithDepth(d uint8) Option

func WithDepthCalls

func WithDepthCalls(d ...uint8) Option

func WithEachPeerRevCalls

func WithEachPeerRevCalls(addrs ...AddrTuple) Option

Jump to

Keyboard shortcuts

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