diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index af287eba3b9bb6719f9313411ecf8f0ddd42b11f..c0db7a2c007d13394a06bede00d1c601ad83bef2 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -40,6 +40,8 @@ set(libcaosdb_INCL ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/unary_rpc_handler.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/utility.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/register_file_upload_handler.h + # TODO this file is still missing + # ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/register_file_download_handler.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/upload_request_handler.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/download_request_handler.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/file_writer.h diff --git a/include/caosdb/file_transmission/download_request_handler.h b/include/caosdb/file_transmission/download_request_handler.h index c6ee1c36b67c637c8faad901f590a4eee318b7b5..cb2108aa3c9c091316e557c1d732297d84171db9 100644 --- a/include/caosdb/file_transmission/download_request_handler.h +++ b/include/caosdb/file_transmission/download_request_handler.h @@ -68,6 +68,9 @@ using caosdb::entity::v1alpha1::FileTransmissionService; using caosdb::transaction::HandlerInterface; using caosdb::transaction::HandlerTag; +/* + * Handler for the download request of a single file + */ class DownloadRequestHandler final : public HandlerInterface { public: DownloadRequestHandler(HandlerTag tag, FileTransmissionService::Stub *stub, diff --git a/include/caosdb/handler_interface.h b/include/caosdb/handler_interface.h index 4ba563a300175478c8140e9b88c991e2f5321245..f5d77f86c35fe60edbd088afd235ed7ba633c69c 100644 --- a/include/caosdb/handler_interface.h +++ b/include/caosdb/handler_interface.h @@ -56,7 +56,14 @@ namespace caosdb::transaction { const static std::string logger_name = "caosdb::transaction"; - +/* + * Baseclass for UnaryRpcHandler, DownloadRequestHandler and + * UploadRequestHandler + * + * It handles a request: Its status is contained in the transaction_status + * member variable and the functions Start, OnNext and Cancel need to be + * overwritten by child classes. + */ class HandlerInterface { public: HandlerInterface() : transaction_status(TransactionStatus::READY()) {} @@ -65,6 +72,12 @@ public: virtual void Start() = 0; + /* + * ok indicates whether the current request is in a good state or not. If + * ok is false, the request will be ended. + * + * returns false if the handler is done + */ virtual bool OnNext(bool ok) = 0; virtual void Cancel() = 0; diff --git a/include/caosdb/transaction.h b/include/caosdb/transaction.h index 368eb2e10d311ce862cce09c8c417c54da379a5a..bda5bb355b5dc317e6727c8bcea5ac10450e582f 100644 --- a/include/caosdb/transaction.h +++ b/include/caosdb/transaction.h @@ -432,6 +432,8 @@ public: protected: /** * Await and process the current handler's results. + * + * This implies consecutive calls to the handler's OnNext function. */ auto ProcessCalls() -> TransactionStatus;