Package convex.api
Class ConvexLocal
java.lang.Object
convex.api.Convex
convex.api.ConvexLocal
Convex Client implementation supporting a direct connection to a Peer Server in the same JVM.
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConvexLocal(Server server, Address address, AKeyPair keyPair) -
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 remote Peervoidclose()Disconnects the client from the network, releasing any connection resources.static ConvexLocallongGets the current sequence number for this Client, which is the sequence number of the last transaction observed for the current client's Account.longgetSequence(Address addr) Gets the current sequence number for an account, which is the sequence number of the last transaction observed for the Account.booleanChecks if this Convex client instance has an open 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.transact(SignedData<ATransaction> signed) Submits a signed transaction to the Convex network, returning a Future once the transaction has been successfully queued.Methods inherited from class convex.api.Convex
acquire, awaitResult, connect, connect, connect, connect, connectRemote, createAccount, createAccountSync, finalize, getAccountKey, getAddress, getBalance, 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
-
Constructor Details
-
ConvexLocal
-
-
Method Details
-
create
-
isConnected
public boolean isConnected()Description copied from class:ConvexChecks if this Convex client instance has an open connection.- Specified by:
isConnectedin classConvex- Returns:
- true if connected, false otherwise
-
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. -
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
-
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. -
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
-
query
Description copied from class:ConvexSubmits a query to the Convex network, returning a Future once the query has been successfully queued. -
close
public void close()Description copied from class:ConvexDisconnects the client from the network, releasing any connection resources. -
acquireState
Description copied from class:ConvexGets the consensus state from the remote Peer- Specified by:
acquireStatein classConvex- Returns:
- Future for consensus state
- Throws:
TimeoutException- If initial status request times out
-
getSequence
public long getSequence()Description copied from class:ConvexGets the current sequence number for this Client, which is the sequence number of the last transaction observed for the current client's Account. Will attempt to acquire the sequence number from the network if not known. The next valid sequence number will be one higher than the result.- Overrides:
getSequencein classConvex- Returns:
- Sequence number as a Long value (zero or positive)
-
getSequence
Description copied from class:ConvexGets the current sequence number for an account, which is the sequence number of the last transaction observed for the Account. Will attempt to acquire the sequence number from the network if not known.- Overrides:
getSequencein classConvex- Parameters:
addr- Address for which to query the sequence number- Returns:
- Sequence number as a Long value (zero or positive)
-