Skip to content
Snippets Groups Projects
Commit a12c9ac6 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'dev' into f-consolidation

parents db9a94b6 de91228b
No related branches found
No related tags found
1 merge request!12F consolidation
Pipeline #12174 passed
Pipeline: caosdb-cppinttest

#12177

    ...@@ -38,6 +38,7 @@ set(CMAKE_C_EXTENSIONS OFF) ...@@ -38,6 +38,7 @@ set(CMAKE_C_EXTENSIONS OFF)
    set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD_REQUIRED ON)
    set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
    set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
    set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
    ......
    ...@@ -116,6 +116,7 @@ Please adhere to [Google's C++ naming conventions](https://google.github.io/styl ...@@ -116,6 +116,7 @@ Please adhere to [Google's C++ naming conventions](https://google.github.io/styl
    You can use a json file for the configuration of the client. See You can use a json file for the configuration of the client. See
    `test/test_data/test_caosdb_client.json` for an example. You may use `test/test_data/test_caosdb_client.json` for an example. You may use
    `caosdb-client-configuration-schema.json` to validate your schema. `caosdb-client-configuration-schema.json` to validate your schema.
    Typically, you will need to provide the path to your SSL certificate.
    The client will load the configuration file from the first existing The client will load the configuration file from the first existing
    file in the following locations (precedence from highest to lowest): file in the following locations (precedence from highest to lowest):
    ......
    ...@@ -42,6 +42,8 @@ set(libcaosdb_INCL ...@@ -42,6 +42,8 @@ set(libcaosdb_INCL
    ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/utility.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/utility.h
    ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/value.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/value.h
    ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/register_file_upload_handler.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/upload_request_handler.h
    ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/download_request_handler.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/download_request_handler.h
    ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/file_writer.h ${CMAKE_CURRENT_SOURCE_DIR}/caosdb/file_transmission/file_writer.h
    ......
    ...@@ -65,6 +65,7 @@ using ProtoImportance = caosdb::entity::v1alpha1::Importance; ...@@ -65,6 +65,7 @@ using ProtoImportance = caosdb::entity::v1alpha1::Importance;
    using caosdb::StatusCode; using caosdb::StatusCode;
    using caosdb::entity::v1alpha1::EntityResponse; using caosdb::entity::v1alpha1::EntityResponse;
    using caosdb::entity::v1alpha1::FileTransmissionId; using caosdb::entity::v1alpha1::FileTransmissionId;
    using ::google::protobuf::RepeatedPtrField;
    using google::protobuf::RepeatedPtrField; using google::protobuf::RepeatedPtrField;
    static const std::string logger_name = "caosdb::entity"; static const std::string logger_name = "caosdb::entity";
    ......
    ...@@ -68,6 +68,9 @@ using caosdb::entity::v1alpha1::FileTransmissionService; ...@@ -68,6 +68,9 @@ using caosdb::entity::v1alpha1::FileTransmissionService;
    using caosdb::transaction::HandlerInterface; using caosdb::transaction::HandlerInterface;
    using caosdb::transaction::HandlerTag; using caosdb::transaction::HandlerTag;
    /*
    * Handler for the download request of a single file
    */
    class DownloadRequestHandler final : public HandlerInterface { class DownloadRequestHandler final : public HandlerInterface {
    public: public:
    DownloadRequestHandler(HandlerTag tag, FileTransmissionService::Stub *stub, DownloadRequestHandler(HandlerTag tag, FileTransmissionService::Stub *stub,
    ......
    ...@@ -56,7 +56,14 @@ ...@@ -56,7 +56,14 @@
    namespace caosdb::transaction { namespace caosdb::transaction {
    const static std::string logger_name = "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 { class HandlerInterface {
    public: public:
    HandlerInterface() : transaction_status(TransactionStatus::READY()) {} HandlerInterface() : transaction_status(TransactionStatus::READY()) {}
    ...@@ -65,6 +72,12 @@ public: ...@@ -65,6 +72,12 @@ public:
    virtual void Start() = 0; 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 bool OnNext(bool ok) = 0;
    virtual void Cancel() = 0; virtual void Cancel() = 0;
    ......
    ...@@ -433,6 +433,8 @@ public: ...@@ -433,6 +433,8 @@ public:
    protected: protected:
    /** /**
    * Await and process the current handler's results. * Await and process the current handler's results.
    *
    * This implies consecutive calls to the handler's OnNext function.
    */ */
    auto ProcessCalls() -> TransactionStatus; auto ProcessCalls() -> TransactionStatus;
    ......
    ...@@ -77,7 +77,8 @@ std::size_t FileReader::read(std::string &buffer) { ...@@ -77,7 +77,8 @@ std::size_t FileReader::read(std::string &buffer) {
    if (!stream_.eof()) { if (!stream_.eof()) {
    auto bufferSize = buffer.size(); auto bufferSize = buffer.size();
    if (bufferSize > 0) { if (bufferSize > 0) {
    if (!stream_.read(&buffer[0], bufferSize)) { // TODO(henrik): fix nolint
    if (!stream_.read(&buffer[0], bufferSize)) { // NOLINT
    throw FileIOError("Can't read file: " + filename_.string()); throw FileIOError("Can't read file: " + filename_.string());
    } }
    ......
    ...@@ -68,7 +68,8 @@ void FileWriter::openFile() { ...@@ -68,7 +68,8 @@ void FileWriter::openFile() {
    void FileWriter::write(const std::string &buffer) { void FileWriter::write(const std::string &buffer) {
    auto bufferSize = buffer.size(); auto bufferSize = buffer.size();
    if (bufferSize > 0) { if (bufferSize > 0) {
    if (!stream_.write(buffer.data(), bufferSize)) { // TODO(henrik): fix nolint
    if (!stream_.write(buffer.data(), bufferSize)) { // NOLINT
    throw FileIOError("Can't write file: " + filename_.string()); throw FileIOError("Can't write file: " + filename_.string());
    } }
    } }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment