Documentation ¶
Overview ¶
ZooBC Copyright (C) 2020 Quasisoft Limited - Hong Kong This file is part of ZooBC <https://github.com/zoobc/zoobc-core>
ZooBC is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
ZooBC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ZooBC. If not, see <http://www.gnu.org/licenses/>.
Additional Permission Under GNU GPL Version 3 section 7. As the special exception permitted under Section 7b, c and e, in respect with the Author’s copyright, please refer to this section:
- You are free to convey this Program according to GNU GPL Version 3, as long as you respect and comply with the Author’s copyright by showing in its user interface an Appropriate Notice that the derivate program and its source code are “powered by ZooBC”. This is an acknowledgement for the copyright holder, ZooBC, as the implementation of appreciation of the exclusive right of the creator and to avoid any circumvention on the rights under trademark law for use of some trade names, trademarks, or service marks.
- Complying to the GNU GPL Version 3, you may distribute the program without any permission from the Author. However a prior notification to the authors will be appreciated.
ZooBC is architected by Roberto Capodieci & Barton Johnston
contact us at roberto.capodieci[at]blockchainzoo.com and barton.johnston[at]blockchainzoo.com
Core developers that contributed to the current implementation of the software are:
Ahmad Ali Abdilah ahmad.abdilah[at]blockchainzoo.com Allan Bintoro allan.bintoro[at]blockchainzoo.com Andy Herman Gede Sukra Ketut Ariasa Nawi Kartini nawi.kartini[at]blockchainzoo.com Stefano Galassi stefano.galassi[at]blockchainzoo.com
IMPORTANT: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Index ¶
- type Dialer
- type PeerServiceClient
- func (psc *PeerServiceClient) DeleteConnection(destPeer *model.Peer) error
- func (psc *PeerServiceClient) GetCommonMilestoneBlockIDs(destPeer *model.Peer, chaintype chaintype.ChainType, ...) (*model.GetCommonMilestoneBlockIdsResponse, error)
- func (psc *PeerServiceClient) GetConnection(destPeer *model.Peer) (*grpc.ClientConn, error)
- func (psc *PeerServiceClient) GetCumulativeDifficulty(destPeer *model.Peer, chaintype chaintype.ChainType) (*model.GetCumulativeDifficultyResponse, error)
- func (psc *PeerServiceClient) GetMorePeers(destPeer *model.Peer) (*model.GetMorePeersResponse, error)
- func (psc *PeerServiceClient) GetNextBlockIDs(destPeer *model.Peer, chaintype chaintype.ChainType, blockID int64, ...) (*model.BlockIdsResponse, error)
- func (psc *PeerServiceClient) GetNextBlocks(destPeer *model.Peer, chaintype chaintype.ChainType, blockIds []int64, ...) (*model.BlocksData, error)
- func (psc *PeerServiceClient) GetNodeAddressesInfo(destPeer *model.Peer, nodeRegistrations []*model.NodeRegistration) (*model.GetNodeAddressesInfoResponse, error)
- func (psc *PeerServiceClient) GetNodeProofOfOrigin(destPeer *model.Peer) (*model.ProofOfOrigin, error)
- func (psc *PeerServiceClient) GetPeerInfo(destPeer *model.Peer) (*model.GetPeerInfoResponse, error)
- func (psc *PeerServiceClient) RequestBlockTransactions(destPeer *model.Peer, transactionIDs []int64, chainType chaintype.ChainType, ...) error
- func (psc *PeerServiceClient) RequestDownloadFile(destPeer *model.Peer, snapshotHash []byte, fileChunkNames []string) (*model.FileDownloadResponse, error)
- func (psc *PeerServiceClient) SendBlock(destPeer *model.Peer, block *model.Block, chainType chaintype.ChainType) error
- func (psc *PeerServiceClient) SendBlockTransactions(destPeer *model.Peer, transactionsBytes [][]byte, ...) error
- func (psc *PeerServiceClient) SendNodeAddressInfo(destPeer *model.Peer, nodeAddressInfos []*model.NodeAddressInfo) (*model.Empty, error)
- func (psc *PeerServiceClient) SendPeers(destPeer *model.Peer, peersInfo []*model.Node) (*model.Empty, error)
- func (psc *PeerServiceClient) SendTransaction(destPeer *model.Peer, transactionBytes []byte, chainType chaintype.ChainType) error
- type PeerServiceClientInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer func(destinationPeer *model.Peer) (*grpc.ClientConn, error)
Dialer represent peer service
type PeerServiceClient ¶
type PeerServiceClient struct { Dialer Dialer Logger *log.Logger QueryExecutor query.ExecutorInterface NodeReceiptQuery query.BatchReceiptQueryInterface MerkleTreeQuery query.MerkleTreeQueryInterface ReceiptService coreService.ReceiptServiceInterface NodeRegistrationService coreService.NodeRegistrationServiceInterface NodePublicKey []byte NodeConfigurationService coreService.NodeConfigurationServiceInterface PeerConnections map[string]*grpc.ClientConn PeerConnectionsLock sync.RWMutex NodeAuthValidation auth.NodeAuthValidationInterface FeedbackStrategy feedbacksystem.FeedbackStrategyInterface }
PeerServiceClient represent peer service
func (*PeerServiceClient) DeleteConnection ¶
func (psc *PeerServiceClient) DeleteConnection(destPeer *model.Peer) error
DeleteConnection delete the cached connection in psc.PeerConnections
func (*PeerServiceClient) GetCommonMilestoneBlockIDs ¶
func (psc *PeerServiceClient) GetCommonMilestoneBlockIDs( destPeer *model.Peer, chaintype chaintype.ChainType, lastBlockID, lastMilestoneBlockID int64, ) (*model.GetCommonMilestoneBlockIdsResponse, error)
GetCommonMilestoneBlockIDs request the blockIds that may act as milestone block
func (*PeerServiceClient) GetConnection ¶
func (psc *PeerServiceClient) GetConnection(destPeer *model.Peer) (*grpc.ClientConn, error)
func (*PeerServiceClient) GetCumulativeDifficulty ¶
func (psc *PeerServiceClient) GetCumulativeDifficulty( destPeer *model.Peer, chaintype chaintype.ChainType, ) (*model.GetCumulativeDifficultyResponse, error)
GetCumulativeDifficulty request the cumulative difficulty status of a node
func (*PeerServiceClient) GetMorePeers ¶
func (psc *PeerServiceClient) GetMorePeers(destPeer *model.Peer) (*model.GetMorePeersResponse, error)
GetMorePeers to collect more peers available
func (*PeerServiceClient) GetNextBlockIDs ¶
func (psc *PeerServiceClient) GetNextBlockIDs( destPeer *model.Peer, chaintype chaintype.ChainType, blockID int64, limit uint32, ) (*model.BlockIdsResponse, error)
GetNextBlockIDs request the blockIds of the next blocks requested
func (*PeerServiceClient) GetNextBlocks ¶
func (psc *PeerServiceClient) GetNextBlocks( destPeer *model.Peer, chaintype chaintype.ChainType, blockIds []int64, blockID int64, ) (*model.BlocksData, error)
GetNextBlocks request the next blocks matching the array of blockIds
func (*PeerServiceClient) GetNodeAddressesInfo ¶
func (psc *PeerServiceClient) GetNodeAddressesInfo( destPeer *model.Peer, nodeRegistrations []*model.NodeRegistration, ) (*model.GetNodeAddressesInfoResponse, error)
GetNodeAddressesInfo to get a list of node addresses from a peer
func (*PeerServiceClient) GetNodeProofOfOrigin ¶
func (psc *PeerServiceClient) GetNodeProofOfOrigin( destPeer *model.Peer, ) (*model.ProofOfOrigin, error)
GetNodeProofOfOrigin get a cryptographic prove of a node authenticity and origin
func (*PeerServiceClient) GetPeerInfo ¶
func (psc *PeerServiceClient) GetPeerInfo(destPeer *model.Peer) (*model.GetPeerInfoResponse, error)
GetPeerInfo to get Peer info
func (*PeerServiceClient) RequestBlockTransactions ¶
func (*PeerServiceClient) RequestDownloadFile ¶
func (psc *PeerServiceClient) RequestDownloadFile( destPeer *model.Peer, snapshotHash []byte, fileChunkNames []string, ) (*model.FileDownloadResponse, error)
func (*PeerServiceClient) SendBlock ¶
func (psc *PeerServiceClient) SendBlock( destPeer *model.Peer, block *model.Block, chainType chaintype.ChainType, ) error
SendBlock send block to selected peer, got Receipt
func (*PeerServiceClient) SendBlockTransactions ¶
func (psc *PeerServiceClient) SendBlockTransactions( destPeer *model.Peer, transactionsBytes [][]byte, chainType chaintype.ChainType, ) error
SendBlockTransactions sends transactions required by a block requested by the peer
func (*PeerServiceClient) SendNodeAddressInfo ¶
func (psc *PeerServiceClient) SendNodeAddressInfo(destPeer *model.Peer, nodeAddressInfos []*model.NodeAddressInfo) (*model.Empty, error)
SendNodeAddressInfo sends a nodeAddressInfo to other node (to populate the network)
func (*PeerServiceClient) SendPeers ¶
func (psc *PeerServiceClient) SendPeers(destPeer *model.Peer, peersInfo []*model.Node) (*model.Empty, error)
SendPeers sends set of peers to other node (to populate the network)
func (*PeerServiceClient) SendTransaction ¶
func (psc *PeerServiceClient) SendTransaction( destPeer *model.Peer, transactionBytes []byte, chainType chaintype.ChainType, ) error
SendTransaction send transaction to selected peer
type PeerServiceClientInterface ¶
type PeerServiceClientInterface interface { GetNodeAddressesInfo(destPeer *model.Peer, nodeRegistrations []*model.NodeRegistration) (*model.GetNodeAddressesInfoResponse, error) SendNodeAddressInfo(destPeer *model.Peer, nodeAddressInfos []*model.NodeAddressInfo) (*model.Empty, error) GetNodeProofOfOrigin(destPeer *model.Peer) (*model.ProofOfOrigin, error) GetPeerInfo(destPeer *model.Peer) (*model.GetPeerInfoResponse, error) GetMorePeers(destPeer *model.Peer) (*model.GetMorePeersResponse, error) SendPeers(destPeer *model.Peer, peersInfo []*model.Node) (*model.Empty, error) SendBlock( destPeer *model.Peer, block *model.Block, chainType chaintype.ChainType, ) error SendTransaction( destPeer *model.Peer, transactionBytes []byte, chainType chaintype.ChainType, ) error SendBlockTransactions( destPeer *model.Peer, transactionsBytes [][]byte, chainType chaintype.ChainType, ) error RequestBlockTransactions( destPeer *model.Peer, transactionIDs []int64, chainType chaintype.ChainType, blockID int64, ) error GetCumulativeDifficulty(*model.Peer, chaintype.ChainType) (*model.GetCumulativeDifficultyResponse, error) GetCommonMilestoneBlockIDs(destPeer *model.Peer, chaintype chaintype.ChainType, lastBlockID, astMilestoneBlockID int64) (*model.GetCommonMilestoneBlockIdsResponse, error) GetNextBlockIDs(destPeer *model.Peer, chaintype chaintype.ChainType, blockID int64, limit uint32) (*model.BlockIdsResponse, error) GetNextBlocks(destPeer *model.Peer, chaintype chaintype.ChainType, blockIds []int64, blockID int64) (*model.BlocksData, error) // connection managements DeleteConnection(destPeer *model.Peer) error GetConnection(destPeer *model.Peer) (*grpc.ClientConn, error) RequestDownloadFile(destPeer *model.Peer, snapshotHash []byte, fileChunkNames []string) (*model.FileDownloadResponse, error) }
PeerServiceClientInterface acts as interface for PeerServiceClient
func NewPeerServiceClient ¶
func NewPeerServiceClient( queryExecutor query.ExecutorInterface, nodeReceiptQuery query.BatchReceiptQueryInterface, nodePublicKey []byte, nodeRegistrationService coreService.NodeRegistrationServiceInterface, merkleTreeQuery query.MerkleTreeQueryInterface, receiptService coreService.ReceiptServiceInterface, nodeConfigurationService coreService.NodeConfigurationServiceInterface, nodeAuthValidation auth.NodeAuthValidationInterface, feedbackStrategy feedbacksystem.FeedbackStrategyInterface, logger *log.Logger, ) PeerServiceClientInterface
NewPeerServiceClient to get instance of singleton peer service, this should only be instantiated from main.go