slave

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrMsg

func ErrMsg(str string) error

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 (*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) GasPrice

func (s *SlaveBackend) GasPrice(branch uint32) (uint64, 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 (s *SlaveBackend) GetBalances(address *account.Address) (*big.Int, error)

func (*SlaveBackend) GetCode

func (s *SlaveBackend) GetCode(address *account.Address, height *uint64) ([]byte, error)

func (*SlaveBackend) GetConfig

func (s *SlaveBackend) GetConfig() *config.SlaveConfig

func (*SlaveBackend) GetLogs

func (s *SlaveBackend) GetLogs(topics [][]common.Hash, address []account.Address, start uint64, end uint64, branch uint32) ([]*types.Log, error)

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 (s *SlaveBackend) GetStorageAt(address *account.Address, key common.Hash, height *uint64) (common.Hash, error)

func (*SlaveBackend) GetTokenBalance

func (s *SlaveBackend) GetTokenBalance(address *account.Address) (*big.Int, error)

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) Init

func (s *SlaveBackend) Init(srvr *p2p.Server) 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

func (s *SlaveBackend) SubmitWork(headerHash common.Hash, nonce uint64, mixHash common.Hash, branch uint32) error

type SlaveConn

type SlaveConn struct {
	// contains filtered or unexported fields
}

this struct is used to communicate between slaves

func NewToSlaveConn

func NewToSlaveConn(target, id string, chainMaskList []*types.ChainMask) *SlaveConn

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

func (s *SlaveConn) EqualChainMask(chainMask []*types.ChainMask) bool

func (*SlaveConn) HasShard

func (s *SlaveConn) HasShard(fullshardId uint32) bool

func (*SlaveConn) SendPing

func (s *SlaveConn) SendPing() bool

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 (s *SlaveServerSideOp) AddRootBlock(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) AddTransaction

func (s *SlaveServerSideOp) AddTransaction(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) AddTransactions

func (s *SlaveServerSideOp) AddTransactions(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) AddXshardTxList

func (s *SlaveServerSideOp) AddXshardTxList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) BatchAddXshardTxList

func (s *SlaveServerSideOp) BatchAddXshardTxList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) EstimateGas

func (s *SlaveServerSideOp) EstimateGas(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) ExecuteTransaction

func (s *SlaveServerSideOp) ExecuteTransaction(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GasPrice

func (s *SlaveServerSideOp) GasPrice(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GenTx

func (s *SlaveServerSideOp) GenTx(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetAccountData

func (s *SlaveServerSideOp) GetAccountData(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetCode

func (s *SlaveServerSideOp) GetCode(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetLogs

func (s *SlaveServerSideOp) GetLogs(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetMinorBlock

func (s *SlaveServerSideOp) GetMinorBlock(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetMinorBlockHeaderList

func (s *SlaveServerSideOp) GetMinorBlockHeaderList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetMinorBlockList

func (s *SlaveServerSideOp) GetMinorBlockList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

p2p apis.

func (*SlaveServerSideOp) GetStorageAt

func (s *SlaveServerSideOp) GetStorageAt(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetTransaction

func (s *SlaveServerSideOp) GetTransaction(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetTransactionListByAddress

func (s *SlaveServerSideOp) GetTransactionListByAddress(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetTransactionReceipt

func (s *SlaveServerSideOp) GetTransactionReceipt(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetUnconfirmedHeaderList

func (s *SlaveServerSideOp) GetUnconfirmedHeaderList(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) GetWork

func (s *SlaveServerSideOp) GetWork(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) HandleNewMinorBlock

func (s *SlaveServerSideOp) HandleNewMinorBlock(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) HandleNewTip

func (s *SlaveServerSideOp) HandleNewTip(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) HeartBeat

func (s *SlaveServerSideOp) HeartBeat(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) MasterInfo

func (s *SlaveServerSideOp) MasterInfo(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) Ping

func (s *SlaveServerSideOp) Ping(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) SetMining

func (s *SlaveServerSideOp) SetMining(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

func (*SlaveServerSideOp) SubmitWork

func (s *SlaveServerSideOp) SubmitWork(ctx context.Context, req *rpc.Request) (*rpc.Response, error)

Jump to

Keyboard shortcuts

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