Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application interface { // UnmarshalTx allows a transaction to be unmarshalled into a transaction // interface for use by the consensus algorithm UnmarshalTx(txb []byte) (Transaction, error) // IsValid returns true if the list of transactions is a valid transformation // and false if the list is not valid. If an error is returned, it indicates // a low level failure that should stop the main loop. IsValid(txn *badger.Txn, chainID, height uint32, stateHash []byte, tx []Transaction) (bool, error) // GetValidProposal is a function that returns a list of transactions // that will cause a valid state transition function for the local node's // current state. This is the function used to create a new proposal. // comes from application logic GetValidProposal(txn *badger.Txn, chainID, height, maxBytes uint32) ([]Transaction, []byte, error) // ApplyState is a function that returns a list of transactions // that will cause a valid state transition function for the local node's // current state. This is the function used to create a new proposal. // comes from application logic ApplyState(txn *badger.Txn, chainID, height uint32, txs []Transaction) (stateHash []byte, err error) // PendingTxAdd adds a transaction to the txPool and cleans up any stale // tx as a result. PendingTxAdd(txn *badger.Txn, chainID, height uint32, txs []Transaction) error // MinedTxGet returns a list of mined transactions and a list of missing // transaction hashes for mined transactions MinedTxGet(txn *badger.Txn, txHash [][]byte) ([]Transaction, [][]byte, error) // PendingTxGet returns a list of transactions and a list of missing // transaction hashes from the pending transaction pool PendingTxGet(txn *badger.Txn, height uint32, txHashes [][]byte) ([]Transaction, [][]byte, error) // PendingTxContains returns a list of missing transaction hashes // from the pending tx pool PendingTxContains(txn *badger.Txn, height uint32, txHashes [][]byte) ([][]byte, error) // StoreSnapShotNodes stores a snapshot node into the state trie of the application StoreSnapShotNode(txn *badger.Txn, batch, root []byte, layer int) ([][]byte, int, []trie.LeafNode, error) // GetSnapShotNode returns a snapshot node from the state trie to a peer GetSnapShotNode(txn *badger.Txn, height uint32, key []byte) ([]byte, error) // StoreSnapShotStateData stores a snapshot state element to the database StoreSnapShotStateData(txn *badger.Txn, key, value, data []byte) error // GetSnapShotStateData retrieves value corresponding to key from the State Data GetSnapShotStateData(txn *badger.Txn, key []byte) ([]byte, error) // FinalizeSnapShotRoot validates snapshot root and corresponding state FinalizeSnapShotRoot(txn *badger.Txn, root []byte, height uint32) error // BeginSnapShotSync deletes the entries of the database in preparation // for fast synchronization BeginSnapShotSync(txn *badger.Txn) error // FinalizeSync performs any final logic needed to terminate a fast sync FinalizeSync(txn *badger.Txn) error }
Application ...
type BootNodeServer ¶
type BootNodeServer interface { pb.BootNodeServer }
BootNodeServer implements the Discovery server service from the protobuf definition.
type KeyResolver ¶
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 ¶
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 P2PDiscoveryClient ¶
type P2PDiscoveryClient interface { Close() error NodeAddr() NodeAddr pb.P2PDiscoveryClient }
P2PDiscoveryClient implements the Discovery client service from the protobuf definition.
type P2PDiscoveryServer ¶
type P2PDiscoveryServer interface { pb.P2PDiscoveryServer }
P2PDiscoveryServer implements the Discovery server service from the protobuf definition.
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 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{} P2PClient() (P2PClient, error) }
Peer is an element of the peer tree. This interface allows inspection of both the peer and the peer meta state.
type RPCListener ¶
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.