Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App interface { // CommitHandler is called when Lachesis commits a block to the DAG. It returns // the state hash resulting from applying the block's transactions to the state. CommitHandler(block poset.Block) (stateHash []byte, err error) // SnapshotHandler is called by Lachesis to retrieve a snapshot // corresponding to a particular block. SnapshotHandler(blockIndex int64) (snapshot []byte, err error) // RestoreHandler is called by Lachesis to restore the application // to a specific state. RestoreHandler(snapshot []byte) (stateHash []byte, err error) }
App provides an interface for the application to set handlers for committing, retrieving and restoring state and transactions.
type AppProxy ¶
type AppProxy interface { // SubmitCh returns the channel of app transactions. SubmitCh() chan []byte // SubmitInternalCh returns the channel of stake transactions. SubmitInternalCh() chan inter.InternalTransaction CommitBlock(block poset.Block) ([]byte, error) GetSnapshot(blockIndex int64) ([]byte, error) Restore(snapshot []byte) error Close() }
AppProxy is an interface for lachesis to communicate with the application.
type Consensus ¶
type Consensus interface { StakeOf(peer hash.Peer) uint64 GetTransaction(hash.Transaction) *inter.InternalTransaction }
Consensus is a set of consensus handlers.
type CtrlProxy ¶
type CtrlProxy interface { // Set ... Set() // Close stops proxy. Close() }
CtrlProxy is a control proxy.
type LachesisProxy ¶
type LachesisProxy interface { CommitCh() chan proto.Commit SnapshotRequestCh() chan proto.SnapshotRequest RestoreCh() chan proto.RestoreRequest SubmitTx(tx []byte) error Close() }
LachesisProxy is an interface for application to communicate with the lachesis.
func NewGrpcLachesisProxy ¶
func NewGrpcLachesisProxy(addr string, logger *logrus.Logger, opts ...grpc.DialOption) (LachesisProxy, error)
NewGrpcLachesisProxy initiates a LachesisProxy-interface connected to remote lachesis node.
type Node ¶
type Node interface { GetID() hash.Peer AddInternalTxn(inter.InternalTransaction) (hash.Transaction, error) }
Node is a set of node handlers.
type NodeProxy ¶
type NodeProxy interface { // GetSelfID returns node id. GetSelfID() (hash.Peer, error) // StakeOf returns stake balance of peer. StakeOf(hash.Peer) (uint64, error) // SendTo makes stake transfer transaction. SendTo(receiver hash.Peer, index, amount, until uint64) (hash.Transaction, error) // GetTransaction returns information about transaction. GetTransaction(hash.Transaction) (*inter.InternalTransaction, error) // SetLogLevel sets logger log level. SetLogLevel(string) error // Close stops proxy. Close() }
NodeProxy is an interface for remote node controlling.
func NewGrpcNodeProxy ¶
func NewGrpcNodeProxy(addr string, logger *logrus.Logger, opts ...grpc.DialOption) (NodeProxy, error)
NewGrpcNodeProxy initiates a NodeProxy-interface connected to remote node.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.