mocks

package
v0.0.0-...-d687121 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

mocks package only contains mock interfaces for testing. Using "no_mocks" build tag to skip them in compiling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PipeTransport

func PipeTransport() (*MemoryTransport, *MemoryTransport)

PipeTransport returns two transport.Transport that when one side's .DialStream() is invoked, .AcceptStream() on the other Transport will receive the net.Conn

Types

type ChordClient

type ChordClient struct {
	mock.Mock
}

func (*ChordClient) Acquire

func (*ChordClient) Append

func (*ChordClient) Contains

func (*ChordClient) Delete

func (*ChordClient) FindSuccessor

func (*ChordClient) Get

func (*ChordClient) GetPredecessor

func (*ChordClient) GetSuccessors

func (*ChordClient) Identity

func (*ChordClient) Import

func (*ChordClient) List

func (*ChordClient) ListKeys

func (*ChordClient) Notify

func (*ChordClient) Ping

func (*ChordClient) Put

func (*ChordClient) RatePer

func (c *ChordClient) RatePer(interval time.Duration) float64

func (*ChordClient) Release

func (*ChordClient) Remove

func (*ChordClient) Renew

func (*ChordClient) RequestToJoin

func (*ChordClient) RequestToLeave

type Measurement

type Measurement struct {
	mock.Mock
}

func (*Measurement) Drop

func (m *Measurement) Drop(key string)

func (*Measurement) RecordLatency

func (m *Measurement) RecordLatency(key string, latency float64)

func (*Measurement) RecordLost

func (m *Measurement) RecordLost(key string)

func (*Measurement) RecordSent

func (m *Measurement) RecordSent(key string)

func (*Measurement) Snapshot

func (m *Measurement) Snapshot(key string, past time.Duration) *rtt.Statistics

type MemoryTransport

type MemoryTransport struct {
	Identify    *protocol.Node
	Other       chan *transport.StreamDelegate
	Self        chan *transport.StreamDelegate
	Certificate *x509.Certificate
	mock.Mock
}

func SelfTransport

func SelfTransport() *MemoryTransport

SelfTransport returns a transport.Transport that when .DialStream() is invoked, .AcceptStream() on the same Transport will receive the net.Conn

func (*MemoryTransport) AcceptStream

func (t *MemoryTransport) AcceptStream() <-chan *transport.StreamDelegate

func (*MemoryTransport) DialStream

func (t *MemoryTransport) DialStream(ctx context.Context, peer *protocol.Node, kind protocol.Stream_Type) (net.Conn, error)

func (*MemoryTransport) Identity

func (t *MemoryTransport) Identity() *protocol.Node

func (*MemoryTransport) ListConnected

func (t *MemoryTransport) ListConnected() []transport.ConnectedPeer

func (*MemoryTransport) ReceiveDatagram

func (t *MemoryTransport) ReceiveDatagram() <-chan *transport.DatagramDelegate

func (*MemoryTransport) SendDatagram

func (t *MemoryTransport) SendDatagram(_ *protocol.Node, _ []byte) error

func (*MemoryTransport) SupportDatagram

func (t *MemoryTransport) SupportDatagram() bool

func (*MemoryTransport) WithCertificate

func (t *MemoryTransport) WithCertificate(cert *x509.Certificate)

func (*MemoryTransport) WithClientCertificate

func (t *MemoryTransport) WithClientCertificate(cert tls.Certificate) error

type PKIClient

type PKIClient struct {
	mock.Mock
}

func (*PKIClient) RequestCertificate

type Resolver

type Resolver struct {
	mock.Mock
}

func (*Resolver) LookupCNAME

func (r *Resolver) LookupCNAME(ctx context.Context, host string) (string, error)

type Transport

type Transport struct {
	mock.Mock
}

func (*Transport) AcceptStream

func (t *Transport) AcceptStream() <-chan *transport.StreamDelegate

func (*Transport) DialStream

func (t *Transport) DialStream(ctx context.Context, peer *protocol.Node, kind protocol.Stream_Type) (net.Conn, error)

func (*Transport) Identity

func (t *Transport) Identity() *protocol.Node

func (*Transport) ListConnected

func (t *Transport) ListConnected() []transport.ConnectedPeer

func (*Transport) ReceiveDatagram

func (t *Transport) ReceiveDatagram() <-chan *transport.DatagramDelegate

func (*Transport) SendDatagram

func (t *Transport) SendDatagram(n *protocol.Node, b []byte) error

func (*Transport) SupportDatagram

func (t *Transport) SupportDatagram() bool

func (*Transport) TransportDestroyed

func (t *Transport) TransportDestroyed() <-chan *protocol.Node

func (*Transport) TransportEstablished

func (t *Transport) TransportEstablished() <-chan *protocol.Node

type TunnelServer

type TunnelServer struct {
	mock.Mock
}

func (*TunnelServer) DialClient

func (m *TunnelServer) DialClient(ctx context.Context, link *protocol.Link) (net.Conn, error)

func (*TunnelServer) DialInternal

func (m *TunnelServer) DialInternal(ctx context.Context, node *protocol.Node) (net.Conn, error)

func (*TunnelServer) Identity

func (m *TunnelServer) Identity() *protocol.Node

type TunnelService

type TunnelService struct {
	mock.Mock
}

func (*TunnelService) AcmeInstruction

func (*TunnelService) AcmeValidate

func (*TunnelService) GetNodes

func (*TunnelService) Ping

func (*TunnelService) PublishTunnel

func (*TunnelService) ReleaseTunnel

func (*TunnelService) UnpublishTunnel

type VNode

type VNode struct {
	mock.Mock
}

func (*VNode) Acquire

func (n *VNode) Acquire(ctx context.Context, lease []byte, ttl time.Duration) (token uint64, err error)

func (*VNode) Delete

func (n *VNode) Delete(ctx context.Context, key []byte) error

func (*VNode) FindSuccessor

func (n *VNode) FindSuccessor(key uint64) (chord.VNode, error)

func (*VNode) FinishJoin

func (n *VNode) FinishJoin(stabilize bool, release bool) error

func (*VNode) FinishLeave

func (n *VNode) FinishLeave(stabilize bool, release bool) error

func (*VNode) Get

func (n *VNode) Get(ctx context.Context, key []byte) (value []byte, err error)

func (*VNode) GetPredecessor

func (n *VNode) GetPredecessor() (chord.VNode, error)

func (*VNode) GetSuccessors

func (n *VNode) GetSuccessors() ([]chord.VNode, error)

func (*VNode) ID

func (n *VNode) ID() uint64

func (*VNode) Identity

func (n *VNode) Identity() *protocol.Node

func (*VNode) Import

func (n *VNode) Import(ctx context.Context, keys [][]byte, values []*protocol.KVTransfer) error

func (*VNode) ListKeys

func (n *VNode) ListKeys(ctx context.Context, prefix []byte) ([]*protocol.KeyComposite, error)

func (*VNode) Notify

func (n *VNode) Notify(predecessor chord.VNode) error

func (*VNode) Ping

func (n *VNode) Ping() error

func (*VNode) PrefixAppend

func (n *VNode) PrefixAppend(ctx context.Context, prefix []byte, child []byte) error

func (*VNode) PrefixContains

func (n *VNode) PrefixContains(ctx context.Context, prefix []byte, child []byte) (bool, error)

func (*VNode) PrefixList

func (n *VNode) PrefixList(ctx context.Context, prefix []byte) ([][]byte, error)

func (*VNode) PrefixRemove

func (n *VNode) PrefixRemove(ctx context.Context, prefix []byte, child []byte) error

func (*VNode) Put

func (n *VNode) Put(ctx context.Context, key []byte, value []byte) error

func (*VNode) Release

func (n *VNode) Release(ctx context.Context, lease []byte, token uint64) error

func (*VNode) Renew

func (n *VNode) Renew(ctx context.Context, lease []byte, ttl time.Duration, prevToken uint64) (newToken uint64, err error)

func (*VNode) RequestToJoin

func (n *VNode) RequestToJoin(joiner chord.VNode) (chord.VNode, []chord.VNode, error)

func (*VNode) RequestToLeave

func (n *VNode) RequestToLeave(leaver chord.VNode) error

Jump to

Keyboard shortcuts

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