public final class NodeProxy extends AbstractCloseableNativeProxy implements Node
nativeHandle
Constructor and Description |
---|
NodeProxy(long nativeHandle,
ViewFactory viewFactory)
Creates a proxy of a node.
|
Modifier and Type | Method and Description |
---|---|
protected void |
disposeInternal()
Releases any resources owned by this proxy (e.g., the corresponding native object).
|
byte[] |
getPublicKey()
Returns the public key of this node.
|
void |
submitTransaction(Transaction transaction)
Submits a transaction into Exonum network.
|
<ResultT> ResultT |
withSnapshot(java.util.function.Function<Snapshot,ResultT> snapshotFunction)
Performs a given function with a snapshot of the current database state.
|
close, getNativeHandle
isValidHandle
public NodeProxy(long nativeHandle, ViewFactory viewFactory)
nativeHandle
- an implementation-specific reference to a native nodeviewFactory
- a factory to instantiate native database viewspublic void submitTransaction(Transaction transaction) throws InvalidTransactionException, InternalServerError
submitTransaction
in interface Node
transaction
- a transaction to sendjava.lang.IllegalStateException
- if the node proxy is closedInvalidTransactionException
- if the transaction is not validInternalServerError
- if this node failed to process the transactionpublic <ResultT> ResultT withSnapshot(java.util.function.Function<Snapshot,ResultT> snapshotFunction)
withSnapshot
in interface Node
ResultT
- a type the function returnssnapshotFunction
- a function to executejava.lang.IllegalStateException
- if the node proxy is closedpublic byte[] getPublicKey()
getPublicKey
in interface Node
java.lang.IllegalStateException
- if the node proxy is closedprotected void disposeInternal()
AbstractCloseableNativeProxy
This method is only called once from AbstractCloseableNativeProxy.close()
for a valid
proxy and shall not be called directly.
disposeInternal
in class AbstractCloseableNativeProxy
Copyright © 2018 Exonum. All rights reserved.