public class Channel extends Object
Modifier and Type | Method and Description |
---|---|
Channel |
addEventHub(EventHub eventHub)
Add an Event Hub to this channel.
|
Channel |
addOrderer(Orderer orderer)
Add an Orderer to this channel.
|
Channel |
addPeer(Peer peer)
Add a peer to the channel
|
int |
getDeployWaitTime()
Get the deploy wait time in seconds.
|
Collection<EventHub> |
getEventHubs()
Get all Event Hubs on this channel.
|
String |
getName()
Get the channel name
|
Collection<Orderer> |
getOrderers() |
Collection<Peer> |
getPeers()
Get the peers for this channel.
|
int |
getTransactionWaitTime()
Get the transaction wait time in seconds
|
Channel |
initialize()
Initialize the Channel.
|
boolean |
isInitialized() |
Channel |
joinPeer(Peer peer) |
BlockInfo |
queryBlockByHash(byte[] blockHash)
query this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByHash(Peer peer,
byte[] blockHash)
Query a peer in this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByNumber(long blockNumber)
query this channel for a Block by the blockNumber.
|
BlockInfo |
queryBlockByNumber(Peer peer,
long blockNumber)
query a peer in this channel for a Block by the blockNumber
|
BlockInfo |
queryBlockByTransactionID(Peer peer,
String txID)
query a peer in this channel for a Block by a TransactionID contained in the block
|
BlockInfo |
queryBlockByTransactionID(String txID)
query this channel for a Block by a TransactionID contained in the block
The request is sent to a random peer in the channel
|
BlockchainInfo |
queryBlockchainInfo()
query this channel for chain information.
|
BlockchainInfo |
queryBlockchainInfo(Peer peer)
query for chain information
|
Collection<ProposalResponse> |
queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest)
Send Query proposal
|
Collection<ProposalResponse> |
queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest,
Collection<Peer> peers)
Send Query proposal
|
List<org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo> |
queryInstantiatedChaincodes(Peer peer)
Query peer for chaincode that has been instantiated
|
TransactionInfo |
queryTransactionByID(Peer peer,
String txID)
Query for a Fabric Transaction given its transactionID
|
TransactionInfo |
queryTransactionByID(String txID)
Query this channel for a Fabric Transaction given its transactionID.
|
String |
registerBlockListener(BlockListener listener)
Register a block listener.
|
Collection<ProposalResponse> |
sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest)
Send instantiate request to the channel.
|
Collection<ProposalResponse> |
sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest,
Collection<Peer> peers)
Send instantiate request to the channel.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<ProposalResponse> proposalResponses)
Send transaction to one of the orderers on the channel using the usercontext set on the client.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<ProposalResponse> proposalResponses,
Collection<Orderer> orderers)
Send transaction to one of the specified orderers using the usercontext set on the client..
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<ProposalResponse> proposalResponses,
Collection<Orderer> orderers,
User userContext)
Send transaction to one of a specified set of orderers with the specified user context.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<ProposalResponse> proposalResponses,
User userContext)
Send transaction to one of the orderers on the channel using a specific user context.
|
Collection<ProposalResponse> |
sendTransactionProposal(TransactionProposalRequest transactionProposalRequest)
Send a transaction proposal.
|
Collection<ProposalResponse> |
sendTransactionProposal(TransactionProposalRequest transactionProposalRequest,
Collection<Peer> peers)
Send a transaction proposal to specific peers.
|
Collection<ProposalResponse> |
sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest)
Send Upgrade proposal proposal to upgrade chaincode to a new version.
|
Collection<ProposalResponse> |
sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest,
Collection<Peer> peers)
Send Upgrade proposal proposal to upgrade chaincode to a new version.
|
void |
setDeployWaitTime(int waitTime)
Set the deploy wait time in seconds.
|
void |
setTransactionWaitTime(int waitTime)
Set the transaction wait time in seconds.
|
void |
shutdown(boolean force)
Shutdown the channel with all resources released.
|
public Collection<EventHub> getEventHubs()
public boolean isInitialized()
public String getName()
public Channel addPeer(Peer peer) throws InvalidArgumentException
peer
- The Peer to add.InvalidArgumentException
public Channel joinPeer(Peer peer) throws ProposalException
ProposalException
public Channel addOrderer(Orderer orderer) throws InvalidArgumentException
orderer
- the orderer to add.InvalidArgumentException
public Channel addEventHub(EventHub eventHub) throws InvalidArgumentException
eventHub
- InvalidArgumentException
public Collection<Peer> getPeers()
public int getDeployWaitTime()
public void setDeployWaitTime(int waitTime)
waitTime
- Deploy wait timepublic int getTransactionWaitTime()
public void setTransactionWaitTime(int waitTime)
waitTime
- Invoke wait timepublic Channel initialize() throws InvalidArgumentException, TransactionException
InvalidArgumentException
TransactionException
public Collection<Orderer> getOrderers()
public Collection<ProposalResponse> sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest) throws InvalidArgumentException, ProposalException
instantiateProposalRequest
- send instantiate chaincode proposal request.InvalidArgumentException
ProposalException
public Collection<ProposalResponse> sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
instantiateProposalRequest
- peers
- InvalidArgumentException
ProposalException
public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest) throws ProposalException, InvalidArgumentException
upgradeProposalRequest
- ProposalException
InvalidArgumentException
public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
upgradeProposalRequest
- peers
- the specific peers to send to.ProposalException
InvalidArgumentException
public BlockInfo queryBlockByHash(byte[] blockHash) throws InvalidArgumentException, ProposalException
blockHash
- the hash of the Block in the chainBlockInfo
with the given block HashInvalidArgumentException
ProposalException
public BlockInfo queryBlockByHash(Peer peer, byte[] blockHash) throws InvalidArgumentException, ProposalException
peer
- the Peer to query.blockHash
- the hash of the Block in the chain.BlockInfo
with the given block HashInvalidArgumentException
- if the channel is shutdown or any of the arguments are not valid.ProposalException
- if an error occurred processing the query.public BlockInfo queryBlockByNumber(long blockNumber) throws InvalidArgumentException, ProposalException
blockNumber
- index of the Block in the chainBlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByNumber(Peer peer, long blockNumber) throws InvalidArgumentException, ProposalException
peer
- the peer to send the request toblockNumber
- index of the Block in the chainBlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(String txID) throws InvalidArgumentException, ProposalException
txID
- the transactionID to query onBlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(Peer peer, String txID) throws InvalidArgumentException, ProposalException
peer
- the peer to send the request totxID
- the transactionID to query onBlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo() throws ProposalException, InvalidArgumentException
BlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo(Peer peer) throws ProposalException, InvalidArgumentException
peer
- The peer to send the request toBlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public TransactionInfo queryTransactionByID(String txID) throws ProposalException, InvalidArgumentException
txID
- the ID of the transactionTransactionInfo
ProposalException
InvalidArgumentException
public TransactionInfo queryTransactionByID(Peer peer, String txID) throws ProposalException, InvalidArgumentException
txID
- the ID of the transactionpeer
- the peer to send the request toTransactionInfo
ProposalException
InvalidArgumentException
public List<org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo> queryInstantiatedChaincodes(Peer peer) throws InvalidArgumentException, ProposalException
peer
- The peer to query.Query.ChaincodeInfo
InvalidArgumentException
ProposalException
public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest) throws ProposalException, InvalidArgumentException
transactionProposalRequest
- The transaction proposal to be sent to all the peers.InvalidArgumentException
ProposalException
public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException
transactionProposalRequest
- The transaction proposal to be sent to the peers.peers
- InvalidArgumentException
ProposalException
public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest) throws InvalidArgumentException, ProposalException
queryByChaincodeRequest
- InvalidArgumentException
ProposalException
public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
queryByChaincodeRequest
- peers
- InvalidArgumentException
ProposalException
public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<ProposalResponse> proposalResponses, User userContext)
proposalResponses
- The proposal responses to be sent to the orderer.userContext
- The usercontext used for signing transaction.public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<ProposalResponse> proposalResponses)
proposalResponses
- .public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<ProposalResponse> proposalResponses, Collection<Orderer> orderers)
proposalResponses
- The proposal responses to be sent to the ordererorderers
- The orderers to send the transaction to.public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<ProposalResponse> proposalResponses, Collection<Orderer> orderers, User userContext)
proposalResponses
- orderers
- public String registerBlockListener(BlockListener listener) throws InvalidArgumentException
listener
- InvalidArgumentException
- if the channel is shutdown.public void shutdown(boolean force)
force
- force immediate shutdown.Copyright © 2017. All rights reserved.