Documentation ¶
Index ¶
- func ErrMsg(str string) error
- type ConnManager
- func (s *ConnManager) AddConnectToSlave(info *rpc.SlaveInfo) bool
- func (s *ConnManager) AddXshardTxList(fullShardId uint32, xshardReq *rpc.AddXshardTxListRequest) error
- func (s *ConnManager) BatchAddXshardTxList(fullShardId uint32, xshardReqs []*rpc.AddXshardTxListRequest) error
- func (s *ConnManager) BatchBroadcastXshardTxList(blokHshToXLstAdPrvRotHg map[common.Hash]*shard.XshardListTuple, ...) error
- func (s *ConnManager) BroadcastMinorBlock(minorBlock *types.MinorBlock, branch uint32) error
- func (s *ConnManager) BroadcastNewTip(mHeaderLst []*types.MinorBlockHeader, rHeader *types.RootBlockHeader, ...) error
- func (s *ConnManager) BroadcastTransactions(txs []*types.Transaction, branch uint32) error
- func (s *ConnManager) BroadcastXshardTxList(block *types.MinorBlock, xshardTxList []*types.CrossShardTransactionDeposit, ...) error
- func (s *ConnManager) GetConnectionsByFullShardId(id uint32) []*SlaveConn
- func (s *ConnManager) GetMinorBlockHeaders(gReq *rpc.GetMinorBlockHeaderListRequest) ([]*types.MinorBlockHeader, error)
- func (s *ConnManager) GetMinorBlocks(mHeaderList []common.Hash, peerId string, branch uint32) ([]*types.MinorBlock, error)
- func (s *ConnManager) ModifyTarget(target string)
- func (s *ConnManager) SendMinorBlockHeaderToMaster(minorHeader *types.MinorBlockHeader, txCount, xshardCount uint32, ...) error
- type SlaveBackend
- func (s *SlaveBackend) APIs() []rpc.API
- func (s *SlaveBackend) AddBlockListForSync(mHashList []common.Hash, peerId string, branch uint32) (*rpc.ShardStatus, error)
- func (s *SlaveBackend) AddCrossShardTxListByMinorBlockHash(minorHash common.Hash, txList []*types.CrossShardTransactionDeposit, ...) error
- func (s *SlaveBackend) AddRootBlock(block *types.RootBlock) (switched bool, err error)
- func (s *SlaveBackend) AddTx(tx *types.Transaction) (err error)
- func (s *SlaveBackend) CreateShards(rootBlock *types.RootBlock, forceInit bool) (err error)
- func (s *SlaveBackend) EstimateGas(tx *types.Transaction, address *account.Address) (uint32, error)
- func (s *SlaveBackend) ExecuteTx(tx *types.Transaction, address *account.Address, height *uint64) ([]byte, error)
- func (s *SlaveBackend) GasPrice(branch uint32) (uint64, error)
- func (s *SlaveBackend) GenTx(genTxs *rpc.GenTxRequest) error
- func (s *SlaveBackend) GetAccountData(address *account.Address, height *uint64) ([]*rpc.AccountBranchData, error)
- func (s *SlaveBackend) GetBalances(address *account.Address) (*big.Int, error)
- func (s *SlaveBackend) GetCode(address *account.Address, height *uint64) ([]byte, error)
- func (s *SlaveBackend) GetConfig() *config.SlaveConfig
- func (s *SlaveBackend) GetLogs(topics [][]common.Hash, address []account.Address, start uint64, end uint64, ...) ([]*types.Log, error)
- func (s *SlaveBackend) GetMinorBlockByHash(hash common.Hash, branch uint32) (*types.MinorBlock, error)
- func (s *SlaveBackend) GetMinorBlockByHeight(height uint64, branch uint32) (*types.MinorBlock, error)
- func (s *SlaveBackend) GetMinorBlockHeaderList(mHash common.Hash, limit uint32, direction uint8, branch uint32) ([]*types.MinorBlockHeader, error)
- func (s *SlaveBackend) GetMinorBlockListByHashList(mHashList []common.Hash, branch uint32) ([]*types.MinorBlock, error)
- func (s *SlaveBackend) GetStorageAt(address *account.Address, key common.Hash, height *uint64) (common.Hash, error)
- func (s *SlaveBackend) GetTokenBalance(address *account.Address) (*big.Int, error)
- func (s *SlaveBackend) GetTransactionByHash(txHash common.Hash, branch uint32) (*types.MinorBlock, uint32, error)
- func (s *SlaveBackend) GetTransactionCount(address *account.Address) (uint64, error)
- func (s *SlaveBackend) GetTransactionListByAddress(address *account.Address, start []byte, limit uint32) ([]*rpc.TransactionDetail, []byte, error)
- func (s *SlaveBackend) GetTransactionReceipt(txHash common.Hash, branch uint32) (*types.MinorBlock, uint32, *types.Receipt, error)
- func (s *SlaveBackend) GetUnconfirmedHeaderList() ([]*rpc.HeadersInfo, error)
- func (s *SlaveBackend) GetWork(branch uint32) (*consensus.MiningWork, error)
- func (s *SlaveBackend) HandleNewTip(req *rpc.HandleNewTipRequest) error
- func (s *SlaveBackend) Init(srvr *p2p.Server) error
- func (s *SlaveBackend) NewMinorBlock(block *types.MinorBlock) error
- func (s *SlaveBackend) Protocols() (protos []p2p.Protocol)
- func (s *SlaveBackend) SetMining(mining bool)
- func (s *SlaveBackend) Stop() error
- func (s *SlaveBackend) SubmitWork(headerHash common.Hash, nonce uint64, mixHash common.Hash, branch uint32) error
- type SlaveConn
- func (s *SlaveConn) AddXshardTxList(xshardReq *rpc.AddXshardTxListRequest) error
- func (s *SlaveConn) BatchAddXshardTxList(xshardReqs []*rpc.AddXshardTxListRequest) error
- func (s *SlaveConn) EqualChainMask(chainMask []*types.ChainMask) bool
- func (s *SlaveConn) HasShard(fullshardId uint32) bool
- func (s *SlaveConn) SendPing() bool
- type SlaveServerSideOp
- func (s *SlaveServerSideOp) AddMinorBlockListForSync(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) AddRootBlock(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) AddTransaction(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) AddTransactions(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) AddXshardTxList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) BatchAddXshardTxList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) EstimateGas(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) ExecuteTransaction(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GasPrice(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GenTx(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetAccountData(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetCode(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetLogs(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetMinorBlock(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetMinorBlockHeaderList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetMinorBlockList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetStorageAt(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetTransaction(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetTransactionListByAddress(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetTransactionReceipt(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetUnconfirmedHeaderList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) GetWork(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) HandleNewMinorBlock(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) HandleNewTip(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) HeartBeat(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) MasterInfo(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) Ping(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) SetMining(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
- func (s *SlaveServerSideOp) SubmitWork(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnManager ¶
type ConnManager struct {
// contains filtered or unexported fields
}
func NewToSlaveConnManager ¶
func NewToSlaveConnManager(cfg *config.ClusterConfig, slave *SlaveBackend) *ConnManager
func (*ConnManager) AddConnectToSlave ¶
func (s *ConnManager) AddConnectToSlave(info *rpc.SlaveInfo) bool
TODO need to be called in somowhere
func (*ConnManager) AddXshardTxList ¶
func (s *ConnManager) AddXshardTxList(fullShardId uint32, xshardReq *rpc.AddXshardTxListRequest) error
func (*ConnManager) BatchAddXshardTxList ¶
func (s *ConnManager) BatchAddXshardTxList(fullShardId uint32, xshardReqs []*rpc.AddXshardTxListRequest) error
func (*ConnManager) BatchBroadcastXshardTxList ¶
func (s *ConnManager) BatchBroadcastXshardTxList( blokHshToXLstAdPrvRotHg map[common.Hash]*shard.XshardListTuple, sorBrch account.Branch) error
func (*ConnManager) BroadcastMinorBlock ¶
func (s *ConnManager) BroadcastMinorBlock(minorBlock *types.MinorBlock, branch uint32) error
func (*ConnManager) BroadcastNewTip ¶
func (s *ConnManager) BroadcastNewTip(mHeaderLst []*types.MinorBlockHeader, rHeader *types.RootBlockHeader, branch uint32) error
func (*ConnManager) BroadcastTransactions ¶
func (s *ConnManager) BroadcastTransactions(txs []*types.Transaction, branch uint32) error
func (*ConnManager) BroadcastXshardTxList ¶
func (s *ConnManager) BroadcastXshardTxList(block *types.MinorBlock, xshardTxList []*types.CrossShardTransactionDeposit, height uint32) error
Broadcast x-shard transactions to their recipient shards
func (*ConnManager) GetConnectionsByFullShardId ¶
func (s *ConnManager) GetConnectionsByFullShardId(id uint32) []*SlaveConn
func (*ConnManager) GetMinorBlockHeaders ¶
func (s *ConnManager) GetMinorBlockHeaders(gReq *rpc.GetMinorBlockHeaderListRequest) ([]*types.MinorBlockHeader, error)
func (*ConnManager) GetMinorBlocks ¶
func (s *ConnManager) GetMinorBlocks(mHeaderList []common.Hash, peerId string, branch uint32) ([]*types.MinorBlock, error)
func (*ConnManager) ModifyTarget ¶
func (s *ConnManager) ModifyTarget(target string)
func (*ConnManager) SendMinorBlockHeaderToMaster ¶
func (s *ConnManager) SendMinorBlockHeaderToMaster(minorHeader *types.MinorBlockHeader, txCount, xshardCount uint32, state *rpc.ShardStatus) error
type SlaveBackend ¶
type SlaveBackend struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx *service.ServiceContext, clusterCfg *config.ClusterConfig, cfg *config.SlaveConfig) (*SlaveBackend, error)
func (*SlaveBackend) APIs ¶
func (s *SlaveBackend) APIs() []rpc.API
func (*SlaveBackend) AddBlockListForSync ¶
func (s *SlaveBackend) AddBlockListForSync(mHashList []common.Hash, peerId string, branch uint32) (*rpc.ShardStatus, error)
func (*SlaveBackend) AddCrossShardTxListByMinorBlockHash ¶
func (s *SlaveBackend) AddCrossShardTxListByMinorBlockHash(minorHash common.Hash, txList []*types.CrossShardTransactionDeposit, branch uint32) error
func (*SlaveBackend) AddRootBlock ¶
func (s *SlaveBackend) AddRootBlock(block *types.RootBlock) (switched bool, err error)
func (*SlaveBackend) AddTx ¶
func (s *SlaveBackend) AddTx(tx *types.Transaction) (err error)
func (*SlaveBackend) CreateShards ¶
func (s *SlaveBackend) CreateShards(rootBlock *types.RootBlock, forceInit bool) (err error)
Create shards based on GENESIS config and root block height if they have not been created yet.
func (*SlaveBackend) EstimateGas ¶
func (s *SlaveBackend) EstimateGas(tx *types.Transaction, address *account.Address) (uint32, error)
func (*SlaveBackend) ExecuteTx ¶
func (s *SlaveBackend) ExecuteTx(tx *types.Transaction, address *account.Address, height *uint64) ([]byte, error)
func (*SlaveBackend) GenTx ¶
func (s *SlaveBackend) GenTx(genTxs *rpc.GenTxRequest) error
func (*SlaveBackend) GetAccountData ¶
func (s *SlaveBackend) GetAccountData(address *account.Address, height *uint64) ([]*rpc.AccountBranchData, error)
func (*SlaveBackend) GetBalances ¶
func (*SlaveBackend) GetConfig ¶
func (s *SlaveBackend) GetConfig() *config.SlaveConfig
func (*SlaveBackend) GetMinorBlockByHash ¶
func (s *SlaveBackend) GetMinorBlockByHash(hash common.Hash, branch uint32) (*types.MinorBlock, error)
func (*SlaveBackend) GetMinorBlockByHeight ¶
func (s *SlaveBackend) GetMinorBlockByHeight(height uint64, branch uint32) (*types.MinorBlock, error)
func (*SlaveBackend) GetMinorBlockHeaderList ¶
func (s *SlaveBackend) GetMinorBlockHeaderList(mHash common.Hash, limit uint32, direction uint8, branch uint32) ([]*types.MinorBlockHeader, error)
func (*SlaveBackend) GetMinorBlockListByHashList ¶
func (s *SlaveBackend) GetMinorBlockListByHashList(mHashList []common.Hash, branch uint32) ([]*types.MinorBlock, error)
func (*SlaveBackend) GetStorageAt ¶
func (*SlaveBackend) GetTokenBalance ¶
func (*SlaveBackend) GetTransactionByHash ¶
func (s *SlaveBackend) GetTransactionByHash(txHash common.Hash, branch uint32) (*types.MinorBlock, uint32, error)
func (*SlaveBackend) GetTransactionCount ¶
func (s *SlaveBackend) GetTransactionCount(address *account.Address) (uint64, error)
func (*SlaveBackend) GetTransactionListByAddress ¶
func (s *SlaveBackend) GetTransactionListByAddress(address *account.Address, start []byte, limit uint32) ([]*rpc.TransactionDetail, []byte, error)
func (*SlaveBackend) GetTransactionReceipt ¶
func (s *SlaveBackend) GetTransactionReceipt(txHash common.Hash, branch uint32) (*types.MinorBlock, uint32, *types.Receipt, error)
func (*SlaveBackend) GetUnconfirmedHeaderList ¶
func (s *SlaveBackend) GetUnconfirmedHeaderList() ([]*rpc.HeadersInfo, error)
func (*SlaveBackend) GetWork ¶
func (s *SlaveBackend) GetWork(branch uint32) (*consensus.MiningWork, error)
func (*SlaveBackend) HandleNewTip ¶
func (s *SlaveBackend) HandleNewTip(req *rpc.HandleNewTipRequest) error
func (*SlaveBackend) NewMinorBlock ¶
func (s *SlaveBackend) NewMinorBlock(block *types.MinorBlock) error
func (*SlaveBackend) Protocols ¶
func (s *SlaveBackend) Protocols() (protos []p2p.Protocol)
func (*SlaveBackend) SetMining ¶
func (s *SlaveBackend) SetMining(mining bool)
func (*SlaveBackend) Stop ¶
func (s *SlaveBackend) Stop() error
func (*SlaveBackend) SubmitWork ¶
type SlaveConn ¶
type SlaveConn struct {
// contains filtered or unexported fields
}
this struct is used to communicate between slaves
func NewToSlaveConn ¶
func (*SlaveConn) AddXshardTxList ¶
func (s *SlaveConn) AddXshardTxList(xshardReq *rpc.AddXshardTxListRequest) error
func (*SlaveConn) BatchAddXshardTxList ¶
func (s *SlaveConn) BatchAddXshardTxList(xshardReqs []*rpc.AddXshardTxListRequest) error
func (*SlaveConn) EqualChainMask ¶
type SlaveServerSideOp ¶
type SlaveServerSideOp struct {
// contains filtered or unexported fields
}
func NewServerSideOp ¶
func NewServerSideOp(slave *SlaveBackend) *SlaveServerSideOp
func (*SlaveServerSideOp) AddMinorBlockListForSync ¶
func (s *SlaveServerSideOp) AddMinorBlockListForSync(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
check if the blocks are vailed.
func (*SlaveServerSideOp) AddRootBlock ¶
func (*SlaveServerSideOp) AddTransaction ¶
func (*SlaveServerSideOp) AddTransactions ¶
func (*SlaveServerSideOp) AddXshardTxList ¶
func (*SlaveServerSideOp) BatchAddXshardTxList ¶
func (*SlaveServerSideOp) EstimateGas ¶
func (*SlaveServerSideOp) ExecuteTransaction ¶
func (*SlaveServerSideOp) GetAccountData ¶
func (*SlaveServerSideOp) GetMinorBlock ¶
func (*SlaveServerSideOp) GetMinorBlockHeaderList ¶
func (*SlaveServerSideOp) GetMinorBlockList ¶
func (s *SlaveServerSideOp) GetMinorBlockList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)
p2p apis.
func (*SlaveServerSideOp) GetStorageAt ¶
func (*SlaveServerSideOp) GetTransaction ¶
func (*SlaveServerSideOp) GetTransactionListByAddress ¶
func (*SlaveServerSideOp) GetTransactionReceipt ¶
func (*SlaveServerSideOp) GetUnconfirmedHeaderList ¶
func (*SlaveServerSideOp) HandleNewMinorBlock ¶
func (*SlaveServerSideOp) HandleNewTip ¶
func (*SlaveServerSideOp) MasterInfo ¶
func (*SlaveServerSideOp) SubmitWork ¶
Click to show internal directories.
Click to hide internal directories.