Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 108-implement-rpc-call-for-server-side-scripting
  • dev
  • f-consol-message
  • f-rel-path
  • f-related-projects
  • f-remote-path
  • f-role
  • f-sss4grpc
  • f-to-string
  • f-update-requirements
  • f-windows-conan-create
  • main
  • v0.0.1
  • v0.0.10
  • v0.0.15
  • v0.0.16
  • v0.0.18
  • v0.0.19
  • v0.0.2
  • v0.0.3
  • v0.0.4
  • v0.0.5
  • v0.0.6
  • v0.0.7
  • v0.0.8
  • v0.0.9
  • v0.1
  • v0.1.1
  • v0.1.2
  • v0.2.0
  • v0.2.1
  • v0.2.2
  • v0.3.0
33 results

Target

Select target project
  • caosdb/src/caosdb-cpplib
1 result
Select Git revision
  • 108-implement-rpc-call-for-server-side-scripting
  • dev
  • f-consol-message
  • f-rel-path
  • f-related-projects
  • f-remote-path
  • f-role
  • f-sss4grpc
  • f-to-string
  • f-update-requirements
  • f-windows-conan-create
  • main
  • v0.0.1
  • v0.0.10
  • v0.0.15
  • v0.0.16
  • v0.0.18
  • v0.0.19
  • v0.0.2
  • v0.0.3
  • v0.0.4
  • v0.0.5
  • v0.0.6
  • v0.0.7
  • v0.0.8
  • v0.0.9
  • v0.1
  • v0.1.1
  • v0.1.2
  • v0.2.0
  • v0.2.1
  • v0.2.2
  • v0.3.0
33 results
Show changes
Showing
with 302 additions and 185 deletions
......@@ -49,8 +49,8 @@
#ifndef CAOSDB_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H
#define CAOSDB_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H
#include "caosdb/entity/v1alpha1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1alpha1/main.pb.h" // for FileDownloadResponse
#include "caosdb/entity/v1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse
#include "caosdb/handler_interface.h" // for HandlerTag, Handl...
#include "caosdb/unary_rpc_handler.h"
#include <grpcpp/impl/codegen/async_unary_call.h> // for ClientAsyncRespons...
......@@ -59,9 +59,9 @@
namespace caosdb::transaction {
using caosdb::entity::v1alpha1::FileTransmissionService;
using caosdb::entity::v1alpha1::RegisterFileUploadRequest;
using caosdb::entity::v1alpha1::RegisterFileUploadResponse;
using caosdb::entity::v1::FileTransmissionService;
using caosdb::entity::v1::RegisterFileUploadRequest;
using caosdb::entity::v1::RegisterFileUploadResponse;
class RegisterFileUploadHandler final : public UnaryRpcHandler {
public:
......
......@@ -50,8 +50,8 @@
#define CAOSDB_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H
#include "caosdb/entity.h" // for FileDescriptor
#include "caosdb/entity/v1alpha1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1alpha1/main.pb.h" // for FileUploadRequest
#include "caosdb/entity/v1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1/main.pb.h" // for FileUploadRequest
#include "caosdb/file_transmission/file_reader.h" // for FileReader
#include "caosdb/handler_interface.h" // for HandlerTag, Handl...
#include <cstdint> // for uint64_t
......@@ -63,9 +63,9 @@
namespace caosdb::transaction {
using caosdb::entity::FileDescriptor;
using caosdb::entity::v1alpha1::FileTransmissionService;
using caosdb::entity::v1alpha1::FileUploadRequest;
using caosdb::entity::v1alpha1::FileUploadResponse;
using caosdb::entity::v1::FileTransmissionService;
using caosdb::entity::v1::FileUploadRequest;
using caosdb::entity::v1::FileUploadResponse;
using caosdb::transaction::HandlerInterface;
using caosdb::transaction::HandlerTag;
......
......@@ -27,13 +27,13 @@
* @date 2021-07-02
* @brief General information about the CaosDBServer.
*/
#include "caosdb/info/v1alpha1/main.pb.h" // for VersionInfo
#include "caosdb/info/v1/main.pb.h" // for VersionInfo
#include <cstdint> // for uint32_t
#include <string> // for string
namespace caosdb::info {
using ProtoVersionInfo = caosdb::info::v1alpha1::VersionInfo;
using ProtoVersionInfo = caosdb::info::v1::VersionInfo;
/**
* A read-only version object which represents the version of the server.
......
......@@ -24,12 +24,11 @@
#define CAOSDB_LOGGING_H
#include "caosdb/log_level.h" // for CAOSDB_LOG_...
#include "boost/log/sources/global_logger_storage.hpp" // for BOOST_LOG_I...
#include "boost/log/sources/record_ostream.hpp" // IWYU pragma: keep
#include "boost/log/sources/severity_channel_logger.hpp" // for BOOST_LOG_C...
#include "boost/log/utility/setup/settings.hpp" // for settings
#include "boost/smart_ptr/intrusive_ptr.hpp" // for intrusive_ptr
#include "boost/smart_ptr/intrusive_ref_counter.hpp" // for intrusive_p...
#include <boost/log/sources/record_ostream.hpp> // IWYU pragma: keep
#include <boost/log/sources/severity_channel_logger.hpp> // for BOOST_LOG_C...
#include <boost/log/utility/setup/settings.hpp> // for settings
#include <boost/smart_ptr/intrusive_ptr.hpp> // for intrusive_ptr
#include <boost/smart_ptr/intrusive_ref_counter.hpp> // for intrusive_p...
#include <memory> // for shared_ptr
#include <string> // for string
#include <vector> // for vector
......@@ -40,7 +39,17 @@ const std::string logger_name = "caosdb::logging";
typedef boost::log::sources::severity_channel_logger_mt<int, std::string> boost_logger_class;
BOOST_LOG_GLOBAL_LOGGER(logger, boost_logger_class)
class logger {
public:
static auto get() -> boost_logger_class & { return logger::GetInstance()._logger_instance; }
private:
static logger &GetInstance() {
static logger instance;
return instance;
}
boost_logger_class _logger_instance;
};
/**
* This class stores the integer log level.
......
......@@ -22,7 +22,7 @@
#ifndef CAOSDB_MESSAGE_CODE_H
#define CAOSDB_MESSAGE_CODE_H
#include "caosdb/entity/v1alpha1/main.pb.h" // for Entity, RepeatedField
#include "caosdb/entity/v1/main.pb.h" // for Entity, RepeatedField
/**
* MessageCodes for entity messages.
......@@ -38,16 +38,68 @@
namespace caosdb::entity {
#define _MAP_MESSAGE_CODE(name) name = caosdb::entity::v1::MessageCode::MESSAGE_CODE_##name
enum MessageCode {
UNSPECIFIED = caosdb::entity::v1alpha1::MessageCode::MESSAGE_CODE_UNSPECIFIED,
UNKNOWN = caosdb::entity::v1alpha1::MessageCode::MESSAGE_CODE_UNKNOWN,
ENTITY_DOES_NOT_EXIST = caosdb::entity::v1alpha1::MessageCode::MESSAGE_CODE_ENTITY_DOES_NOT_EXIST,
ENTITY_HAS_NO_PROPERTIES =
caosdb::entity::v1alpha1::MessageCode::MESSAGE_CODE_ENTITY_HAS_NO_PROPERTIES,
INTEGER_VALUE_OUT_OF_RANGE =
caosdb::entity::v1alpha1::MessageCode::MESSAGE_CODE_INTEGER_VALUE_OUT_OF_RANGE,
ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY =
caosdb::entity::v1alpha1::MessageCode::MESSAGE_CODE_ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY,
_MAP_MESSAGE_CODE(UNSPECIFIED),
_MAP_MESSAGE_CODE(UNKNOWN),
_MAP_MESSAGE_CODE(ENTITY_DOES_NOT_EXIST),
_MAP_MESSAGE_CODE(ENTITY_HAS_NO_PROPERTIES),
_MAP_MESSAGE_CODE(ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY),
_MAP_MESSAGE_CODE(ENTITY_HAS_UNQUALIFIED_PROPERTIES),
_MAP_MESSAGE_CODE(ENTITY_HAS_UNQUALIFIED_PARENTS),
_MAP_MESSAGE_CODE(ENTITY_HAS_NO_ID),
_MAP_MESSAGE_CODE(REQUIRED_BY_PERSISTENT_ENTITY),
_MAP_MESSAGE_CODE(PROPERTY_HAS_NO_DATA_TYPE),
_MAP_MESSAGE_CODE(ENTITY_HAS_NO_DESCRIPTION),
_MAP_MESSAGE_CODE(ENTITY_HAS_NO_NAME),
_MAP_MESSAGE_CODE(OBLIGATORY_PROPERTY_MISSING),
_MAP_MESSAGE_CODE(ENTITY_HAS_NO_PARENTS),
_MAP_MESSAGE_CODE(FILE_HAS_NO_TARGET_PATH),
_MAP_MESSAGE_CODE(TARGET_PATH_NOT_ALLOWED),
_MAP_MESSAGE_CODE(TARGET_PATH_EXISTS),
_MAP_MESSAGE_CODE(PROPERTY_HAS_NO_UNIT),
_MAP_MESSAGE_CODE(CANNOT_PARSE_VALUE),
_MAP_MESSAGE_CODE(CHECKSUM_TEST_FAILED),
_MAP_MESSAGE_CODE(SIZE_TEST_FAILED),
_MAP_MESSAGE_CODE(CANNOT_CREATE_PARENT_FOLDER),
_MAP_MESSAGE_CODE(FILE_HAS_NOT_BEEN_UPLOAED),
_MAP_MESSAGE_CODE(CANNOT_MOVE_FILE_TO_TARGET_PATH),
_MAP_MESSAGE_CODE(CANNOT_PARSE_DATETIME_VALUE),
_MAP_MESSAGE_CODE(CANNOT_PARSE_DOUBLE_VALUE),
_MAP_MESSAGE_CODE(CANNOT_PARSE_INT_VALUE),
_MAP_MESSAGE_CODE(CANNOT_PARSE_BOOL_VALUE),
_MAP_MESSAGE_CODE(FILE_NOT_FOUND),
_MAP_MESSAGE_CODE(WARNING_OCCURED),
_MAP_MESSAGE_CODE(ENTITY_NAME_IS_NOT_UNIQUE),
_MAP_MESSAGE_CODE(QUERY_EXCEPTION),
_MAP_MESSAGE_CODE(TRANSACTION_ROLL_BACK),
_MAP_MESSAGE_CODE(UNKNOWN_UNIT),
_MAP_MESSAGE_CODE(AUTHORIZATION_ERROR),
_MAP_MESSAGE_CODE(REFERENCE_IS_NOT_ALLOWED_BY_DATA_TYPE),
_MAP_MESSAGE_CODE(ENTITY_NAME_DUPLICATES),
_MAP_MESSAGE_CODE(DATA_TYPE_NAME_DUPLICATES),
_MAP_MESSAGE_CODE(ENTITY_HAS_NO_NAME_OR_ID),
_MAP_MESSAGE_CODE(AFFILIATION_ERROR),
_MAP_MESSAGE_CODE(QUERY_PARSING_ERROR),
_MAP_MESSAGE_CODE(NAME_PROPERTIES_MUST_BE_TEXT),
_MAP_MESSAGE_CODE(PARENT_DUPLICATES_WARNING),
_MAP_MESSAGE_CODE(PARENT_DUPLICATES_ERROR),
_MAP_MESSAGE_CODE(ATOMICITY_ERROR),
_MAP_MESSAGE_CODE(NO_SUCH_ENTITY_ROLE),
_MAP_MESSAGE_CODE(REQUIRED_BY_UNQUALIFIED),
_MAP_MESSAGE_CODE(ENTITY_HAS_UNQUALIFIED_REFERENCE),
_MAP_MESSAGE_CODE(REFERENCED_ENTITY_DOES_NOT_EXIST),
_MAP_MESSAGE_CODE(REFERENCE_NAME_DUPLICATES),
_MAP_MESSAGE_CODE(DATA_TYPE_INHERITANCE_AMBIGUOUS),
_MAP_MESSAGE_CODE(DATA_TYPE_DOES_NOT_ACCEPT_COLLECTION_VALUES),
_MAP_MESSAGE_CODE(CANNOT_PARSE_UNIT),
_MAP_MESSAGE_CODE(ADDITIONAL_PROPERTY),
_MAP_MESSAGE_CODE(PROPERTY_WITH_DATA_TYPE_OVERRIDE),
_MAP_MESSAGE_CODE(PROPERTY_WITH_DESCRIPTION_OVERRIDE),
_MAP_MESSAGE_CODE(PROPERTY_WITH_NAME_OVERRIDE),
_MAP_MESSAGE_CODE(INTEGER_VALUE_OUT_OF_RANGE),
_MAP_MESSAGE_CODE(INTEGRITY_VIOLATION),
};
[[nodiscard]] inline auto get_message_code(int code) noexcept -> MessageCode {
......@@ -57,12 +109,65 @@ enum MessageCode {
MessageCode::UNKNOWN,
MessageCode::ENTITY_DOES_NOT_EXIST,
MessageCode::ENTITY_HAS_NO_PROPERTIES,
MessageCode::INTEGER_VALUE_OUT_OF_RANGE,
MessageCode::ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY,
MessageCode::ENTITY_HAS_UNQUALIFIED_PROPERTIES,
MessageCode::ENTITY_HAS_UNQUALIFIED_PARENTS,
MessageCode::ENTITY_HAS_NO_ID,
MessageCode::REQUIRED_BY_PERSISTENT_ENTITY,
MessageCode::PROPERTY_HAS_NO_DATA_TYPE,
MessageCode::ENTITY_HAS_NO_DESCRIPTION,
MessageCode::ENTITY_HAS_NO_NAME,
MessageCode::OBLIGATORY_PROPERTY_MISSING,
MessageCode::ENTITY_HAS_NO_PARENTS,
MessageCode::FILE_HAS_NO_TARGET_PATH,
MessageCode::TARGET_PATH_NOT_ALLOWED,
MessageCode::TARGET_PATH_EXISTS,
MessageCode::PROPERTY_HAS_NO_UNIT,
MessageCode::CANNOT_PARSE_VALUE,
MessageCode::CHECKSUM_TEST_FAILED,
MessageCode::SIZE_TEST_FAILED,
MessageCode::CANNOT_CREATE_PARENT_FOLDER,
MessageCode::FILE_HAS_NOT_BEEN_UPLOAED,
MessageCode::CANNOT_MOVE_FILE_TO_TARGET_PATH,
MessageCode::CANNOT_PARSE_DATETIME_VALUE,
MessageCode::CANNOT_PARSE_DOUBLE_VALUE,
MessageCode::CANNOT_PARSE_INT_VALUE,
MessageCode::CANNOT_PARSE_BOOL_VALUE,
MessageCode::FILE_NOT_FOUND,
MessageCode::WARNING_OCCURED,
MessageCode::ENTITY_NAME_IS_NOT_UNIQUE,
MessageCode::QUERY_EXCEPTION,
MessageCode::TRANSACTION_ROLL_BACK,
MessageCode::UNKNOWN_UNIT,
MessageCode::AUTHORIZATION_ERROR,
MessageCode::REFERENCE_IS_NOT_ALLOWED_BY_DATA_TYPE,
MessageCode::ENTITY_NAME_DUPLICATES,
MessageCode::DATA_TYPE_NAME_DUPLICATES,
MessageCode::ENTITY_HAS_NO_NAME_OR_ID,
MessageCode::AFFILIATION_ERROR,
MessageCode::QUERY_PARSING_ERROR,
MessageCode::NAME_PROPERTIES_MUST_BE_TEXT,
MessageCode::PARENT_DUPLICATES_WARNING,
MessageCode::PARENT_DUPLICATES_ERROR,
MessageCode::ATOMICITY_ERROR,
MessageCode::NO_SUCH_ENTITY_ROLE,
MessageCode::REQUIRED_BY_UNQUALIFIED,
MessageCode::ENTITY_HAS_UNQUALIFIED_REFERENCE,
MessageCode::REFERENCED_ENTITY_DOES_NOT_EXIST,
MessageCode::REFERENCE_NAME_DUPLICATES,
MessageCode::DATA_TYPE_INHERITANCE_AMBIGUOUS,
MessageCode::DATA_TYPE_DOES_NOT_ACCEPT_COLLECTION_VALUES,
MessageCode::CANNOT_PARSE_UNIT,
MessageCode::ADDITIONAL_PROPERTY,
MessageCode::PROPERTY_WITH_DATA_TYPE_OVERRIDE,
MessageCode::PROPERTY_WITH_DESCRIPTION_OVERRIDE,
MessageCode::PROPERTY_WITH_NAME_OVERRIDE,
MessageCode::INTEGER_VALUE_OUT_OF_RANGE,
MessageCode::INTEGRITY_VIOLATION,
};
for (MessageCode known_code : all_codes) {
if (known_code == code) {
if (static_cast<int>(known_code) == code) {
return known_code;
}
}
......
......@@ -22,9 +22,8 @@
#ifndef CAOSDB_PROTOBUF_HELPER_H
#define CAOSDB_PROTOBUF_HELPER_H
// IWYU pragma: no_include <google/protobuf/extension_set.h>
#include <google/protobuf/arena.h> // for Arena
// IWYU pragma: no_include "google/protobuf/extension_set.h"
// IWYU pragma: no_include "google/protobuf/generated_message_util.h"
#include <google/protobuf/util/json_util.h> // for JsonOptions, MessageToJs...
#include <string> // for string
......@@ -41,6 +40,7 @@ namespace caosdb::utility {
using google::protobuf::Arena;
auto get_arena() -> Arena *;
auto reset_arena() -> void;
/**
* Abstract wrapper class for Protobuf messages.
......
......@@ -62,12 +62,12 @@ enum StatusCode {
GENERIC_ERROR = 21,
GENERIC_TRANSACTION_ERROR = 22,
CONFIGURATION_ERROR = 23,
UNKNOWN_CONNECTION_ERROR = 24,
CONNECTION_CONFIGURATION_ERROR = 24,
TRANSACTION_STATUS_ERROR = 25,
TRANSACTION_TYPE_ERROR = 26,
UNSUPPORTED_FEATURE = 27,
ORIGINAL_ENTITY_MISSING_ID = 28,
EXTERN_C_ASSIGNMENT_ERROR = 29,
// EXTERN_C_ASSIGNMENT_ERROR = 29,
ENTITY_CANNOT_HAVE_A_DATA_TYPE = 30,
ENTITY_CANNOT_HAVE_A_VALUE = 31,
NOT_A_FILE_ENTITY = 32,
......
......@@ -22,8 +22,8 @@
#define CAOSDB_TRANSACTION_H
#include "caosdb/entity.h" // for Entity, FileDe...
#include "caosdb/entity/v1alpha1/main.grpc.pb.h" // for EntityTransact...
#include "caosdb/entity/v1alpha1/main.pb.h" // for MultiTransacti...
#include "caosdb/entity/v1/main.grpc.pb.h" // for EntityTransact...
#include "caosdb/entity/v1/main.pb.h" // for MultiTransacti...
#include "caosdb/handler_interface.h" // for HandlerInterface
#include "caosdb/transaction_handler.h" // for EntityTransactionHandler
#include "caosdb/logging.h" // for CAOSDB_LOG_ERR...
......@@ -55,12 +55,12 @@
return StatusCode::TRANSACTION_STATUS_ERROR; \
} \
switch (this->transaction_type) { \
case NONE: \
case TransactionType::NONE: \
this->transaction_type = TransactionType::READ_ONLY; \
break; \
case READ_ONLY: \
case TransactionType::READ_ONLY: \
break; \
case MIXED_READ_AND_WRITE: \
case TransactionType::MIXED_READ_AND_WRITE: \
break; \
default: \
CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \
......@@ -91,11 +91,11 @@
return StatusCode::TRANSACTION_STATUS_ERROR; \
} \
switch (this->transaction_type) { \
case NONE: \
case TransactionType::NONE: \
this->transaction_type = TransactionType::MIXED_WRITE; \
case DELETE: \
case MIXED_WRITE: \
case MIXED_READ_AND_WRITE: \
case TransactionType::DELETE_ONLY: \
case TransactionType::MIXED_WRITE: \
case TransactionType::MIXED_READ_AND_WRITE: \
break; \
default: \
CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \
......@@ -113,11 +113,11 @@
return StatusCode::TRANSACTION_STATUS_ERROR; \
} \
switch (this->transaction_type) { \
case NONE: \
case TransactionType::NONE: \
this->transaction_type = TransactionType::MIXED_WRITE; \
case INSERT: \
case MIXED_WRITE: \
case MIXED_READ_AND_WRITE: \
case TransactionType::INSERT_ONLY: \
case TransactionType::MIXED_WRITE: \
case TransactionType::MIXED_READ_AND_WRITE: \
break; \
default: \
CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \
......@@ -135,11 +135,11 @@
return StatusCode::TRANSACTION_STATUS_ERROR; \
} \
switch (this->transaction_type) { \
case NONE: \
case TransactionType::NONE: \
this->transaction_type = TransactionType::MIXED_WRITE; \
case UPDATE: \
case MIXED_WRITE: \
case MIXED_READ_AND_WRITE: \
case TransactionType::UPDATE_ONLY: \
case TransactionType::MIXED_WRITE: \
case TransactionType::MIXED_READ_AND_WRITE: \
break; \
default: \
CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \
......@@ -163,22 +163,21 @@
namespace caosdb::transaction {
using caosdb::entity::Entity;
using caosdb::entity::FileDescriptor;
using caosdb::entity::v1alpha1::EntityResponse;
using caosdb::entity::v1alpha1::EntityTransactionService;
using caosdb::entity::v1alpha1::FileDownloadRequest;
using caosdb::entity::v1alpha1::FileDownloadResponse;
using caosdb::entity::v1alpha1::FileTransmissionId;
using caosdb::entity::v1alpha1::FileTransmissionService;
using caosdb::entity::v1alpha1::FileUploadRequest;
using caosdb::entity::v1alpha1::FileUploadResponse;
using caosdb::entity::v1alpha1::IdResponse;
using caosdb::entity::v1alpha1::MultiTransactionRequest;
using caosdb::entity::v1alpha1::MultiTransactionResponse;
using caosdb::entity::v1alpha1::RegisterFileUploadRequest;
using caosdb::entity::v1alpha1::RegisterFileUploadResponse;
using caosdb::entity::v1::EntityResponse;
using caosdb::entity::v1::EntityTransactionService;
using caosdb::entity::v1::FileDownloadRequest;
using caosdb::entity::v1::FileDownloadResponse;
using caosdb::entity::v1::FileTransmissionId;
using caosdb::entity::v1::FileTransmissionService;
using caosdb::entity::v1::FileUploadRequest;
using caosdb::entity::v1::FileUploadResponse;
using caosdb::entity::v1::IdResponse;
using caosdb::entity::v1::MultiTransactionRequest;
using caosdb::entity::v1::MultiTransactionResponse;
using caosdb::entity::v1::RegisterFileUploadRequest;
using caosdb::entity::v1::RegisterFileUploadResponse;
using caosdb::transaction::TransactionStatus;
using TransactionResponseCase =
caosdb::entity::v1alpha1::TransactionResponse::TransactionResponseCase;
using TransactionResponseCase = caosdb::entity::v1::TransactionResponse::TransactionResponseCase;
using caosdb::utility::get_arena;
using google::protobuf::Arena;
......@@ -288,9 +287,9 @@ public:
enum TransactionType {
NONE, //!< Unspecified or not specified yet.
READ_ONLY, //!< Only retrievals (by id, by query)
INSERT, //!< Only insertions
UPDATE, //!< Only updates
DELETE, //!< Only deletions
INSERT_ONLY, //!< Only insertions
UPDATE_ONLY, //!< Only updates
DELETE_ONLY, //!< Only deletions
MIXED_WRITE, //!< Only insertions, deletions, updates
MIXED_READ_AND_WRITE //!< all kind of transaction.
};
......@@ -407,7 +406,7 @@ public:
* Instead, do Execute() or WaitForIt() and only call this method afterwards.
*/
[[nodiscard]] inline auto GetResultSet() const noexcept -> const ResultSet & {
if (!this->result_set) {
if (this->result_set == nullptr) {
CAOSDB_LOG_ERROR(logger_name)
<< "GetResultSet was called before the transaction has terminated. This is a programming "
"error of the code which uses the transaction.";
......@@ -518,11 +517,6 @@ private:
std::vector<FileDescriptor> upload_files;
std::map<std::string, FileDescriptor> download_files;
// auto RegisterUploadFile(RegisterFileUploadResponse *response) -> void;
auto UploadFile(FileUploadResponse *response, const FileDescriptor &file_descriptor,
const std::string &registration_id) -> void;
auto DownloadFile(FileDownloadResponse *response, const FileTransmissionId &file_transmission_id)
-> void;
bool has_query = false;
TransactionType transaction_type = TransactionType::NONE;
mutable std::unique_ptr<ResultSet> result_set;
......
#pragma once
#include "caosdb/entity/v1alpha1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1alpha1/main.pb.h" // for FileDownloadResponse
#include "caosdb/entity/v1/main.grpc.pb.h" // for FileTransmissionS...
#include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse
#include "caosdb/handler_interface.h" // for HandlerTag
#include "caosdb/unary_rpc_handler.h" // for HandlerTag, Handl...
#include <grpcpp/impl/codegen/async_unary_call.h> // for ClientAsyncRespons...
......@@ -9,9 +9,9 @@
namespace caosdb::transaction {
using caosdb::entity::v1alpha1::EntityTransactionService;
using caosdb::entity::v1alpha1::MultiTransactionRequest;
using caosdb::entity::v1alpha1::MultiTransactionResponse;
using caosdb::entity::v1::EntityTransactionService;
using caosdb::entity::v1::MultiTransactionRequest;
using caosdb::entity::v1::MultiTransactionResponse;
class EntityTransactionHandler final : public UnaryRpcHandler {
public:
......
......@@ -25,15 +25,13 @@
#include "caosdb/entity.h" // for Importance, Role
#include <boost/beast/core/detail/base64.hpp> // for encoded_size
#include <boost/beast/core/detail/base64.ipp> // for encode
#include <boost/filesystem/operations.hpp> // for exists
#include <boost/filesystem/path.hpp> // for path
#include <boost/filesystem/fstream.hpp> // for basic_ifstream, ifstream
#include <boost/filesystem/string_file.hpp> // for load_string_file
#include <boost/json/stream_parser.hpp> // for stream_parser
#include <boost/json/value.hpp> // for value
#include <boost/lexical_cast.hpp> // for lexical_cast
#include <cassert> // for assert
#include <cstdlib> // for getenv
#include <filesystem> // for path
#include <fstream> // for basic_istream<>::__ist...
#include <memory> // for allocator, unique_ptr
#include <stdexcept> // for logic_error
......@@ -42,11 +40,11 @@
#include <typeinfo> // for type_info
namespace caosdb::utility {
using boost::filesystem::exists;
using boost::filesystem::ifstream;
using boost::filesystem::path;
using boost::json::stream_parser;
using boost::json::value;
using std::ifstream;
using std::filesystem::exists;
using std::filesystem::path;
/**
* @brief Get the name of the enum value. May be useful for higher-order CaosDB clients.
......@@ -86,9 +84,9 @@ auto getEnumValueFromName<caosdb::entity::Role>(const std::string &name) -> caos
/**
* @brief Read a text file into a string and return the file's content.
*/
inline auto load_string_file(const path &path) -> std::string {
inline auto load_string_file(const path &file_path) -> std::string {
std::string result;
boost::filesystem::load_string_file(path, result);
boost::filesystem::load_string_file(file_path.string(), result);
return result;
}
......
......@@ -22,7 +22,7 @@
#ifndef CAOSDB_VALUE_H
#define CAOSDB_VALUE_H
#include "caosdb/protobuf_helper.h" // for ProtoMessageWrapper
#include "caosdb/entity/v1alpha1/main.pb.h" // for RepeatedPtrField, Message
#include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField, Message
#include <cstdint> // for int64_t
#include <google/protobuf/arena.h> // for Arena
#include <memory> // for unique_ptr
......@@ -43,11 +43,11 @@ using caosdb::utility::get_arena;
using caosdb::utility::ProtoMessageWrapper;
using caosdb::utility::ScalarProtoMessageWrapper;
using google::protobuf::Arena;
using ProtoSpecialValue = caosdb::entity::v1alpha1::SpecialValue;
using ProtoValue = caosdb::entity::v1alpha1::Value;
using ProtoScalarValue = caosdb::entity::v1alpha1::ScalarValue;
using ValueCase = caosdb::entity::v1alpha1::Value::ValueCase;
using ScalarValueCase = caosdb::entity::v1alpha1::ScalarValue::ScalarValueCase;
using ProtoSpecialValue = caosdb::entity::v1::SpecialValue;
using ProtoValue = caosdb::entity::v1::Value;
using ProtoScalarValue = caosdb::entity::v1::ScalarValue;
using ValueCase = caosdb::entity::v1::Value::ValueCase;
using ScalarValueCase = caosdb::entity::v1::ScalarValue::ScalarValueCase;
class ScalarValue;
class Value;
......
......@@ -20,10 +20,14 @@
*
*/
#include <cstdint> // for int64_t
#ifndef CCAOSDB_H
#define CCAOSDB_H
#ifdef __cplusplus
#include <cstdint> // for int64_t
extern "C" {
#else
#include <stdint.h> // for int64_t
#include <stdbool.h> // for bool
#endif
/**
......@@ -70,7 +74,7 @@ int caosdb_status_code_OTHER_CLIENT_ERROR();
*/
typedef struct caosdb_connection_connection {
void *wrapped_connection;
bool _deletable = false;
bool _deletable;
} caosdb_connection_connection;
/**
......@@ -82,7 +86,7 @@ typedef struct caosdb_connection_connection {
*/
typedef struct caosdb_connection_connection_configuration {
void *wrapped_connection_configuration;
bool _deletable = false;
bool _deletable;
} caosdb_connection_connection_configuration;
/**
......@@ -102,12 +106,12 @@ typedef struct caosdb_info_version_info {
typedef struct caosdb_connection_certificate_provider {
void *wrapped_certificate_provider;
bool _deletable = false;
bool _deletable;
} caosdb_connection_certificate_provider;
typedef struct caosdb_authentication_authenticator {
void *wrapped_authenticator;
bool _deletable = false;
bool _deletable;
} caosdb_authentication_authenticator;
/**
......@@ -266,7 +270,7 @@ int caosdb_connection_connection_manager_get_connection(caosdb_connection_connec
typedef struct caosdb_transaction_transaction {
void *wrapped_transaction;
bool _deletable = false;
bool _deletable;
} caosdb_transaction_transaction;
/**
......@@ -292,12 +296,12 @@ int caosdb_transaction_transaction_execute(caosdb_transaction_transaction *trans
typedef struct caosdb_transaction_result_set {
void *wrapped_result_set;
bool _deletable = false;
bool _deletable;
} caosdb_transaction_result_set;
typedef struct caosdb_entity_entity {
void *wrapped_entity;
bool _deletable = false;
bool _deletable;
} caosdb_entity_entity;
int caosdb_transaction_transaction_get_result_set(caosdb_transaction_transaction *transaction,
......@@ -348,27 +352,27 @@ int caosdb_transaction_transaction_delete_by_id(caosdb_transaction_transaction *
typedef struct caosdb_entity_property {
void *wrapped_property;
bool _deletable = false;
bool _deletable;
} caosdb_entity_property;
typedef struct caosdb_entity_parent {
void *wrapped_parent;
bool _deletable = false;
bool _deletable;
} caosdb_entity_parent;
typedef struct caosdb_entity_message {
void *wrapped_message;
bool _deletable = false;
bool _deletable;
} caosdb_entity_message;
typedef struct caosdb_entity_value {
void *wrapped_value;
bool _deletable = false;
bool _deletable;
} caosdb_entity_value;
typedef struct caosdb_entity_datatype {
void *wrapped_datatype;
bool _deletable = false;
bool _deletable;
} caosdb_entity_datatype;
// GETTERS FOR EVERYTHING
......@@ -494,3 +498,4 @@ int caosdb_entity_parent_set_name(caosdb_entity_parent *parent, const char *name
#ifdef __cplusplus
}
#endif
#endif
Subproject commit 73d85fb20bb16902c0a89dda697eed17994712bc
Subproject commit 533c8e7341d0659e3cc43d834793a7a965703f55
attrs==21.2.0
bottle==0.12.19
certifi==2021.5.30
certifi==2021.10.8
chardet==4.0.0
charset-normalizer==2.0.7
colorama==0.4.4
conan==1.40.3
deprecation==2.0.7
distro==1.5.0
conan==1.48.0
deprecation==2.1.0
distro==1.6.0
fasteners==0.16.3
future==0.18.2
idna==2.10
Jinja2==2.11.3
jsonschema==3.2.0
idna==3.2
Jinja2==3.1.1
jsonschema==4.1.0
MarkupSafe==2.0.1
node-semver==0.6.1
packaging==20.9
packaging==21.0
patch-ng==1.17.4
pluginbase==1.0.1
Pygments==2.9.0
Pygments==2.10.0
PyJWT==1.7.1
pyparsing==2.4.7
pyrsistent==0.18.0
python-dateutil==2.8.1
python-dateutil==2.8.2
PyYAML==5.4.1
requests==2.25.1
six==1.15.0
tqdm==4.61.1
urllib3==1.25.11
requests==2.26.0
six==1.16.0
tqdm==4.62.3
urllib3==1.26.7
......@@ -19,9 +19,11 @@
*
*/
#include "caosdb/authentication.h"
#include "grpcpp/security/credentials.h" // for MetadataCredentialsPlugin
#include <grpcpp/impl/codegen/interceptor.h> // for Status
#include <grpcpp/impl/codegen/security/auth_context.h> // for AuthContext
#include <grpcpp/impl/codegen/status.h> // for Status, Status::OK
#include <grpcpp/impl/codegen/string_ref.h> // for string_ref
#include <grpcpp/security/credentials.h> // for MetadataCredentialsPlugin
#include <map> // for multimap
#include <memory> // for allocator, shared_ptr
#include <string> // for basic_string, operator+
......
......@@ -19,15 +19,6 @@
*
*/
#include "caosdb/configuration.h"
#include "boost/iterator/iterator_facade.hpp" // for iterator_facad...
#include "boost/json/impl/object.hpp" // for object::at
#include "boost/json/string.hpp" // for string
#include "boost/json/string_view.hpp" // for string_view
#include "boost/log/core/record.hpp" // for record
#include "boost/log/detail/attachable_sstream_buf.hpp" // for basic_ostring...
#include "boost/log/sources/record_ostream.hpp" // for basic_record_o...
#include "boost/preprocessor/seq/limits/enum_256.hpp" // for BOOST_PP_SEQ_E...
#include "boost/preprocessor/seq/limits/size_256.hpp" // for BOOST_PP_SEQ_S...
#include "caosdb/authentication.h" // for Authenticator
#include "caosdb/connection.h" // for ConnectionManager
#include "caosdb/constants.h" // for LIBCAOSDB_CONF...
......@@ -35,6 +26,17 @@
#include "caosdb/log_level.h" // for CAOSDB_DEFAULT...
#include "caosdb/status_code.h" // for StatusCode
#include "caosdb/utility.h" // for get_home_direc...
#include <boost/json/impl/object.hpp> // for object::at
#include <boost/json/object.hpp> // for object, objec...
#include <boost/json/string.hpp> // for string
#include <boost/json/string_view.hpp> // for string_view
#include <boost/json/value.hpp> // for value, key_va...
#include <boost/json/value_ref.hpp> // for object
#include <boost/log/core/record.hpp> // for record
#include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring...
#include <boost/log/sources/record_ostream.hpp> // for basic_record_o...
#include <boost/preprocessor/seq/limits/enum_256.hpp> // for BOOST_PP_SEQ_E...
#include <boost/preprocessor/seq/limits/size_256.hpp> // for BOOST_PP_SEQ_S...
#include <cassert> // for assert
#include <cstdlib> // for getenv
#include <cstring> // for strcmp
......@@ -43,12 +45,11 @@
#include <grpcpp/security/credentials.h> // for SslCredentials
#include <iterator> // for next
#include <map> // for map
#include <sstream> // for basic_stringb...
#include <stdexcept> // for out_of_range
#include <string> // for string, operator+
namespace caosdb::configuration {
using boost::filesystem::exists;
using boost::filesystem::path;
using boost::json::object;
using boost::json::value;
using caosdb::authentication::Authenticator;
......@@ -66,6 +67,8 @@ using caosdb::utility::load_string_file;
using grpc::InsecureChannelCredentials;
using grpc::SslCredentials;
using grpc::SslCredentialsOptions;
using std::filesystem::exists;
using std::filesystem::path;
PemFileCertificateProvider::PemFileCertificateProvider(const path &path) {
this->certificate_provider = load_string_file(path);
......@@ -471,12 +474,12 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT
configuration_file_path = std::make_unique<path>();
const path raw(configuration_file);
// resolve home directory
for (auto segment = raw.begin(); segment != raw.end(); ++segment) {
if (segment->string() == "$HOME") {
for (const auto &segment : raw) {
if (segment.string() == "$HOME") {
path expanded_home(get_home_directory());
*configuration_file_path /= expanded_home;
} else {
*configuration_file_path /= *segment;
*configuration_file_path /= segment;
}
}
if (exists(*configuration_file_path)) {
......
......@@ -23,8 +23,8 @@
#include "caosdb/configuration.h" // for ConnectionConfigur...
#include "caosdb/exceptions.h" // for ConfigurationError
#include "caosdb/info.h" // for VersionInfo
#include "caosdb/info/v1alpha1/main.grpc.pb.h" // for GeneralInfoService
#include "caosdb/info/v1alpha1/main.pb.h" // for GetVersionInfoRequest
#include "caosdb/info/v1/main.grpc.pb.h" // for GeneralInfoService
#include "caosdb/info/v1/main.pb.h" // for GetVersionInfoRequest
#include "caosdb/transaction.h" // for Transaction
#include "caosdb/transaction_status.h" // for TransactionStatus
#include "grpcpp/impl/codegen/status_code_enum.h" // for StatusCode, UNAUTH...
......@@ -36,12 +36,12 @@
namespace caosdb::connection {
using caosdb::configuration::ConfigurationManager;
using caosdb::configuration::ConnectionConfiguration;
using caosdb::entity::v1alpha1::EntityTransactionService;
using caosdb::entity::v1alpha1::FileTransmissionService;
using caosdb::entity::v1::EntityTransactionService;
using caosdb::entity::v1::FileTransmissionService;
using caosdb::info::VersionInfo;
using caosdb::info::v1alpha1::GeneralInfoService;
using caosdb::info::v1alpha1::GetVersionInfoRequest;
using caosdb::info::v1alpha1::GetVersionInfoResponse;
using caosdb::info::v1::GeneralInfoService;
using caosdb::info::v1::GetVersionInfoRequest;
using caosdb::info::v1::GetVersionInfoResponse;
using caosdb::transaction::Transaction;
using caosdb::transaction::TransactionStatus;
......@@ -109,8 +109,8 @@ auto ConnectionManager::mGetConnection(const std::string &name) const
auto connection = ConfigurationManager::GetConnectionConfiguration(name);
connections[name] = std::make_shared<Connection>(*connection.release());
} catch (const caosdb::exceptions::ConfigurationError &exc) {
throw caosdb::exceptions::UnknownConnectionError("No connection named '" + name +
"' present.");
throw caosdb::exceptions::ConnectionConfigurationError("Error with the connection named '" +
name + "': " + exc.what());
}
}
return this->connections.at(name);
......
......@@ -21,20 +21,20 @@
*/
#include "caosdb/entity.h"
#include "caosdb/data_type.h" // for DataType
#include "caosdb/entity/v1alpha1/main.pb.h" // for Messages
#include "caosdb/entity/v1/main.pb.h" // for Messages
#include "caosdb/protobuf_helper.h" // for get_arena
#include "caosdb/value.h" // for Value
#include <google/protobuf/arena.h> // for Arena
#include <new> // for operator new
namespace caosdb::entity {
using ProtoParent = caosdb::entity::v1alpha1::Parent;
using ProtoProperty = caosdb::entity::v1alpha1::Property;
using ProtoEntity = caosdb::entity::v1alpha1::Entity;
using ProtoImportance = caosdb::entity::v1alpha1::Importance;
using caosdb::entity::v1alpha1::EntityRole;
using ProtoMessage = caosdb::entity::v1alpha1::Message;
using ProtoFileDescriptor = caosdb::entity::v1alpha1::FileDescriptor;
using ProtoParent = caosdb::entity::v1::Parent;
using ProtoProperty = caosdb::entity::v1::Property;
using ProtoEntity = caosdb::entity::v1::Entity;
using ProtoImportance = caosdb::entity::v1::Importance;
using caosdb::entity::v1::EntityRole;
using ProtoMessage = caosdb::entity::v1::Message;
using ProtoFileDescriptor = caosdb::entity::v1::FileDescriptor;
using caosdb::utility::get_arena;
using google::protobuf::Arena;
......
......@@ -51,7 +51,6 @@
#include "caosdb/protobuf_helper.h" // for get_arena
#include "caosdb/status_code.h" // for GENERIC_RPC_E...
#include "caosdb/transaction_status.h" // for TransactionStatus
#include <boost/filesystem/path.hpp> // for operator<<, path
#include <boost/log/core/record.hpp> // for record
#include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring...
#include <boost/log/sources/record_ostream.hpp> // for basic_record_...
......@@ -59,13 +58,14 @@
#include <boost/preprocessor/seq/limits/size_256.hpp> // for BOOST_PP_SEQ_...
#include <exception> // IWYU pragma: keep
// IWYU pragma: no_include <bits/exception.h>
#include <filesystem> // for operator<<, path
#include <google/protobuf/arena.h> // for Arena
#include <grpcpp/impl/codegen/async_stream.h> // for ClientAsyncRe...
#include <grpcpp/impl/codegen/client_context.h> // for ClientContext
#include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue
#include <grpcpp/impl/codegen/status.h> // for Status
#include <grpcpp/impl/codegen/status_code_enum.h> // for OK, UNAUTHENT...
#include <iostream> // for char_traits
#include <sstream> // for streamsize
#include <stdexcept> // for runtime_error
#include <string> // for string, opera...
#include <utility> // for move
......@@ -130,7 +130,8 @@ void DownloadRequestHandler::handleNewCallState() {
<< ", download_id = " << file_descriptor_.file_transmission_id;
fileWriter_ = std::make_unique<FileWriter>(file_descriptor_.local_path);
request_->mutable_file_transmission_id()->CopyFrom(*(file_descriptor_.file_transmission_id));
auto *tid = request_->mutable_file_transmission_id();
tid->CopyFrom(*(file_descriptor_.file_transmission_id));
rpc_ = stub_->PrepareAsyncFileDownload(&ctx_, *request_, cq_);
......
......@@ -48,13 +48,12 @@
*/
#include "caosdb/file_transmission/file_reader.h"
#include "caosdb/file_transmission/file_error.h" // for FileIOError
#include <boost/filesystem/path.hpp> // for path
#include <filesystem> // for path
#include <utility> // for move
namespace caosdb::transaction {
FileReader::FileReader(boost::filesystem::path filename)
: filename_(std::move(filename)), size_(0) {
FileReader::FileReader(std::filesystem::path filename) : filename_(std::move(filename)), size_(0) {
this->openFile();
}
......@@ -79,7 +78,7 @@ std::size_t FileReader::read(std::string &buffer) {
if (bufferSize > 0) {
// TODO(henrik): fix nolint
if (!stream_.read(&buffer[0], bufferSize)) { // NOLINT
throw FileIOError("Can't read file: " + filename_.string());
throw FileIOError("Can't read data from file: " + filename_.string());
}
bytesRead = static_cast<std::size_t>(stream_.gcount());
......