Package convex.api
Class ConvexRemote
java.lang.Object
convex.api.Convex
convex.api.ConvexRemote
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConnectionCurrent Connection to a Peer, may be null or a closed connection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends ACell>
CompletableFuture<T>Attempts to acquire a complete persistent data structure for the given hash from the connected peer.Gets the consensus state from the connected Peer.voidclose()Disconnects the client from the network, closing the underlying connection.voidClose without affecting the connectionprotected voidconnectToPeer(InetSocketAddress peerAddress, AStore store) Gets the underlying Connection instance for this Client.Gets the Internet address of the currently connected remotebooleanChecks if this Convex client instance has an open remote connection.Submits a query to the Convex network, returning a Future once the query has been successfully queued.requestChallenge(SignedData<ACell> data) Request a challenge.Submits a status request to the Convex network peer, returning a Future once the request has been successfully queued.protected voidsetConnection(Connection conn) Sets the current Connection for this Remote Clienttransact(SignedData<ATransaction> signed) Submits a signed transaction to the Convex network, returning a Future once the transaction has been successfully queued.static ConvexRemotewrap(Connection c) Wraps a connection as a Convex client instanceMethods inherited from class convex.api.Convex
acquire, awaitResult, connect, connect, connect, connect, connectRemote, createAccount, createAccountSync, finalize, getAccountKey, getAddress, getBalance, getSequence, getSequence, isAutoSequence, maybeUpdateSequence, query, query, querySync, querySync, querySync, querySync, querySync, requestStatusSync, setAddress, setAddress, setAutoSequence, setHandler, setKeyPair, setNextSequence, signData, transact, transact, transactSync, transactSync, transactSync, transactSync, transactSync, transfer, transferSync
-
Field Details
-
connection
Current Connection to a Peer, may be null or a closed connection.
-
-
Constructor Details
-
ConvexRemote
-
-
Method Details
-
getRemoteAddress
Gets the Internet address of the currently connected remote- Returns:
- Remote socket address
-
connectToPeer
protected void connectToPeer(InetSocketAddress peerAddress, AStore store) throws IOException, TimeoutException - Throws:
IOExceptionTimeoutException
-
setConnection
Sets the current Connection for this Remote Client- Parameters:
conn- Connection value to use
-
getConnection
Gets the underlying Connection instance for this Client. May be null if not connected.- Returns:
- Connection instance or null
-
isConnected
public boolean isConnected()Checks if this Convex client instance has an open remote connection.- Specified by:
isConnectedin classConvex- Returns:
- true if connected, false otherwise
-
closeButMaintainConnection
public void closeButMaintainConnection()Close without affecting the connection -
acquireState
Gets the consensus state from the connected Peer. The acquired state will be a snapshot of the network global state as calculated by the Peer. SECURITY: Be aware that if this client instance is connected to an untrusted Peer, the Peer may lie about the latest state. If this is a security concern, the client should validate the consensus state independently.- Specified by:
acquireStatein classConvex- Returns:
- Future for consensus state
- Throws:
TimeoutException- If initial status request times out
-
transact
Description copied from class:ConvexSubmits a signed transaction to the Convex network, returning a Future once the transaction has been successfully queued. Updates cached sequence number on best effort basis.- Specified by:
transactin classConvex- Parameters:
signed- Signed transaction to execute- Returns:
- A Future for the result of the transaction
- Throws:
IOException- If the connection is broken
-
query
Description copied from class:ConvexSubmits a query to the Convex network, returning a Future once the query has been successfully queued.- Specified by:
queryin classConvex- Parameters:
query- Query to execute, as a Form or Opaddress- Address to use for the query- Returns:
- A Future for the result of the query
- Throws:
IOException- If the connection is broken, or the send buffer is full
-
requestStatus
Description copied from class:ConvexSubmits a status request to the Convex network peer, returning a Future once the request has been successfully queued.- Specified by:
requestStatusin classConvex- Returns:
- A Future for the result of the requestStatus
-
requestChallenge
Description copied from class:ConvexRequest a challenge. This is request is made by any peer that needs to find out if another peer can be trusted.- Specified by:
requestChallengein classConvex- Parameters:
data- Signed data to send to the peer for the challenge.- Returns:
- A Future for the result of the requestChallenge
- Throws:
IOException- if the connection fails.
-
acquire
Description copied from class:ConvexAttempts to acquire a complete persistent data structure for the given hash from the connected peer. Uses the store provided as a destination. -
close
public void close()Disconnects the client from the network, closing the underlying connection. -
wrap
Wraps a connection as a Convex client instance- Parameters:
c- Connection to wrap- Returns:
- New Convex client instance using underlying connection
-