rpc

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: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpHeartBeat = iota
	OpMasterInfo
	OpPing
	OpConnectToSlaves
	OpAddRootBlock
	OpGetNextBlockToMine
	OpGetUnconfirmedHeaderList
	OpGetAccountData
	OpAddTransaction
	OpAddMinorBlockHeader
	OpAddXshardTxList
	OpCreateClusterPeerConnection
	OpGetMinorBlock
	OpGetTransaction
	OpBatchAddXshardTxList
	OpExecuteTransaction
	OpGetTransactionReceipt
	OpGetMine
	OpGenTx
	OpGetTransactionListByAddress
	OpGetLogs
	OpEstimateGas
	OpGetStorageAt
	OpGetCode
	OpGasPrice
	OpGetWork
	OpSubmitWork
	OpAddMinorBlockListForSync
	// p2p api
	OpBroadcastNewTip
	OpBroadcastTransactions
	OpBroadcastNewMinorBlock
	OpGetMinorBlockList
	OpGetMinorBlockHeaderList
	OpHandleNewTip
	OpAddTransactions
	OpHandleNewMinorBlock
	OpSetMining

	MasterServer = serverType(1)
	SlaveServer  = serverType(0)
)

Variables

This section is empty.

Functions

func RegisterMasterServerSideOpServer

func RegisterMasterServerSideOpServer(s *grpc.Server, srv MasterServerSideOpServer)

func RegisterSlaveServerSideOpServer

func RegisterSlaveServerSideOpServer(s *grpc.Server, srv SlaveServerSideOpServer)

func StartGRPCServer

func StartGRPCServer(hostport string, apis []rpc.API) (net.Listener, *grpc.Server, error)

Types

type AccountBranchData

type AccountBranchData struct {
	Branch           uint32   `json:"branch" gencodec:"required"`
	TransactionCount uint64   `json:"transaction_count" gencodec:"required"`
	Balance          *big.Int `json:"token_balances" gencodec:"required" bytesizeofslicelen:"4"`
	IsContract       bool     `json:"is_contract" gencodec:"required"`
}

type AddBlockListForSyncRequest

type AddBlockListForSyncRequest struct {
	Branch             uint32        `json:"branch" gencodec:"required"`
	PeerId             string        `json:"peer_id" gencodec:"required"`
	MinorBlockHashList []common.Hash `json:"minor_block_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type AddBlockListForSyncResponse

type AddBlockListForSyncResponse struct {
	ShardStatus *ShardStatus `json:"shard_status" gencodec:"required"`
}

type AddMinorBlockHeaderRequest

type AddMinorBlockHeaderRequest struct {
	MinorBlockHeader *types.MinorBlockHeader `json:"minor_block_header" gencodec:"required"`
	TxCount          uint32                  `json:"tx_count" gencodec:"required"`
	XShardTxCount    uint32                  `json:"x_shard_tx_count" gencodec:"required"`
	ShardStats       *ShardStatus            `json:"shard_stats" gencodec:"required"`
}

slave -> master

Notify master about a successfully added minro block.
Piggyback the ShardStatus in the same request.

type AddMinorBlockHeaderResponse

type AddMinorBlockHeaderResponse struct {
	ArtificialTxConfig *ArtificialTxConfig `json:"artificial_tx_config" gencodec:"required"`
}

type AddMinorBlockRequest

type AddMinorBlockRequest struct {
	MinorBlockData []byte `json:"minor_block_data" gencodec:"required" bytesizeofslicelen:"4"`
}

For adding blocks mined through JRPC

type AddRootBlockRequest

type AddRootBlockRequest struct {
	RootBlock    *types.RootBlock `json:"root_block" gencodec:"required"`
	ExpectSwitch bool             `json:"expect_switch" gencodec:"required"`
}

Add root block to each slave

type AddRootBlockResponse

type AddRootBlockResponse struct {
	Switched bool `json:"switched" gencodec:"required"`
}

type AddTransactionRequest

type AddTransactionRequest struct {
	Tx *types.Transaction `json:"tx" gencodec:"required"`
}

type AddXshardTxListRequest

type AddXshardTxListRequest struct {
	Branch         uint32                                `json:"branch" gencodec:"required"`
	MinorBlockHash common.Hash                           `json:"minor_block_hash" gencodec:"required"`
	TxList         []*types.CrossShardTransactionDeposit `json:"tx_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type ArtificialTxConfig

type ArtificialTxConfig struct {
	TargetRootBlockTime  uint32 `json:"target_root_block_time" gencodec:"required"`
	TargetMinorBlockTime uint32 `json:"target_minor_block_time" gencodec:"required"`
}

type BatchAddXshardTxListRequest

type BatchAddXshardTxListRequest struct {
	AddXshardTxListRequestList []*AddXshardTxListRequest `json:"add_xshard_tx_list_request_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type BroadcastMinorBlock

type BroadcastMinorBlock struct {
	Branch     uint32            `json:"branch" gencodec:"required"`
	MinorBlock *types.MinorBlock `json:"minor_block" gencodec:"required"`
}

type BroadcastNewTip

type BroadcastNewTip struct {
	Branch               uint32                    `json:"branch" gencodec:"required"`
	RootBlockHeader      *types.RootBlockHeader    `json:"root_block_header" gencodec:"required"`
	MinorBlockHeaderList []*types.MinorBlockHeader `json:"minor_block_header_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type BroadcastTransactions

type BroadcastTransactions struct {
	Branch uint32               `json:"branch" gencodec:"required"`
	Txs    []*types.Transaction `json:"txs" gencodec:"required" bytesizeofslicelen:"4"`
}

type Client

type Client interface {
	Call(hostport string, req *Request) (*Response, error)
	GetOpName(uint32) string
}

Client wraps the GRPC client.

func NewClient

func NewClient(serverType serverType) Client

NewClient returns a new GRPC client wrapper.

type ConnectToSlavesRequest

type ConnectToSlavesRequest struct {
	SlaveInfoList []*SlaveInfo `json:"slave_info_list" gencodec:"required" bytesizeofslicelen:"4"`
}

Master instructs a slave to connect to other slaves

type ConnectToSlavesResponse

type ConnectToSlavesResponse struct {
	ResultList []*ConnectToSlavesResult `json:"result_list" gencodec:"required" bytesizeofslicelen:"4"`
}

result_list must have the same size as salve_info_list in the request. Empty result means success otherwise it would a serialized error message.

type ConnectToSlavesResult

type ConnectToSlavesResult struct {
	Result []byte `json:"result" gencodec:"required" bytesizeofslicelen:"4"`
}

type CrossShardTransactionList

type CrossShardTransactionList struct {
	TxList []*types.CrossShardTransactionDeposit `json:"tx_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type EcoInfo

type EcoInfo struct {
	Branch                           account.Branch `json:"branch" gencodec:"required"`
	Height                           uint64         `json:"height" gencodec:"required"`
	CoinbaseAmount                   common.Hash    `json:"coinbase_amount" gencodec:"required"`
	Difficulty                       *big.Int       `json:"difficulty" gencodec:"required"`
	UnconfirmedHeadersCoinbaseAmount common.Hash    `json:"unconfirmed_headers_coinbase_amount" gencodec:"required"`
}

Necessary information for master to decide the best block to mine

type EstimateGasRequest

type EstimateGasRequest struct {
	Tx          *types.Transaction `json:"tx" gencodec:"required"`
	FromAddress *account.Address   `json:"from_address" gencodec:"required"`
}

type EstimateGasResponse

type EstimateGasResponse struct {
	Result uint32 `json:"result" gencodec:"required"`
}

type ExecuteTransactionRequest

type ExecuteTransactionRequest struct {
	Tx          *types.Transaction `json:"tx" gencodec:"required"`
	FromAddress *account.Address   `json:"from_address" gencodec:"required"`
	BlockHeight *uint64            `json:"block_height" ser:"nil"`
}

type ExecuteTransactionResponse

type ExecuteTransactionResponse struct {
	Result []byte `json:"result" gencodec:"required" bytesizeofslicelen:"4"`
}

type GasPriceRequest

type GasPriceRequest struct {
	Branch uint32 `json:"branch" gencodec:"required"`
}

type GasPriceResponse

type GasPriceResponse struct {
	Result uint64 `json:"result" gencodec:"required"`
}

type GenTxRequest

type GenTxRequest struct {
	NumTxPerShard uint32             `json:"num_tx_per_shard" gencodec:"required"`
	XShardPercent uint32             `json:"x_shard_percent" gencodec:"required"`
	Tx            *types.Transaction `json:"tx" gencodec:"required"`
}

Generate transactions for loadtesting

type GetAccountDataRequest

type GetAccountDataRequest struct {
	Address     *account.Address `json:"address" gencodec:"required"`
	BlockHeight *uint64          `json:"block_height" ser:"nil"`
}

type GetAccountDataResponse

type GetAccountDataResponse struct {
	AccountBranchDataList []*AccountBranchData `json:"account_branch_data_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetCodeRequest

type GetCodeRequest struct {
	Address     *account.Address `json:"address" gencodec:"required"`
	BlockHeight *uint64          `json:"block_height" ser:"nil"`
}

type GetCodeResponse

type GetCodeResponse struct {
	Result []byte `json:"result" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetEcoInfoListResponse

type GetEcoInfoListResponse struct {
	EcoInfoList []*EcoInfo `json:"eco_info_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetLogRequest

type GetLogRequest struct {
	Branch     uint32            `json:"branch" gencodec:"required"`
	Addresses  []account.Address `json:"addresses" gencodec:"required" bytesizeofslicelen:"4"`
	Topics     [][]common.Hash   `json:"topics" gencodec:"required" bytesizeofslicelen:"4"`
	StartBlock uint64            `json:"start_block" gencodec:"required"`
	EndBlock   uint64            `json:"end_block" gencodec:"required"`
}

type GetLogResponse

type GetLogResponse struct {
	Logs []*types.Log `json:"logs" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetMinorBlockHeaderListRequest

type GetMinorBlockHeaderListRequest struct {
	Branch    uint32      `json:"branch" gencodec:"required"`
	BlockHash common.Hash `json:"block_hash" gencodec:"required"`
	Limit     uint32      `json:"limit" gencodec:"required"`
	// value 0: heighter, 1 lower
	Direction uint8  `json:"direction" gencodec:"required"`
	PeerID    string `json:"peerid" gencodec:"required"`
}

type GetMinorBlockHeaderListResponse

type GetMinorBlockHeaderListResponse struct {
	MinorBlockHeaderList []*types.MinorBlockHeader `json:"minor_block_header" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetMinorBlockListRequest

type GetMinorBlockListRequest struct {
	Branch             uint32        `json:"branch" gencodec:"required"`
	PeerId             string        `json:"peer_id" gencodec:"required"`
	MinorBlockHashList []common.Hash `json:"minor_block_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetMinorBlockListResponse

type GetMinorBlockListResponse struct {
	MinorBlockList []*types.MinorBlock `json:"minor_block_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetMinorBlockRequest

type GetMinorBlockRequest struct {
	Branch         uint32      `json:"branch" gencodec:"required"`
	MinorBlockHash common.Hash `json:"minor_block_hash" gencodec:"required"`
	Height         uint64      `json:"height" gencodec:"required"`
}

RPCs to lookup data from shards (master -> slaves)

type GetMinorBlockResponse

type GetMinorBlockResponse struct {
	MinorBlock *types.MinorBlock `json:"minor_block" gencodec:"required"`
}

type GetNextBlockToMineRequest

type GetNextBlockToMineRequest struct {
	Branch             account.Branch      `json:"branch" gencodec:"required"`
	Address            account.Address     `json:"address" gencodec:"required"`
	ArtificialTxConfig *ArtificialTxConfig `json:"artificial_tx_config" gencodec:"required"`
}

type GetNextBlockToMineResponse

type GetNextBlockToMineResponse struct {
	Block *types.MinorBlock `json:"block" gencodec:"required"`
}

type GetStorageRequest

type GetStorageRequest struct {
	Address     *account.Address `json:"address" gencodec:"required"`
	Key         common.Hash      `json:"key" gencodec:"required"`
	BlockHeight *uint64          `json:"block_height" ser:"nil"`
}

type GetStorageResponse

type GetStorageResponse struct {
	Result common.Hash `json:"result" gencodec:"required"`
}

type GetTransactionListByAddressRequest

type GetTransactionListByAddressRequest struct {
	Address *account.Address `json:"address" gencodec:"required"`
	Start   []byte           `json:"start" gencodec:"required" bytesizeofslicelen:"4"`
	Limit   uint32           `json:"limit" gencodec:"required"`
}

type GetTransactionListByAddressResponse

type GetTransactionListByAddressResponse struct {
	TxList []*TransactionDetail `json:"tx_list" gencodec:"required" bytesizeofslicelen:"4"`
	Next   []byte               `json:"next" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetTransactionReceiptRequest

type GetTransactionReceiptRequest struct {
	TxHash common.Hash `json:"tx_hash" gencodec:"required"`
	Branch uint32      `json:"branch" gencodec:"required"`
}

type GetTransactionReceiptResponse

type GetTransactionReceiptResponse struct {
	MinorBlock *types.MinorBlock `json:"minor_block" gencodec:"required"`
	Index      uint32            `json:"index" gencodec:"required"`
	Receipt    *types.Receipt    `json:"receipt" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetTransactionRequest

type GetTransactionRequest struct {
	TxHash common.Hash `json:"tx_hash" gencodec:"required"`
	Branch uint32      `json:"branch" gencodec:"required"`
}

type GetTransactionResponse

type GetTransactionResponse struct {
	MinorBlock *types.MinorBlock `json:"minor_block" gencodec:"required"`
	Index      uint32            `json:"index" gencodec:"required"`
}

type GetUnconfirmedHeadersResponse

type GetUnconfirmedHeadersResponse struct {
	HeadersInfoList []*HeadersInfo `json:"headers_info_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type GetWorkRequest

type GetWorkRequest struct {
	Branch uint32 `json:"branch" gencodec:"required"`
}

type GetWorkResponse

type GetWorkResponse struct {
	HeaderHash common.Hash `json:"header_hash" gencodec:"required"`
	Height     uint64      `json:"height" gencodec:"required"`
	Difficulty *big.Int    `json:"difficulty" gencodec:"required"`
}

type HandleNewTipRequest

type HandleNewTipRequest struct {
	PeerID               string                    `json:"peer_id" gencodec:"required"`
	RootBlockHeader      *types.RootBlockHeader    `json:"root_block_header" gencodec:"required"`
	MinorBlockHeaderList []*types.MinorBlockHeader `json:"minor_block_header_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type HashList

type HashList struct {
	Hashes []common.Hash `json:"hash_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type HeadersInfo

type HeadersInfo struct {
	Branch     uint32                    `json:"branch" gencodec:"required"`
	HeaderList []*types.MinorBlockHeader `json:"header_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type ISlaveConn

type ISlaveConn interface {
	ShardConnForP2P
	GetSlaveID() string
	GetShardMaskList() []*types.ChainMask
	MasterInfo(ip string, port uint16, rootTip *types.RootBlock) error
	HasShard(fullShardID uint32) bool
	SendPing() ([]byte, []*types.ChainMask, error)
	HeartBeat() bool
	GetUnconfirmedHeaders() (*GetUnconfirmedHeadersResponse, error)
	GetAccountData(address *account.Address, height *uint64) (*GetAccountDataResponse, error)
	AddRootBlock(rootBlock *types.RootBlock, expectSwitch bool) error
	GenTx(numTxPerShard, xShardPercent uint32, tx *types.Transaction) error
	SendMiningConfigToSlaves(artificialTxConfig *ArtificialTxConfig, mining bool) error
	AddTransaction(tx *types.Transaction) error
	ExecuteTransaction(tx *types.Transaction, fromAddress *account.Address, height *uint64) ([]byte, error)
	GetMinorBlockByHash(blockHash common.Hash, branch account.Branch) (*types.MinorBlock, error)
	GetMinorBlockByHeight(height uint64, branch account.Branch) (*types.MinorBlock, error)
	GetTransactionByHash(txHash common.Hash, branch account.Branch) (*types.MinorBlock, uint32, error)
	GetTransactionReceipt(txHash common.Hash, branch account.Branch) (*types.MinorBlock, uint32, *types.Receipt, error)
	GetTransactionsByAddress(address *account.Address, start []byte, limit uint32) ([]*TransactionDetail, []byte, error)
	GetLogs(branch account.Branch, address []account.Address, topics [][]common.Hash, startBlock, endBlock uint64) ([]*types.Log, error)
	EstimateGas(tx *types.Transaction, fromAddress *account.Address) (uint32, error)
	GetStorageAt(address *account.Address, key common.Hash, height *uint64) (common.Hash, error)
	GetCode(address *account.Address, height *uint64) ([]byte, error)
	GasPrice(branch account.Branch) (uint64, error)
	GetWork(branch account.Branch) (*consensus.MiningWork, error)
	SubmitWork(work *SubmitWorkRequest) (success bool, err error)
	SetMining(mining bool) error
}

type MasterInfo

type MasterInfo struct {
	// Initialize ShardState if not None
	RootTip *types.RootBlock `json:"root_tip" ser:"nil"`
	Ip      string           `json:"ip" gencodec:"required"`
	Port    uint16           `json:"port" gencodec:"required"`
}

type MasterServerSideOpClient

type MasterServerSideOpClient interface {
	AddMinorBlockHeader(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// p2p apis
	BroadcastNewTip(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	BroadcastTransactions(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	BroadcastNewMinorBlock(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetMinorBlockList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetMinorBlockHeaderList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

MasterServerSideOpClient is the client API for MasterServerSideOp service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMasterServerSideOpClient

func NewMasterServerSideOpClient(cc *grpc.ClientConn) MasterServerSideOpClient

type MasterServerSideOpServer

type MasterServerSideOpServer interface {
	AddMinorBlockHeader(context.Context, *Request) (*Response, error)
	// p2p apis
	BroadcastNewTip(context.Context, *Request) (*Response, error)
	BroadcastTransactions(context.Context, *Request) (*Response, error)
	BroadcastNewMinorBlock(context.Context, *Request) (*Response, error)
	GetMinorBlockList(context.Context, *Request) (*Response, error)
	GetMinorBlockHeaderList(context.Context, *Request) (*Response, error)
}

MasterServerSideOpServer is the server API for MasterServerSideOp service.

type MineRequest

type MineRequest struct {
	ArtificialTxConfig *ArtificialTxConfig `json:"artificial_tx_config" gencodec:"required"`
	Mining             bool                `json:"mining" gencodec:"required"`
}

Send mining instructions to slaves

type NetworkError

type NetworkError struct {
	Msg string
}

func (*NetworkError) Error

func (e *NetworkError) Error() string

type PeerInfoForDisPlay

type PeerInfoForDisPlay struct {
	ID   []byte
	IP   uint32
	Port uint32
}

type Ping

type Ping struct {
	Id            []byte             `json:"id" bytesizeofslicelen:"4"`
	ChainMaskList []*types.ChainMask `json:"chain_mask_list" bytesizeofslicelen:"4"`
}

type Pong

type Pong struct {
	Id            []byte             `json:"id" gencodec:"required" bytesizeofslicelen:"4"`
	ChainMaskList []*types.ChainMask `json:"chain_mask_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type Request

type Request struct {
	Op                   uint32   `protobuf:"varint,1,opt,name=op,proto3" json:"op,omitempty"`
	RpcId                int64    `protobuf:"varint,2,opt,name=rpc_id,json=rpcId,proto3" json:"rpc_id,omitempty"`
	Data                 []byte   `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

request data

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetData

func (m *Request) GetData() []byte

func (*Request) GetOp

func (m *Request) GetOp() uint32

func (*Request) GetRpcId

func (m *Request) GetRpcId() int64

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type Response

type Response struct {
	Data                 []byte   `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	RpcId                int64    `protobuf:"varint,2,opt,name=rpc_id,json=rpcId,proto3" json:"rpc_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

response data

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) GetData

func (m *Response) GetData() []byte

func (*Response) GetRpcId

func (m *Response) GetRpcId() int64

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Response) XXX_Merge

func (m *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

func (m *Response) XXX_Unmarshal(b []byte) error

type ShardConnForP2P

type ShardConnForP2P interface {
	// AddTransactions will add the tx to shard tx pool, and return the tx hash
	// which have been added to tx pool. so tx which cannot pass verification
	// or existed in tx pool will not be included in return hash list
	AddTransactions(request *p2p.NewTransactionList) (*HashList, error)

	GetMinorBlocks(request *GetMinorBlockListRequest) (*p2p.GetMinorBlockListResponse, error)

	GetMinorBlockHeaders(request *p2p.GetMinorBlockHeaderListRequest) (*p2p.GetMinorBlockHeaderListResponse, error)

	HandleNewTip(request *HandleNewTipRequest) (bool, error)

	HandleNewMinorBlock(request *p2p.NewBlockMinor) (bool, error)

	AddBlockListForSync(request *AddBlockListForSyncRequest) (*ShardStatus, error)
}

type ShardStatus

type ShardStatus struct {
	Branch             account.Branch
	Height             uint64
	Difficulty         *big.Int
	CoinbaseAddress    account.Address
	Timestamp          uint64
	TxCount60s         uint32
	PendingTxCount     uint32
	TotalTxCount       uint32
	BlockCount60s      uint32
	StaleBlockCount60s uint32
	LastBlockTime      uint64
}

ShardStatus shard status for api

type SlaveInfo

type SlaveInfo struct {
	Id            string             `json:"id" gencodec:"required"`
	Host          string             `json:"host" gencodec:"required"`
	Port          uint16             `json:"port" gencodec:"required"`
	ChainMaskList []*types.ChainMask `json:"chain_mask_list" gencodec:"required" bytesizeofslicelen:"4"`
}

type SlaveServerSideOpClient

type SlaveServerSideOpClient interface {
	HeartBeat(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	MasterInfo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// APIs for master
	Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GenTx(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	AddRootBlock(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetUnconfirmedHeaderList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetAccountData(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	AddTransaction(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetMinorBlock(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetTransaction(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	ExecuteTransaction(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetTransactionReceipt(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetTransactionListByAddress(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetLogs(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	EstimateGas(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetStorageAt(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetCode(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GasPrice(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetWork(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	SubmitWork(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// APIs for neighbor slaves
	AddXshardTxList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	BatchAddXshardTxList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	AddMinorBlockListForSync(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// p2p apis
	GetMinorBlockList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	GetMinorBlockHeaderList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	HandleNewTip(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	AddTransactions(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	HandleNewMinorBlock(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	SetMining(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

SlaveServerSideOpClient is the client API for SlaveServerSideOp service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewSlaveServerSideOpClient

func NewSlaveServerSideOpClient(cc *grpc.ClientConn) SlaveServerSideOpClient

type SlaveServerSideOpServer

type SlaveServerSideOpServer interface {
	HeartBeat(context.Context, *Request) (*Response, error)
	MasterInfo(context.Context, *Request) (*Response, error)
	// APIs for master
	Ping(context.Context, *Request) (*Response, error)
	GenTx(context.Context, *Request) (*Response, error)
	AddRootBlock(context.Context, *Request) (*Response, error)
	GetUnconfirmedHeaderList(context.Context, *Request) (*Response, error)
	GetAccountData(context.Context, *Request) (*Response, error)
	AddTransaction(context.Context, *Request) (*Response, error)
	GetMinorBlock(context.Context, *Request) (*Response, error)
	GetTransaction(context.Context, *Request) (*Response, error)
	ExecuteTransaction(context.Context, *Request) (*Response, error)
	GetTransactionReceipt(context.Context, *Request) (*Response, error)
	GetTransactionListByAddress(context.Context, *Request) (*Response, error)
	GetLogs(context.Context, *Request) (*Response, error)
	EstimateGas(context.Context, *Request) (*Response, error)
	GetStorageAt(context.Context, *Request) (*Response, error)
	GetCode(context.Context, *Request) (*Response, error)
	GasPrice(context.Context, *Request) (*Response, error)
	GetWork(context.Context, *Request) (*Response, error)
	SubmitWork(context.Context, *Request) (*Response, error)
	// APIs for neighbor slaves
	AddXshardTxList(context.Context, *Request) (*Response, error)
	BatchAddXshardTxList(context.Context, *Request) (*Response, error)
	AddMinorBlockListForSync(context.Context, *Request) (*Response, error)
	// p2p apis
	GetMinorBlockList(context.Context, *Request) (*Response, error)
	GetMinorBlockHeaderList(context.Context, *Request) (*Response, error)
	HandleNewTip(context.Context, *Request) (*Response, error)
	AddTransactions(context.Context, *Request) (*Response, error)
	HandleNewMinorBlock(context.Context, *Request) (*Response, error)
	SetMining(context.Context, *Request) (*Response, error)
}

SlaveServerSideOpServer is the server API for SlaveServerSideOp service.

type SubmitWorkRequest

type SubmitWorkRequest struct {
	Branch     uint32      `json:"branch" gencodec:"required"`
	HeaderHash common.Hash `json:"header_hash" gencodec:"required"`
	Nonce      uint64      `json:"nonce" gencodec:"required"`
	MixHash    common.Hash `json:"mix_hash" gencodec:"required"`
}

type SubmitWorkResponse

type SubmitWorkResponse struct {
	Success bool `json:"success" gencodec:"required"`
}

type TransactionDetail

type TransactionDetail struct {
	TxHash      common.Hash       `json:"tx_hash" gencodec:"required"`
	FromAddress account.Address   `json:"from_address" gencodec:"required"`
	ToAddress   *account.Address  `json:"to_address" ser:"nil"`
	Value       serialize.Uint256 `json:"value" gencodec:"required"`
	BlockHeight uint64            `json:"block_height" gencodec:"required"`
	Timestamp   uint64            `json:"timestamp" gencodec:"required"`
	Success     bool              `json:"success" gencodec:"required"`
}

type UnimplementedMasterServerSideOpServer

type UnimplementedMasterServerSideOpServer struct {
}

UnimplementedMasterServerSideOpServer can be embedded to have forward compatible implementations.

func (*UnimplementedMasterServerSideOpServer) AddMinorBlockHeader

func (*UnimplementedMasterServerSideOpServer) AddMinorBlockHeader(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedMasterServerSideOpServer) BroadcastNewMinorBlock

func (*UnimplementedMasterServerSideOpServer) BroadcastNewMinorBlock(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedMasterServerSideOpServer) BroadcastNewTip

func (*UnimplementedMasterServerSideOpServer) BroadcastTransactions

func (*UnimplementedMasterServerSideOpServer) BroadcastTransactions(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedMasterServerSideOpServer) GetMinorBlockHeaderList

func (*UnimplementedMasterServerSideOpServer) GetMinorBlockHeaderList(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedMasterServerSideOpServer) GetMinorBlockList

func (*UnimplementedMasterServerSideOpServer) GetMinorBlockList(ctx context.Context, req *Request) (*Response, error)

type UnimplementedSlaveServerSideOpServer

type UnimplementedSlaveServerSideOpServer struct {
}

UnimplementedSlaveServerSideOpServer can be embedded to have forward compatible implementations.

func (*UnimplementedSlaveServerSideOpServer) AddMinorBlockListForSync

func (*UnimplementedSlaveServerSideOpServer) AddMinorBlockListForSync(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) AddRootBlock

func (*UnimplementedSlaveServerSideOpServer) AddTransaction

func (*UnimplementedSlaveServerSideOpServer) AddTransactions

func (*UnimplementedSlaveServerSideOpServer) AddXshardTxList

func (*UnimplementedSlaveServerSideOpServer) BatchAddXshardTxList

func (*UnimplementedSlaveServerSideOpServer) BatchAddXshardTxList(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) EstimateGas

func (*UnimplementedSlaveServerSideOpServer) ExecuteTransaction

func (*UnimplementedSlaveServerSideOpServer) ExecuteTransaction(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) GasPrice

func (*UnimplementedSlaveServerSideOpServer) GenTx

func (*UnimplementedSlaveServerSideOpServer) GetAccountData

func (*UnimplementedSlaveServerSideOpServer) GetCode

func (*UnimplementedSlaveServerSideOpServer) GetLogs

func (*UnimplementedSlaveServerSideOpServer) GetMinorBlock

func (*UnimplementedSlaveServerSideOpServer) GetMinorBlockHeaderList

func (*UnimplementedSlaveServerSideOpServer) GetMinorBlockHeaderList(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) GetMinorBlockList

func (*UnimplementedSlaveServerSideOpServer) GetMinorBlockList(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) GetStorageAt

func (*UnimplementedSlaveServerSideOpServer) GetTransaction

func (*UnimplementedSlaveServerSideOpServer) GetTransactionListByAddress

func (*UnimplementedSlaveServerSideOpServer) GetTransactionListByAddress(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) GetTransactionReceipt

func (*UnimplementedSlaveServerSideOpServer) GetTransactionReceipt(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) GetUnconfirmedHeaderList

func (*UnimplementedSlaveServerSideOpServer) GetUnconfirmedHeaderList(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) GetWork

func (*UnimplementedSlaveServerSideOpServer) HandleNewMinorBlock

func (*UnimplementedSlaveServerSideOpServer) HandleNewMinorBlock(ctx context.Context, req *Request) (*Response, error)

func (*UnimplementedSlaveServerSideOpServer) HandleNewTip

func (*UnimplementedSlaveServerSideOpServer) HeartBeat

func (*UnimplementedSlaveServerSideOpServer) MasterInfo

func (*UnimplementedSlaveServerSideOpServer) Ping

func (*UnimplementedSlaveServerSideOpServer) SetMining

func (*UnimplementedSlaveServerSideOpServer) SubmitWork

Jump to

Keyboard shortcuts

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