interfaces

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootNodeServer

type BootNodeServer interface {
	pb.BootNodeServer
}

BootNodeServer implements the Discovery server service from the protobuf definition.

type DiscoveryClient

type DiscoveryClient interface {
	Close() error
	NodeAddr() NodeAddr
	pb.DiscoveryClient
}

DiscoveryClient implements the Discovery client service from the protobuf definition.

type DiscoveryServer

type DiscoveryServer interface {
	pb.DiscoveryServer
}

DiscoveryServer implements the Discovery server service from the protobuf definition.

type KeyResolver

type KeyResolver interface {
	GetKey(kid []byte) ([]byte, error)
}

KeyResolver allows a service to request a key from an object conforming to the interface. This is used to decrypt objects stored in the Database

type Lockable

type Lockable interface {
	Lock()
	Unlock()
}

Lockable allows a mutex to be shared by interface

type NodeAddr

type NodeAddr interface {
	net.Addr
	Identity() string
	P2PAddr() string
	ChainID() types.ChainIdentifier
	Host() string
	Port() int
}

The NodeAddr interface implements net.Addr and other functionality needed for the identification of peer to peer clients. NodeAddr implements and extends the net.addr interface.

type P2PClient

type P2PClient interface {
	Close() error
	NodeAddr() NodeAddr
	CloseChan() <-chan struct{}
	pb.P2PClient
}

P2PClient implements the P2P client service from the protobuf definition and extends it for connection management.

type P2PClientRaw

type P2PClientRaw interface {
	pb.P2PClient
}

P2PClientRaw implements the P2P client service from the protobuf definition.

type P2PConn

type P2PConn interface {
	net.Conn
	Initiator() types.P2PInitiator
	NodeAddr() NodeAddr
	Protocol() types.Protocol
	ProtoVersion() types.ProtoVersion
	CloseChan() <-chan struct{}
}

P2PConn is the connection interface for the transport. This interface implements the net.Conn interface and extends the interface to allow introspection of the remote node identity as well as if this connection is a locally created connection through dial or if this connection is a remote initiated connection where the remote peer dialed the local node.

type P2PMux

type P2PMux interface {
	HandleConnection(context.Context, P2PConn) (P2PMuxConn, error)
}

P2PMux handles the handshake protocol of the multiplexing protocol.

type P2PMuxConn

type P2PMuxConn interface {
	Initiator() types.P2PInitiator
	ClientConn() P2PConn
	ServerConn() P2PConn
	NodeAddr() NodeAddr
	CloseChan() <-chan struct{}
	Close() error
}

P2PMuxConn is a multiplexed P2PConn as is returned by the P2PMuxTransport.

type P2PServer

type P2PServer interface {
	pb.P2PServer
}

P2PServer implements the P2P server service from the protobuf definition.

type P2PTransport

type P2PTransport interface {
	NodeAddr() NodeAddr
	Accept() (P2PConn, error)
	Dial(NodeAddr, types.Protocol) (P2PConn, error)
	Close() error
}

P2PTransport is the interface that defines what the peer to peer transport object must conform to. This interface allows failed remote connections to be returned through the AcceptFailures() method. See ConnFailure interface for more information. The Accept() method will return new incoming connections from remote peers that have completed the initial handshake. The Dial() method allows remote peers to be connected to, by the local node.

type Peer

type Peer interface {
	NodeAddr() NodeAddr
	CloseChan() <-chan struct{}
	Do(func(PeerLease) error)
	P2PClient() (P2PClient, error)
	PreventGossipConsensus([]byte)
	PreventGossipTx([]byte)
}

Peer is an element of the peer tree. This interface allows inspection of both the peer and the peer meta data.

type PeerLease

type PeerLease interface {
	P2PClient() (P2PClient, error)
	Do(func(PeerLease) error)
}

PeerLease allows a service to obtain a Peer for sending data via closures

type PeerSubscription

type PeerSubscription interface {
	CloseChan() <-chan struct{}
	PeerLease(ctx context.Context) (PeerLease, error)
	RequestLease(ctx context.Context, hsh []byte) (PeerLease, error)
	PreventGossipTx(addr NodeAddr, hsh []byte)
	PreventGossipConsensus(addr NodeAddr, hsh []byte)
	GossipConsensus(hsh []byte, fn func(context.Context, PeerLease) error)
	GossipTx(hsh []byte, fn func(context.Context, PeerLease) error)
}

PeerSubscription allows a service to maintain an in sync copy of all active peers for the purpose of requesting data or tracking sent/rcvd msgs

type RPCListener

type RPCListener interface {
	net.Listener
	NewConnection(P2PConn) error
}

RPCListener binds a P2PConn to a grpc server through connection injection. To inject a connection into the grpc server, you may pass the connection to NewConnection. This will make the connection available on the Accept method of the listener, which is intended to be consumed by the grpc.Server.Serve loop.

type StateServer

type StateServer interface {
	pb.LocalStateServer
}

StateServer implements the State server service from the protobuf definition.

type Transaction

type Transaction interface {
	TxHash() ([]byte, error)
	MarshalBinary() ([]byte, error)
	XXXIsTx()
}

Transaction is the minimum interface a transaction must meet for the consensus algorithm to work.

Jump to

Keyboard shortcuts

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