Interface CAClientType
- All Superinterfaces:
AutoCloseable,com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>,com.io7m.hibiscus.api.HBClientType<CAIMessageType,,CAClientConnectionParameters, CAClientException> com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,,CAClientException> com.io7m.repetoir.core.RPServiceType
- All Known Implementing Classes:
CAClient
public interface CAClientType
extends com.io7m.hibiscus.api.HBClientType<CAIMessageType,CAClientConnectionParameters,CAClientException>, com.io7m.repetoir.core.RPServiceType
The type of client instances.
-
Method Summary
Modifier and TypeMethodDescriptiondefault CAIMessageTypeconnectOrThrow(CAClientConnectionParameters parameters) CallHBClientType.connect(HBConnectionParametersType)but throw an exception if the result is anCAIResponseError.default StringvoidfileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) Download the data associated with the given file.voidfileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) Upload the data associated with the given file.default <R extends CAIResponseType>
RsendAndWaitOrThrow(CAICommandType<R> message, Duration timeout) CallHBIOOperationsType.sendAndWait(HBMessageType, Duration)but throw an exception if the result is anCAIResponseError.transaction(List<CAICommandType<?>> commands) Execute all the given commands in order, in a single transaction.userId()Methods inherited from interface com.io7m.hibiscus.api.HBClientCloseableType
close, isClosedMethods inherited from interface com.io7m.hibiscus.api.HBClientType
connect, disconnect, state, stateNowMethods inherited from interface com.io7m.hibiscus.api.HBIOOperationsType
receive, send, sendAndForget, sendAndWait
-
Method Details
-
description
- Specified by:
descriptionin interfacecom.io7m.repetoir.core.RPServiceType
-
userId
-
fileDownload
void fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException Download the data associated with the given file. The file will be downloaded to a temporary file and then, if everything succeeds and the hash value matches, the temporary file will atomically replace the output file.- Parameters:
fileID- The file IDfile- The output filefileTmp- The temporary output filesize- The expected sizehashAlgorithm- The hash algorithmhashValue- The expected hash valuestatistics- A receiver of transfer statistics- Throws:
CAClientException- On errorsInterruptedException- On interruption
-
fileUpload
void fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException Upload the data associated with the given file.- Parameters:
fileID- The file IDfile- The input filecontentType- The content typedescription- The file descriptionstatistics- A receiver of transfer statistics- Throws:
CAClientException- On errorsInterruptedException- On interruption
-
connectOrThrow
default CAIMessageType connectOrThrow(CAClientConnectionParameters parameters) throws CAClientException, InterruptedException CallHBClientType.connect(HBConnectionParametersType)but throw an exception if the result is anCAIResponseError.- Parameters:
parameters- The connection parameters- Returns:
- The success message
- Throws:
CAClientException- On errorsInterruptedException- On interruption
-
sendAndWaitOrThrow
default <R extends CAIResponseType> R sendAndWaitOrThrow(CAICommandType<R> message, Duration timeout) throws CAClientException, InterruptedException, TimeoutException CallHBIOOperationsType.sendAndWait(HBMessageType, Duration)but throw an exception if the result is anCAIResponseError.- Type Parameters:
R- The type of results- Parameters:
message- The messagetimeout- The timeout- Returns:
- The result
- Throws:
CAClientException- On errorsInterruptedException- On interruptionTimeoutException- On timeouts
-
transaction
List<CAIResponseType> transaction(List<CAICommandType<?>> commands) throws CAClientException, InterruptedException Execute all the given commands in order, in a single transaction.- Parameters:
commands- The commands- Returns:
- The responses
- Throws:
CAClientExceptionInterruptedException
-