public interface Transaction
createTransaction
method.
限定符和类型 | 方法和说明 |
---|---|
byte[] |
evaluate(String... args)
Evaluate a transaction function and return its results.
|
String |
getName()
Get the fully qualified name of the transaction function.
|
String |
getTransactionId()
Get the transaction ID that will be used when submitting this transaction.
|
Transaction |
setCommitHandler(CommitHandlerFactory commitHandler)
Set the commit handler to use for this transaction invocation instead of the default handler configured for the
gateway.
|
Transaction |
setCommitTimeout(long timeout,
TimeUnit timeUnit)
Set the maximum length of time to wait for commit events to be received after submitting a transaction to the
orderer.
|
Transaction |
setEndorsingPeers(Collection<org.hyperledger.fabric.sdk.Peer> peers)
Set the peers that should be used for endorsement of transaction submitted to the ledger using
submit(String...) . |
Transaction |
setTransient(Map<String,byte[]> transientData)
Set transient data that will be passed to the transaction function
but will not be stored on the ledger.
|
byte[] |
submit(String... args)
Submit a transaction to the ledger.
|
String getName()
String getTransactionId()
DefaultCommitHandlers.NONE
commit handler.Transaction setTransient(Map<String,byte[]> transientData)
transientData
- A Map containing the transient data.Transaction setCommitTimeout(long timeout, TimeUnit timeUnit)
timeout
- the maximum time to wait.timeUnit
- the time unit of the timeout argument.Transaction setCommitHandler(CommitHandlerFactory commitHandler)
commitHandler
- A commit handler implementation.Transaction setEndorsingPeers(Collection<org.hyperledger.fabric.sdk.Peer> peers)
submit(String...)
.peers
- Endorsing peers.byte[] submit(String... args) throws ContractException, TimeoutException, InterruptedException
args
- Transaction function arguments.ContractException
- if the transaction is rejected.TimeoutException
- if the transaction was successfully submitted to the orderer but
timed out before a commit event was received from peers.InterruptedException
- if the current thread is interrupted while waiting.GatewayRuntimeException
- if an underlying infrastructure failure occurs.byte[] evaluate(String... args) throws ContractException
args
- Transaction function arguments.ContractException
- if no peers are reachable or an error response is returned.GatewayRuntimeException
- if an underlying infrastructure failure occurs.Copyright © 2023. All rights reserved.