diff --git a/include/clinkahead.h b/include/clinkahead.h index dca76e9fc122f20bc141ff76e7f5636980285cf1..a690de889e62c3f38c8753d5897e8e45edee1126 100644 --- a/include/clinkahead.h +++ b/include/clinkahead.h @@ -31,31 +31,31 @@ extern "C" { #endif /** - * Return the constant caosdb::LIBCAOSDB_VERSION_MAJOR. + * Return the constant linkahead::LIBCAOSDB_VERSION_MAJOR. */ int caosdb_constants_LIBCAOSDB_VERSION_MAJOR(); /** - * Return the constant caosdb::LIBCAOSDB_VERSION_MINOR + * Return the constant linkahead::LIBCAOSDB_VERSION_MINOR */ int caosdb_constants_LIBCAOSDB_VERSION_MINOR(); /** - * Return the constant caosdb::LIBCAOSDB_VERSION_PATCH. + * Return the constant linkahead::LIBCAOSDB_VERSION_PATCH. */ int caosdb_constants_LIBCAOSDB_VERSION_PATCH(); /** - * Return the constant caosdb::COMPATIBLE_SERVER_VERSION_MAJOR. + * Return the constant linkahead::COMPATIBLE_SERVER_VERSION_MAJOR. */ int caosdb_constants_COMPATIBLE_SERVER_VERSION_MAJOR(); /** - * Return the constant caosdb::COMPATIBLE_SERVER_VERSION_MINOR. + * Return the constant linkahead::COMPATIBLE_SERVER_VERSION_MINOR. */ int caosdb_constants_COMPATIBLE_SERVER_VERSION_MINOR(); /** - * Return the constant caosdb::COMPATIBLE_SERVER_VERSION_PATCH. + * Return the constant linkahead::COMPATIBLE_SERVER_VERSION_PATCH. */ int caosdb_constants_COMPATIBLE_SERVER_VERSION_PATCH(); /** - * Return the constant caosdb::COMPATIBLE_SERVER_VERSION_PRE_RELEASE. + * Return the constant linkahead::COMPATIBLE_SERVER_VERSION_PRE_RELEASE. */ const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE(); diff --git a/include/linkahead/acm/user.h b/include/linkahead/acm/user.h index b93a2db8c78013b2c02b0eccc0d502a4a7085576..81db9c3361687af6c77f130060be4434ddf18401 100644 --- a/include/linkahead/acm/user.h +++ b/include/linkahead/acm/user.h @@ -34,11 +34,11 @@ #include <memory> // for unique_ptr #include <string> // for string -namespace caosdb::connection { +namespace linkahead::connection { class Connection; } -namespace caosdb::acm { +namespace linkahead::acm { /** * The UserImpl class is the delegate of the User class. It hides the @@ -120,7 +120,7 @@ public: */ auto SetPassword(const std::string &password) -> void; - friend class caosdb::connection::Connection; + friend class linkahead::connection::Connection; private: /** @@ -133,6 +133,6 @@ private: std::unique_ptr<UserImpl> wrapped; }; -} // namespace caosdb::acm +} // namespace linkahead::acm #endif #endif diff --git a/include/linkahead/authentication.h b/include/linkahead/authentication.h index 24c1be3895f051ebe44222fede2605f1e42f9c96..8c2325cf64db634398a2fa67baba835e80906246 100644 --- a/include/linkahead/authentication.h +++ b/include/linkahead/authentication.h @@ -27,7 +27,7 @@ * @date 2021-06-28 * @brief Configuration and setup of the client authentication. */ -#include "linkahead/utility.h" // for base64_encode +#include "linkahead/utility.h" // for base64_encode #include <grpcpp/security/auth_context.h> // for AuthContext #include <grpcpp/security/credentials.h> // for CallCredentials #include <grpcpp/support/interceptor.h> // for Status @@ -37,13 +37,13 @@ #include <memory> // for shared_ptr #include <string> // for string -namespace caosdb { +namespace linkahead { namespace authentication { -using caosdb::utility::base64_encode; using grpc::AuthContext; using grpc::MetadataCredentialsPlugin; using grpc::Status; using grpc::string_ref; +using linkahead::utility::base64_encode; /** * @brief Abstract base class for authenticators. @@ -51,8 +51,8 @@ using grpc::string_ref; class Authenticator { public: virtual ~Authenticator() = default; - [[nodiscard]] virtual auto - GetCallCredentials() const -> std::shared_ptr<grpc::CallCredentials> = 0; + [[nodiscard]] virtual auto GetCallCredentials() const + -> std::shared_ptr<grpc::CallCredentials> = 0; }; /** @@ -83,5 +83,5 @@ public: [[nodiscard]] auto GetCallCredentials() const -> std::shared_ptr<grpc::CallCredentials> override; }; } // namespace authentication -} // namespace caosdb +} // namespace linkahead #endif diff --git a/include/linkahead/certificate_provider.h b/include/linkahead/certificate_provider.h index 437c96d4171131923e6d953544cf72edd9d8c6ae..19098989789cc653936217214d8287cb31112dee 100644 --- a/include/linkahead/certificate_provider.h +++ b/include/linkahead/certificate_provider.h @@ -23,7 +23,7 @@ #define CAOSDB_CERTIFICATE_PROVIDER_H #include <filesystem> // for path -namespace caosdb::configuration { +namespace linkahead::configuration { using std::filesystem::path; class CertificateProvider { @@ -49,5 +49,5 @@ public: explicit PemCertificateProvider(std::string certificate_provider); [[nodiscard]] auto GetCertificatePem() const -> std::string override; }; -} // namespace caosdb::configuration +} // namespace linkahead::configuration #endif diff --git a/include/linkahead/configuration.h b/include/linkahead/configuration.h index c96ecbcf4ba71c2406d07d4911d6eb11e821d150..9a204d3675165b09e542b7f25dc57cc177f16391 100644 --- a/include/linkahead/configuration.h +++ b/include/linkahead/configuration.h @@ -22,33 +22,33 @@ #ifndef CAOSDB_CONFIGURATION_H #define CAOSDB_CONFIGURATION_H -#include "linkahead/authentication.h" // for Authenticator, PlainPassw... -#include "linkahead/certificate_provider.h" // for CertificateProvider, path -#include "linkahead/exceptions.h" // for ConfigurationError -#include "linkahead/utility.h" // for load_json_file -#include <google/protobuf/arena.h> // for Arena -#include <google/protobuf/extension_set.h> // for Arena -#include <grpcpp/security/credentials.h> // for ChannelCredentials -#include <filesystem> // for path, exists -#include <iosfwd> // for ostream -#include <memory> // for shared_ptr, unique_ptr -#include <string> // for string - -namespace caosdb::configuration { -using caosdb::authentication::Authenticator; -using caosdb::authentication::PlainPasswordAuthenticator; -using caosdb::exceptions::ConfigurationError; -using caosdb::utility::JsonValue; -using caosdb::utility::load_json_file; +#include "linkahead/authentication.h" // for Authenticator, PlainPassw... +#include "linkahead/certificate_provider.h" // for CertificateProvider, path +#include "linkahead/exceptions.h" // for ConfigurationError +#include "linkahead/utility.h" // for load_json_file +#include <google/protobuf/arena.h> // for Arena +#include <google/protobuf/extension_set.h> // for Arena +#include <grpcpp/security/credentials.h> // for ChannelCredentials +#include <filesystem> // for path, exists +#include <iosfwd> // for ostream +#include <memory> // for shared_ptr, unique_ptr +#include <string> // for string + +namespace linkahead::configuration { using google::protobuf::Arena; using grpc::ChannelCredentials; +using linkahead::authentication::Authenticator; +using linkahead::authentication::PlainPasswordAuthenticator; +using linkahead::exceptions::ConfigurationError; +using linkahead::utility::JsonValue; +using linkahead::utility::load_json_file; using std::filesystem::exists; using std::filesystem::path; -const std::string logger_name = "caosdb::configuration"; +const std::string logger_name = "linkahead::configuration"; /** - * @brief Configuration of the CaosDB connection. + * @brief Configuration of the LinkAhead connection. */ class ConnectionConfiguration { private: @@ -58,8 +58,8 @@ private: public: ConnectionConfiguration(std::string host, int port); virtual ~ConnectionConfiguration() = default; - friend auto operator<<(std::ostream &out, - const ConnectionConfiguration &configuration) -> std::ostream &; + friend auto operator<<(std::ostream &out, const ConnectionConfiguration &configuration) + -> std::ostream &; [[nodiscard]] auto virtual ToString() const -> std::string = 0; [[nodiscard]] auto GetHost() const -> std::string; @@ -128,16 +128,16 @@ public: /** * See mGetConnectionConfiguration. */ - inline static auto - GetConnectionConfiguration(const std::string &name) -> std::unique_ptr<ConnectionConfiguration> { + inline static auto GetConnectionConfiguration(const std::string &name) + -> std::unique_ptr<ConnectionConfiguration> { return GetInstance().mGetConnectionConfiguration(name); } /** * Return the ConnectionConfiguration for the default connection. */ - inline static auto - GetDefaultConnectionConfiguration() -> std::unique_ptr<ConnectionConfiguration> { + inline static auto GetDefaultConnectionConfiguration() + -> std::unique_ptr<ConnectionConfiguration> { return GetInstance().mGetConnectionConfiguration(GetInstance().mGetDefaultConnectionName()); } @@ -158,7 +158,7 @@ private: JsonValue json_configuration; inline ConfigurationManager() - : json_configuration(nullptr) { + : json_configuration(nullptr){ // InitializeDefaults(); }; @@ -206,5 +206,5 @@ private: auto mGetDefaultConnectionName() const -> std::string; }; -} // namespace caosdb::configuration +} // namespace linkahead::configuration #endif diff --git a/include/linkahead/connection.h b/include/linkahead/connection.h index 60f5c4341b62a0b92a9576e71c1f963a9a83b929..ac21b5aad2c1937af111cd32e71cb8fe8395d69a 100644 --- a/include/linkahead/connection.h +++ b/include/linkahead/connection.h @@ -28,38 +28,38 @@ * @brief Configuration and setup of the connection. */ #ifdef BUILD_ACM -#include "linkahead/acm/user.h" // for User +#include "linkahead/acm/user.h" // for User #include "caosdb/acm/v1alpha1/main.grpc.pb.h" // for AccessControlMan... #endif -#include "linkahead/authentication.h" // for Authenticator -#include "linkahead/configuration.h" // for ConnectionConfigura... -#include "caosdb/entity/v1/main.pb.h" // for EntityTransactionSe... -#include "linkahead/info.h" // for VersionInfo -#include "caosdb/info/v1/main.grpc.pb.h" // for GeneralInfoService:... -#include "linkahead/transaction.h" // for Transaction -#include "linkahead/transaction_status.h" // for TransactionStatus -#include <filesystem> // for path -#include <grpcpp/channel.h> // for Channel -#include <map> // for map -#include <memory> // for shared_ptr, unique_ptr -#include <string> // for string, basic_string +#include "linkahead/authentication.h" // for Authenticator +#include "linkahead/configuration.h" // for ConnectionConfigura... +#include "caosdb/entity/v1/main.pb.h" // for EntityTransactionSe... +#include "linkahead/info.h" // for VersionInfo +#include "caosdb/info/v1/main.grpc.pb.h" // for GeneralInfoService:... +#include "linkahead/transaction.h" // for Transaction +#include "linkahead/transaction_status.h" // for TransactionStatus +#include <filesystem> // for path +#include <grpcpp/channel.h> // for Channel +#include <map> // for map +#include <memory> // for shared_ptr, unique_ptr +#include <string> // for string, basic_string #ifdef BUILD_ACM #include <vector> // for vector #endif -namespace caosdb::connection { +namespace linkahead::connection { #ifdef BUILD_ACM -using caosdb::acm::User; using caosdb::acm::v1alpha1::AccessControlManagementService; +using linkahead::acm::User; #endif -using caosdb::authentication::Authenticator; -using caosdb::configuration::ConnectionConfiguration; using caosdb::entity::v1::EntityTransactionService; using caosdb::entity::v1::FileTransmissionService; -using caosdb::info::VersionInfo; using caosdb::info::v1::GeneralInfoService; -using caosdb::transaction::Transaction; -using caosdb::transaction::TransactionStatus; +using linkahead::authentication::Authenticator; +using linkahead::configuration::ConnectionConfiguration; +using linkahead::info::VersionInfo; +using linkahead::transaction::Transaction; +using linkahead::transaction::TransactionStatus; using std::filesystem::path; /** @@ -111,8 +111,8 @@ public: */ // TODO(tf) find a way to deal with this: // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) - [[nodiscard]] auto RetrieveSingleUser(const std::string &realm, - const std::string &name) const -> User; + [[nodiscard]] auto RetrieveSingleUser(const std::string &realm, const std::string &name) const + -> User; /** * Create a new user. @@ -170,7 +170,7 @@ class ConnectionManager { private: mutable std::map<std::string, std::shared_ptr<Connection>> connections; mutable std::string default_connection_name; - inline ConnectionManager() {}; + inline ConnectionManager(){}; auto mHasConnection(const std::string &name) const -> bool; @@ -210,5 +210,5 @@ public: void operator=(ConnectionManager const &) = delete; }; -} // namespace caosdb::connection +} // namespace linkahead::connection #endif diff --git a/include/linkahead/constants.h.in b/include/linkahead/constants.h.in index a2d055c13896ab570e93069634097f802dd30f6c..e4304ea04f4bb50c9904e10842be183ef8995fea 100644 --- a/include/linkahead/constants.h.in +++ b/include/linkahead/constants.h.in @@ -26,7 +26,7 @@ #define __attribute__(x) #endif #ifdef __cplusplus -namespace caosdb { +namespace linkahead { #endif // clang-format off static const int LIBCAOSDB_VERSION_MAJOR = @libcaosdb_VERSION_MAJOR@; @@ -53,6 +53,6 @@ __attribute__((unused)) static const char* LIBCAOSDB_CONFIGURATION_FILES_PRECEDE }; // clang-format on #ifdef __cplusplus -} // namespace caosdb +} // namespace linkahead #endif #endif diff --git a/include/linkahead/data_type.h b/include/linkahead/data_type.h index b33d699686c11a39ec2cee93025ff44d42461a3e..2a4fda6f1033148b60947aee7902dbd971843767 100644 --- a/include/linkahead/data_type.h +++ b/include/linkahead/data_type.h @@ -28,19 +28,19 @@ #ifndef CAOSDB_DATA_TYPE_H #define CAOSDB_DATA_TYPE_H -#include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper -#include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField, Message -#include <memory> // for unique_ptr -#include <string> // for string -namespace caosdb::entity { +#include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper +#include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField, Message +#include <memory> // for unique_ptr +#include <string> // for string +namespace linkahead::entity { using ProtoAtomicDataType = caosdb::entity::v1::AtomicDataType; using ProtoDataType = caosdb::entity::v1::DataType; using ProtoListDataType = caosdb::entity::v1::ListDataType; using ProtoReferenceDataType = caosdb::entity::v1::ReferenceDataType; using DataTypeCase = caosdb::entity::v1::DataType::DataTypeCase; using ListDataTypeCase = caosdb::entity::v1::ListDataType::ListDataTypeCase; -using caosdb::utility::ProtoMessageWrapper; -using caosdb::utility::ScalarProtoMessageWrapper; +using linkahead::utility::ProtoMessageWrapper; +using linkahead::utility::ScalarProtoMessageWrapper; class Entity; class Property; @@ -283,6 +283,6 @@ protected: mutable std::unique_ptr<ListDataType> list_data_type; }; -} // namespace caosdb::entity +} // namespace linkahead::entity #endif diff --git a/include/linkahead/entity.h b/include/linkahead/entity.h index f2b886a33d7cb8f6cb785a7eb13984b8d40438ff..e63dd32b48f9051e81c57d199dea73214327ecc2 100644 --- a/include/linkahead/entity.h +++ b/include/linkahead/entity.h @@ -29,27 +29,27 @@ #ifndef CAOSDB_ENTITY_H #define CAOSDB_ENTITY_H -#include "linkahead/data_type.h" // for DataType -#include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField -#include "linkahead/file_descriptor.h" // for FileDescriptor -#include "linkahead/logging.h" // for CAOSDB_LOG_WARN -#include "linkahead/message_code.h" // for get_message_code -#include "linkahead/protobuf_helper.h" // for get_arena -#include "linkahead/status_code.h" // for StatusCode -#include "linkahead/value.h" // for Value -#include <cstdint> // for int64_t -#include <filesystem> // for path -#include <google/protobuf/arena.h> // for Arena -#include <google/protobuf/message.h> // for RepeatedPtrField -#include <iterator> // for iterator, output_iterato... -#include <map> // for map -#include <stdexcept> // for out_of_range -#include <string> // for string, basic... -#include <utility> // for move -#include <vector> // for vector +#include "linkahead/data_type.h" // for DataType +#include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField +#include "linkahead/file_descriptor.h" // for FileDescriptor +#include "linkahead/logging.h" // for CAOSDB_LOG_WARN +#include "linkahead/message_code.h" // for get_message_code +#include "linkahead/protobuf_helper.h" // for get_arena +#include "linkahead/status_code.h" // for StatusCode +#include "linkahead/value.h" // for Value +#include <cstdint> // for int64_t +#include <filesystem> // for path +#include <google/protobuf/arena.h> // for Arena +#include <google/protobuf/message.h> // for RepeatedPtrField +#include <iterator> // for iterator, output_iterato... +#include <map> // for map +#include <stdexcept> // for out_of_range +#include <string> // for string, basic... +#include <utility> // for move +#include <vector> // for vector // IWYU pragma: no_include "net/proto2/public/repeated_field.h" -namespace caosdb::entity { +namespace linkahead::entity { using caosdb::entity::v1::IdResponse; using std::filesystem::exists; using std::filesystem::is_directory; @@ -61,15 +61,15 @@ using ProtoValue = caosdb::entity::v1::Value; using ProtoDataType = caosdb::entity::v1::DataType; using caosdb::entity::v1::EntityRole; using ProtoImportance = caosdb::entity::v1::Importance; -using caosdb::StatusCode; using caosdb::entity::v1::EntityResponse; using caosdb::entity::v1::FileTransmissionId; -using caosdb::utility::get_arena; -using caosdb::utility::ProtoMessageWrapper; using ::google::protobuf::RepeatedPtrField; using google::protobuf::RepeatedPtrField; +using linkahead::StatusCode; +using linkahead::utility::get_arena; +using linkahead::utility::ProtoMessageWrapper; -static const std::string logger_name = "caosdb::entity"; +static const std::string logger_name = "linkahead::entity"; /** * The property importance. @@ -157,7 +157,7 @@ public: friend class Entity; - virtual ~RepeatedPtrFieldWrapper() {}; + virtual ~RepeatedPtrFieldWrapper(){}; inline auto ToString() const noexcept -> const std::string override { if (this->size() == 0) { @@ -202,7 +202,7 @@ public: } protected: - RepeatedPtrFieldWrapper() : ProtoMessageWrapper<RepeatedPtrField<P>>() {}; + RepeatedPtrFieldWrapper() : ProtoMessageWrapper<RepeatedPtrField<P>>(){}; explicit inline RepeatedPtrFieldWrapper(RepeatedPtrField<P> *wrapped) : ProtoMessageWrapper<RepeatedPtrField<P>>(wrapped) {} @@ -343,7 +343,7 @@ public: private: explicit inline Message(ProtoMessage *wrapped) - : ScalarProtoMessageWrapper<ProtoMessage>(wrapped) {}; + : ScalarProtoMessageWrapper<ProtoMessage>(wrapped){}; }; /** @@ -357,7 +357,7 @@ public: // friend class Property; private: - inline Messages() : RepeatedPtrFieldWrapper<Message, ProtoMessage>() {}; + inline Messages() : RepeatedPtrFieldWrapper<Message, ProtoMessage>(){}; }; /////////////////////////////////////////////////////////////////////////////// @@ -372,8 +372,8 @@ private: */ class Parent : public ScalarProtoMessageWrapper<ProtoParent> { public: - explicit inline Parent(ProtoParent *wrapped) : ScalarProtoMessageWrapper<ProtoParent>(wrapped) {}; - Parent() : ScalarProtoMessageWrapper<ProtoParent>() {}; + explicit inline Parent(ProtoParent *wrapped) : ScalarProtoMessageWrapper<ProtoParent>(wrapped){}; + Parent() : ScalarProtoMessageWrapper<ProtoParent>(){}; ~Parent() = default; /** @@ -475,9 +475,9 @@ public: friend class Entity; private: - inline Parents() : RepeatedPtrFieldWrapper<Parent, ProtoParent>() {}; + inline Parents() : RepeatedPtrFieldWrapper<Parent, ProtoParent>(){}; explicit inline Parents(::google::protobuf::RepeatedPtrField<caosdb::entity::v1::Parent> *wrapped) - : RepeatedPtrFieldWrapper<Parent, ProtoParent>(wrapped) {}; + : RepeatedPtrFieldWrapper<Parent, ProtoParent>(wrapped){}; }; /////////////////////////////////////////////////////////////////////////////// @@ -516,10 +516,10 @@ public: value(this->wrapped->has_value() ? this->wrapped->mutable_value() : static_cast<ProtoValue *>(nullptr)), data_type(this->wrapped->has_data_type() ? this->wrapped->mutable_data_type() - : static_cast<ProtoDataType *>(nullptr)) {}; + : static_cast<ProtoDataType *>(nullptr)){}; inline Property() : ScalarProtoMessageWrapper<ProtoProperty>(), value(static_cast<ProtoValue *>(nullptr)), - data_type(static_cast<ProtoDataType *>(nullptr)) {}; + data_type(static_cast<ProtoDataType *>(nullptr)){}; ~Property() = default; @@ -660,9 +660,9 @@ public: friend class Entity; private: - inline Properties() {}; + inline Properties(){}; explicit inline Properties(RepeatedPtrField<ProtoProperty> *wrapped) - : RepeatedPtrFieldWrapper<Property, ProtoProperty>(wrapped) {}; + : RepeatedPtrFieldWrapper<Property, ProtoProperty>(wrapped){}; }; /////////////////////////////////////////////////////////////////////////////// @@ -925,5 +925,5 @@ private: DataType data_type; }; -} // namespace caosdb::entity +} // namespace linkahead::entity #endif diff --git a/include/linkahead/exceptions.h b/include/linkahead/exceptions.h index bc18f6f956043251b95eacb3712e1eb103dbfc2f..a65d7ac67b63db7a8db4b7aa20bd25b6a8a0f0b3 100644 --- a/include/linkahead/exceptions.h +++ b/include/linkahead/exceptions.h @@ -25,8 +25,8 @@ #include <stdexcept> #include <string> -namespace caosdb::exceptions { -using caosdb::StatusCode; +namespace linkahead::exceptions { +using linkahead::StatusCode; using std::runtime_error; /** @@ -109,5 +109,5 @@ public: : Exception(StatusCode::CONNECTION_CONFIGURATION_ERROR, what_arg) {} }; -} // namespace caosdb::exceptions +} // namespace linkahead::exceptions #endif diff --git a/include/linkahead/file_descriptor.h b/include/linkahead/file_descriptor.h index d59adcd86aeea882fa7b87d5b463c568bd8cc1e6..ead4885efc277a0856c86a1f0b661c2e996455d6 100644 --- a/include/linkahead/file_descriptor.h +++ b/include/linkahead/file_descriptor.h @@ -32,7 +32,7 @@ #include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField #include <filesystem> // for path -namespace caosdb::entity { +namespace linkahead::entity { using ProtoFileDescriptor = caosdb::entity::v1::FileDescriptor; using caosdb::entity::v1::FileTransmissionId; @@ -42,5 +42,5 @@ struct FileDescriptor { std::filesystem::path local_path; }; -} // namespace caosdb::entity +} // namespace linkahead::entity #endif diff --git a/include/linkahead/file_transmission/download_request_handler.h b/include/linkahead/file_transmission/download_request_handler.h index 52c9b37bd18501df0af4580902d348cf44ba3382..387a6b08eb00051c61e363ef51a9450f6f75853d 100644 --- a/include/linkahead/file_transmission/download_request_handler.h +++ b/include/linkahead/file_transmission/download_request_handler.h @@ -50,24 +50,24 @@ #define CAOSDB_FILE_TRANSMISSION_DOWNLOAD_REQUEST_HANDLER_H #include "linkahead/file_descriptor.h" // for FileDescriptor -#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... -#include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse +#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... +#include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse #include "linkahead/file_transmission/file_writer.h" // for FileWriter #include "linkahead/handler_interface.h" // for HandlerTag, Handl... -#include <cstdint> // for uint64_t -#include <grpcpp/client_context.h> // for ClientContext -#include <grpcpp/completion_queue.h> // for CompletionQueue -#include <grpcpp/support/async_stream.h> // for ClientAsyncReader -#include <grpcpp/support/status.h> // for Status -#include <memory> // for unique_ptr - -namespace caosdb::transaction { -using caosdb::entity::FileDescriptor; +#include <cstdint> // for uint64_t +#include <grpcpp/client_context.h> // for ClientContext +#include <grpcpp/completion_queue.h> // for CompletionQueue +#include <grpcpp/support/async_stream.h> // for ClientAsyncReader +#include <grpcpp/support/status.h> // for Status +#include <memory> // for unique_ptr + +namespace linkahead::transaction { using caosdb::entity::v1::FileDownloadRequest; using caosdb::entity::v1::FileDownloadResponse; using caosdb::entity::v1::FileTransmissionService; -using caosdb::transaction::HandlerInterface; -using caosdb::transaction::HandlerTag; +using linkahead::entity::FileDescriptor; +using linkahead::transaction::HandlerInterface; +using linkahead::transaction::HandlerTag; /* * Handler for the download request of a single file @@ -123,6 +123,6 @@ protected: uint64_t bytesReceived_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/file_transmission/file_error.h b/include/linkahead/file_transmission/file_error.h index 6af17f1ef10adf8547f9066b1d1b275a743e7051..e47710c6b25da7d21ec10f5bb62aa96c29e1910c 100644 --- a/include/linkahead/file_transmission/file_error.h +++ b/include/linkahead/file_transmission/file_error.h @@ -52,13 +52,13 @@ #include <stdexcept> #include <string> -namespace caosdb::transaction { +namespace linkahead::transaction { class FileIOError : public std::runtime_error { public: FileIOError(const std::string &message) : std::runtime_error(message) {} }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/file_transmission/file_reader.h b/include/linkahead/file_transmission/file_reader.h index a313f151d2333e135b5d7bd5122605361c6978c3..7fcc30ab1c83dfd1741bf0c9ba0590ae1fac8965 100644 --- a/include/linkahead/file_transmission/file_reader.h +++ b/include/linkahead/file_transmission/file_reader.h @@ -55,7 +55,7 @@ #include <fstream> // for ifstream #include <string> // for string -namespace caosdb::transaction { +namespace linkahead::transaction { using std::ifstream; using std::filesystem::exists; using std::filesystem::path; @@ -84,6 +84,6 @@ private: uint64_t size_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/file_transmission/file_writer.h b/include/linkahead/file_transmission/file_writer.h index 5552ae3c7e10185cd5614cba658edb1bd0a5587a..c7c00de7bff932c843fd65a19fd7ebc91b26bf8c 100644 --- a/include/linkahead/file_transmission/file_writer.h +++ b/include/linkahead/file_transmission/file_writer.h @@ -53,7 +53,7 @@ #include <fstream> // for ofstream #include <string> // for string -namespace caosdb::transaction { +namespace linkahead::transaction { class FileWriter final { public: @@ -76,6 +76,6 @@ private: std::filesystem::path filename_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/file_transmission/register_file_upload_handler.h b/include/linkahead/file_transmission/register_file_upload_handler.h index 5ccd6304ed89b6d39dd7f533739d297353549c9d..5b4afe7bb6a45629b4cfacbe97cfd4bc340c86b2 100644 --- a/include/linkahead/file_transmission/register_file_upload_handler.h +++ b/include/linkahead/file_transmission/register_file_upload_handler.h @@ -49,15 +49,15 @@ #ifndef CAOSDB_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H #define CAOSDB_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H -#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... +#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... #include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse -#include "linkahead/handler_interface.h" // for HandlerTag, Handl... -#include "linkahead/unary_rpc_handler.h" // for UnaryRpcHandler +#include "linkahead/handler_interface.h" // for HandlerTag, Handl... +#include "linkahead/unary_rpc_handler.h" // for UnaryRpcHandler #include <grpcpp/completion_queue.h> // for CompletionQueue #include <grpcpp/support/async_unary_call.h> // for ClientAsyncResponseReader #include <memory> // for unique_ptr -namespace caosdb::transaction { +namespace linkahead::transaction { using caosdb::entity::v1::FileTransmissionService; using caosdb::entity::v1::RegisterFileUploadRequest; @@ -90,6 +90,6 @@ protected: RegisterFileUploadResponse *response_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/file_transmission/upload_request_handler.h b/include/linkahead/file_transmission/upload_request_handler.h index 126c78c65f4a3c31f98195a9395fd47d323544e0..f6a79857594ecab9df6b622587c307b61f896d46 100644 --- a/include/linkahead/file_transmission/upload_request_handler.h +++ b/include/linkahead/file_transmission/upload_request_handler.h @@ -49,25 +49,24 @@ #ifndef CAOSDB_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H #define CAOSDB_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H -#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... -#include "caosdb/entity/v1/main.pb.h" // for FileUploadRequest +#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... #include "linkahead/file_descriptor.h" // for FileDescriptor #include "linkahead/file_transmission/file_reader.h" // for FileReader #include "linkahead/handler_interface.h" // for HandlerTag, Handl... -#include <cstdint> // for uint64_t -#include <grpcpp/client_context.h> // for ClientContext -#include <grpcpp/completion_queue.h> // for CompletionQueue -#include <grpcpp/support/async_stream.h> // for ClientAsyncReader -#include <grpcpp/support/status.h> // for Status -#include <memory> // for unique_ptr - -namespace caosdb::transaction { -using caosdb::entity::FileDescriptor; +#include <cstdint> // for uint64_t +#include <grpcpp/client_context.h> // for ClientContext +#include <grpcpp/completion_queue.h> // for CompletionQueue +#include <grpcpp/support/async_stream.h> // for ClientAsyncReader +#include <grpcpp/support/status.h> // for Status +#include <memory> // for unique_ptr + +namespace linkahead::transaction { using caosdb::entity::v1::FileTransmissionService; using caosdb::entity::v1::FileUploadRequest; using caosdb::entity::v1::FileUploadResponse; -using caosdb::transaction::HandlerInterface; -using caosdb::transaction::HandlerTag; +using linkahead::entity::FileDescriptor; +using linkahead::transaction::HandlerInterface; +using linkahead::transaction::HandlerTag; class UploadRequestHandler final : public HandlerInterface { public: @@ -121,6 +120,6 @@ protected: uint64_t bytesToSend_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/handler_interface.h b/include/linkahead/handler_interface.h index 9f14d27d9b71d5199d592d23c85d9dabc6c85a91..271a581a7c5afd499694663268ec7cc1fa438e2e 100644 --- a/include/linkahead/handler_interface.h +++ b/include/linkahead/handler_interface.h @@ -53,9 +53,9 @@ #include <memory> #include <string> -namespace caosdb::transaction { +namespace linkahead::transaction { -const static std::string logger_name = "caosdb::transaction"; +const static std::string logger_name = "linkahead::transaction"; /* * Baseclass for UnaryRpcHandler, DownloadRequestHandler and * UploadRequestHandler @@ -91,6 +91,6 @@ protected: using HandlerPtr = std::unique_ptr<HandlerInterface>; using HandlerTag = HandlerPtr *; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/info.h b/include/linkahead/info.h index ccc83cea3b886322e9f37b716bd81102b11baf32..d68e6fd43114a97484d99892c483b87c23a294ba 100644 --- a/include/linkahead/info.h +++ b/include/linkahead/info.h @@ -31,7 +31,7 @@ #include <cstdint> // for uint32_t #include <string> // for string -namespace caosdb::info { +namespace linkahead::info { using ProtoVersionInfo = caosdb::info::v1::VersionInfo; @@ -53,7 +53,7 @@ public: * CaosDBConnection::GetVersionInfo() instead to get the version of the * server behind the given connection. */ - explicit inline VersionInfo(ProtoVersionInfo *info) : info(info) {}; + explicit inline VersionInfo(ProtoVersionInfo *info) : info(info){}; [[nodiscard]] inline auto GetMajor() const -> int32_t { return this->info->major(); } [[nodiscard]] inline auto GetMinor() const -> int32_t { return this->info->minor(); } [[nodiscard]] inline auto GetPatch() const -> int32_t { return this->info->patch(); } @@ -67,5 +67,5 @@ private: std::unique_ptr<ProtoVersionInfo> info; }; -} // namespace caosdb::info +} // namespace linkahead::info #endif diff --git a/include/linkahead/logging.h b/include/linkahead/logging.h index 6670fd7542864b06b91214463e57290583a60e42..4b83fd88f03831b9e7d965d8f1bc8a6ee9dc833c 100644 --- a/include/linkahead/logging.h +++ b/include/linkahead/logging.h @@ -24,16 +24,16 @@ #define CAOSDB_LOGGING_H #include "linkahead/log_level.h" // for CAOSDB_LOG_... -#include <cstdint> // for uint64_t -#include <iosfwd> // for streamsize -#include <memory> // for shared_ptr -#include <string> // for string -#include <vector> // for vector -#include <filesystem> // for path +#include <cstdint> // for uint64_t +#include <iosfwd> // for streamsize +#include <memory> // for shared_ptr +#include <string> // for string +#include <vector> // for vector +#include <filesystem> // for path -namespace caosdb::logging { +namespace linkahead::logging { -const std::string logger_name = "caosdb::logging"; +const std::string logger_name = "linkahead::logging"; class LoggerOutputStream { public: @@ -70,11 +70,11 @@ class TraceEnterLeaveLogger { public: inline TraceEnterLeaveLogger(const std::string &channel, const std::string &function_name) : channel(channel), function_name(function_name) { - caosdb::logging::LoggerOutputStream::get(this->channel, CAOSDB_LOG_LEVEL_TRACE) + linkahead::logging::LoggerOutputStream::get(this->channel, CAOSDB_LOG_LEVEL_TRACE) << "Enter " << this->function_name; } inline ~TraceEnterLeaveLogger() { - caosdb::logging::LoggerOutputStream::get(this->channel, CAOSDB_LOG_LEVEL_TRACE) + linkahead::logging::LoggerOutputStream::get(this->channel, CAOSDB_LOG_LEVEL_TRACE) << "Leave " << this->function_name; } @@ -88,7 +88,7 @@ private: */ class LevelConfiguration { public: - LevelConfiguration(int level) : level(level) {}; + LevelConfiguration(int level) : level(level){}; [[nodiscard]] inline auto GetLevel() const -> int { return this->level; } private: @@ -225,27 +225,27 @@ void caosdb_log_debug(const char *channel, const char *msg); */ void caosdb_log_trace(const char *channel, const char *msg); -} // namespace caosdb::logging +} // namespace linkahead::logging #define CAOSDB_LOG_FATAL(Channel) \ - caosdb::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_FATAL) + linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_FATAL) #define CAOSDB_LOG_ERROR(Channel) \ - caosdb::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_ERROR) + linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_ERROR) #define CAOSDB_LOG_WARN(Channel) \ - caosdb::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_WARN) + linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_WARN) #define CAOSDB_LOG_INFO(Channel) \ - caosdb::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_INFO) + linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_INFO) #define CAOSDB_LOG_DEBUG(Channel) \ - caosdb::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_DEBUG) + linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_DEBUG) #define CAOSDB_LOG_TRACE(Channel) \ - caosdb::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_TRACE) + linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_TRACE) #define CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(Channel, FunctionName) \ - const caosdb::logging::TraceEnterLeaveLogger trace_enter_leave_logger(Channel, FunctionName); + const linkahead::logging::TraceEnterLeaveLogger trace_enter_leave_logger(Channel, FunctionName); #define CAOSDB_LOG_ERROR_AND_RETURN_STATUS(Channel, StatusCode, Message) \ CAOSDB_LOG_ERROR(Channel) << "StatusCode (" << StatusCode << ") " \ - << caosdb::get_status_description(StatusCode) << ": " << Message; \ + << linkahead::get_status_description(StatusCode) << ": " << Message; \ return StatusCode; #endif diff --git a/include/linkahead/message_code.h b/include/linkahead/message_code.h index f459fb9f4be07af44c2b766a9614c4bc391c59a5..e060ff9673c367c6738b60952abdc87e2e539a6f 100644 --- a/include/linkahead/message_code.h +++ b/include/linkahead/message_code.h @@ -36,7 +36,7 @@ * https://gitlab.indiscale.com/caosdb/src/caosdb-proto. */ -namespace caosdb::entity { +namespace linkahead::entity { #define _MAP_MESSAGE_CODE(name) name = caosdb::entity::v1::MessageCode::MESSAGE_CODE_##name @@ -174,5 +174,5 @@ enum MessageCode { return MessageCode::UNKNOWN; } -} // namespace caosdb::entity +} // namespace linkahead::entity #endif diff --git a/include/linkahead/protobuf_helper.h b/include/linkahead/protobuf_helper.h index c2436d5118594780fabe85d54afaf2168a7beacb..402b0f6f37a886d9a6206dd169030b71eec964fc 100644 --- a/include/linkahead/protobuf_helper.h +++ b/include/linkahead/protobuf_helper.h @@ -35,7 +35,7 @@ google::protobuf::util::MessageToJsonString(message, &out, options); \ } -namespace caosdb::utility { +namespace linkahead::utility { using google::protobuf::Arena; @@ -109,5 +109,5 @@ public: } }; -} // namespace caosdb::utility +} // namespace linkahead::utility #endif diff --git a/include/linkahead/result_set.h b/include/linkahead/result_set.h index 6d3f067c9799156d1bca435c465aa32352fd48c2..97e00dd97f31e7220b2b4bff42c48cdf79c8e295 100644 --- a/include/linkahead/result_set.h +++ b/include/linkahead/result_set.h @@ -22,15 +22,15 @@ #define CAOSDB_RESULT_SET_H #include "linkahead/entity.h" // for Entity, FileDe... -#include <algorithm> // for max -#include <iterator> // for iterator, next -#include <memory> // for unique_ptr -#include <utility> // for move -#include <vector> // for vector +#include <algorithm> // for max +#include <iterator> // for iterator, next +#include <memory> // for unique_ptr +#include <utility> // for move +#include <vector> // for vector // IWYU pragma: no_include <ext/alloc_traits.h> -namespace caosdb::transaction { -using caosdb::entity::Entity; +namespace linkahead::transaction { +using linkahead::entity::Entity; /** * Abstract base class for the results of a Transaction. @@ -121,5 +121,5 @@ public: explicit MultiResultSet(std::vector<std::unique_ptr<Entity>> result_set); }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/result_table.h b/include/linkahead/result_table.h index 6f6c40ff4d982b8264474b36ddcea5bae31dfbeb..387ff8c7cbb39f43d558a987aa7efb01a9c7b439 100644 --- a/include/linkahead/result_table.h +++ b/include/linkahead/result_table.h @@ -22,12 +22,12 @@ #define CAOSDB_RESULT_TABLE_H #include "linkahead/value.h" // for Value -#include <iterator> // for iterator, next -#include <memory> // for unique_ptr -#include <string> // for string +#include <iterator> // for iterator, next +#include <memory> // for unique_ptr +#include <string> // for string -namespace caosdb::transaction { -using caosdb::entity::Value; +namespace linkahead::transaction { +using linkahead::entity::Value; class ResultTableImpl; @@ -120,5 +120,5 @@ private: std::unique_ptr<ResultTableImpl> delegate; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/status_code.h b/include/linkahead/status_code.h index 181c7c58372f9d3b21b40086b07c4406b240ab13..3cc46459ff9369fa6bea22e6f5e6298c251a6785 100644 --- a/include/linkahead/status_code.h +++ b/include/linkahead/status_code.h @@ -25,7 +25,7 @@ #include <grpcpp/impl/codegen/status_code_enum.h> // for StatusCode #include <string> // for string -namespace caosdb { +namespace linkahead { /** * StatusCodes represent the status of this client, it's connections, @@ -82,5 +82,5 @@ enum StatusCode { auto get_status_description(int code) -> const std::string &; -} // namespace caosdb +} // namespace linkahead #endif diff --git a/include/linkahead/transaction.h b/include/linkahead/transaction.h index d25a1966685445ebd5ba6b8a98e97d2162082717..61ac3d609ed14d1b9107de245d4f2bc36ed84a2a 100644 --- a/include/linkahead/transaction.h +++ b/include/linkahead/transaction.h @@ -21,19 +21,19 @@ #ifndef CAOSDB_TRANSACTION_H #define CAOSDB_TRANSACTION_H -#include "linkahead/entity.h" // for Entity, FileDe... -#include "caosdb/entity/v1/main.pb.h" // for EntityTransact... +#include "linkahead/entity.h" // for Entity, FileDe... +#include "caosdb/entity/v1/main.pb.h" // for EntityTransact... #include "caosdb/entity/v1/main.pb.h" // for MultiTransacti... -#include "linkahead/file_descriptor.h" // for FileDescriptor -#include "linkahead/handler_interface.h" // for HandlerInterface -#include "linkahead/transaction_handler.h" // for EntityTransactionHandler -#include "linkahead/logging.h" // for CAOSDB_LOG_ERR... -#include "linkahead/protobuf_helper.h" // for get_arena -#include "linkahead/status_code.h" // for StatusCode -#include "linkahead/result_set.h" // for ResultSet -#include "linkahead/result_table.h" // for ResultTable -#include "linkahead/transaction_status.h" // for StatusCode -#include "linkahead/value.h" // for Value +#include "linkahead/file_descriptor.h" // for FileDescriptor +#include "linkahead/handler_interface.h" // for HandlerInterface +#include "linkahead/transaction_handler.h" // for EntityTransactionHandler +#include "linkahead/logging.h" // for CAOSDB_LOG_ERR... +#include "linkahead/protobuf_helper.h" // for get_arena +#include "linkahead/status_code.h" // for StatusCode +#include "linkahead/result_set.h" // for ResultSet +#include "linkahead/result_table.h" // for ResultTable +#include "linkahead/transaction_status.h" // for StatusCode +#include "linkahead/value.h" // for Value #include <future> // for async, future #include <google/protobuf/arena.h> // for Arena #include <google/protobuf/util/json_util.h> // for MessageToJsonS... @@ -163,10 +163,7 @@ * @author Timm Fitschen * @date 2021-08-05 */ -namespace caosdb::transaction { -using caosdb::entity::Entity; -using caosdb::entity::FileDescriptor; -using caosdb::entity::Value; +namespace linkahead::transaction { using caosdb::entity::v1::EntityResponse; using caosdb::entity::v1::EntityTransactionService; using caosdb::entity::v1::FileDownloadRequest; @@ -180,11 +177,14 @@ 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 linkahead::entity::Entity; +using linkahead::entity::FileDescriptor; +using linkahead::entity::Value; +using linkahead::transaction::TransactionStatus; using RetrieveResponse = caosdb::entity::v1::RetrieveResponse; using TransactionResponseCase = caosdb::entity::v1::TransactionResponse::TransactionResponseCase; -using caosdb::utility::get_arena; using google::protobuf::Arena; +using linkahead::utility::get_arena; class Transaction; @@ -228,8 +228,8 @@ public: * If the file cannot be downloaded due to unsufficient permissions an error * is appended. */ - auto RetrieveAndDownloadFileById(const std::string &id, - const std::string &local_path) noexcept -> StatusCode; + auto RetrieveAndDownloadFileById(const std::string &id, const std::string &local_path) noexcept + -> StatusCode; /** * Add an entity id to this transaction for retrieval. @@ -439,7 +439,7 @@ protected: * Return the Arena where this transaction may create Message instances. * * Currently, this implementation is only a call to - * caosdb::utility::get_arena(), but in the future we might want to have a + * linkahead::utility::get_arena(), but in the future we might want to have a * smarter memory management. */ inline auto GetArena() const -> Arena * { return get_arena(); } @@ -481,8 +481,8 @@ private: }; template <class InputIterator> -inline auto Transaction::RetrieveById(InputIterator begin, - InputIterator end) noexcept -> StatusCode { +inline auto Transaction::RetrieveById(InputIterator begin, InputIterator end) noexcept + -> StatusCode { ASSERT_CAN_ADD_RETRIEVAL auto next = begin; @@ -496,5 +496,5 @@ inline auto Transaction::RetrieveById(InputIterator begin, return this->status.GetCode(); } -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/transaction_handler.h b/include/linkahead/transaction_handler.h index 933deb75829b074d775a35efaf713982195646d7..cec7d71f1161e8cf8a288302da72769a996caffe 100644 --- a/include/linkahead/transaction_handler.h +++ b/include/linkahead/transaction_handler.h @@ -1,13 +1,13 @@ #pragma once -#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... +#include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... #include "caosdb/entity/v1/main.pb.h" // for FileDownloadResponse -#include "linkahead/handler_interface.h" // for HandlerTag -#include "linkahead/unary_rpc_handler.h" // for HandlerTag, Handl... +#include "linkahead/handler_interface.h" // for HandlerTag +#include "linkahead/unary_rpc_handler.h" // for HandlerTag, Handl... #include <grpcpp/completion_queue.h> // for CompletionQueue #include <grpcpp/support/async_unary_call.h> // for ClientAsyncResponseReader #include <memory> // for unique_ptr -namespace caosdb::transaction { +namespace linkahead::transaction { using caosdb::entity::v1::EntityTransactionService; using caosdb::entity::v1::MultiTransactionRequest; @@ -39,4 +39,4 @@ protected: MultiTransactionResponse *response_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/include/linkahead/transaction_status.h b/include/linkahead/transaction_status.h index 4c0faf300f750dce2d8dc98ed1637aacbc9bb6f7..fbdedafb762c128715aa0c437b974492575c9a24 100644 --- a/include/linkahead/transaction_status.h +++ b/include/linkahead/transaction_status.h @@ -27,14 +27,14 @@ #include <memory> // for shared_ptr, unique_ptr #include <string> // for string -namespace caosdb::transaction { -using caosdb::StatusCode; -using caosdb::exceptions::AuthenticationError; -using caosdb::exceptions::ConnectionError; -using caosdb::exceptions::Exception; -using caosdb::exceptions::TransactionError; -using caosdb::exceptions::TransactionStatusError; -using caosdb::exceptions::TransactionTypeError; +namespace linkahead::transaction { +using linkahead::StatusCode; +using linkahead::exceptions::AuthenticationError; +using linkahead::exceptions::ConnectionError; +using linkahead::exceptions::Exception; +using linkahead::exceptions::TransactionError; +using linkahead::exceptions::TransactionStatusError; +using linkahead::exceptions::TransactionTypeError; /** * Define static factory method in the TransactionStatus class. @@ -42,7 +42,7 @@ using caosdb::exceptions::TransactionTypeError; #define CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(_StatusName, _StatusCode) \ inline static auto _StatusName() -> const TransactionStatus & { \ static const TransactionStatus instance(_StatusCode, \ - caosdb::get_status_description(_StatusCode)); \ + linkahead::get_status_description(_StatusCode)); \ return instance; \ } @@ -119,7 +119,7 @@ public: */ inline static auto AUTHENTICATION_ERROR(const std::string &details) -> const TransactionStatus { return TransactionStatus(StatusCode::AUTHENTICATION_ERROR, - caosdb::get_status_description(StatusCode::AUTHENTICATION_ERROR) + + linkahead::get_status_description(StatusCode::AUTHENTICATION_ERROR) + " Original error: " + details); } /** @@ -157,9 +157,10 @@ public: * description. */ inline static auto TRANSACTION_ERROR(const std::string &details) -> const TransactionStatus { - return TransactionStatus(StatusCode::GENERIC_TRANSACTION_ERROR, - caosdb::get_status_description(StatusCode::GENERIC_TRANSACTION_ERROR) + - " Original error: " + details); + return TransactionStatus( + StatusCode::GENERIC_TRANSACTION_ERROR, + linkahead::get_status_description(StatusCode::GENERIC_TRANSACTION_ERROR) + + " Original error: " + details); } /** * Factory for a RPC_ERROR with a detailed description. @@ -171,7 +172,7 @@ public: // RPC_ERROR states with different error codes (which stem from GRPC) here // in the future. return TransactionStatus(StatusCode::GENERIC_RPC_ERROR, - caosdb::get_status_description(StatusCode::GENERIC_RPC_ERROR) + + linkahead::get_status_description(StatusCode::GENERIC_RPC_ERROR) + " Original error: " + details); } @@ -183,7 +184,7 @@ public: */ inline static auto GENERIC_ERROR(const std::string &details) { return TransactionStatus(StatusCode::GENERIC_ERROR, - caosdb::get_status_description(StatusCode::GENERIC_ERROR) + + linkahead::get_status_description(StatusCode::GENERIC_ERROR) + "Original error: " + details); } @@ -191,8 +192,8 @@ public: TransactionStatus::ThrowExceptionIfError(this->code, this->description); } - inline static auto ThrowExceptionIfError(StatusCode code, - const std::string &description) -> void { + inline static auto ThrowExceptionIfError(StatusCode code, const std::string &description) + -> void { if (!IsError(code)) { return; } @@ -240,7 +241,7 @@ public: inline auto GetCode() const -> StatusCode { return this->code; } TransactionStatus(StatusCode code, const std::string &description) - : code(code), description(description) {}; + : code(code), description(description){}; private: /** @@ -254,5 +255,5 @@ private: std::string description; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/unary_rpc_handler.h b/include/linkahead/unary_rpc_handler.h index 493a44504d03005dad3744f0fde8ee10dc072337..a23484dd2739420fc519f1bd509af08efc76f5ff 100644 --- a/include/linkahead/unary_rpc_handler.h +++ b/include/linkahead/unary_rpc_handler.h @@ -51,11 +51,11 @@ #include "linkahead/handler_interface.h" // for HandlerTag, Handl... #include "linkahead/transaction_status.h" // for TransactionStatus -#include <grpcpp/client_context.h> // for ClientContext -#include <grpcpp/completion_queue.h> // for CompletionQueue -#include <grpcpp/support/status.h> // for Status +#include <grpcpp/client_context.h> // for ClientContext +#include <grpcpp/completion_queue.h> // for CompletionQueue +#include <grpcpp/support/status.h> // for Status -namespace caosdb::transaction { +namespace linkahead::transaction { class UnaryRpcHandler : public HandlerInterface { public: @@ -85,6 +85,6 @@ protected: grpc::Status status_; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/include/linkahead/utility.h b/include/linkahead/utility.h index 9ea4ef7b8a18d91ab812d1f0f8b2dee33f756577..3d73b2d5561599fd57d679cbcd45e4a7405e00e4 100644 --- a/include/linkahead/utility.h +++ b/include/linkahead/utility.h @@ -23,13 +23,13 @@ #define CAOSDB_UTILS_H #include "linkahead/data_type.h" // for AtomicDataType #include "linkahead/entity.h" // for Importance, Role -#include <cstdlib> // for getenv -#include <filesystem> // for path -#include <fstream> // for basic_istream<>::__ist... -#include <memory> // for shared_ptr -#include <string> // for string, operator+, cha... +#include <cstdlib> // for getenv +#include <filesystem> // for path +#include <fstream> // for basic_istream<>::__ist... +#include <memory> // for shared_ptr +#include <string> // for string, operator+, cha... -namespace caosdb::utility { +namespace linkahead::utility { using std::ifstream; using std::filesystem::exists; using std::filesystem::path; @@ -41,11 +41,13 @@ template <typename Enum> auto getEnumNameFromValue(Enum v) -> std::string; // Forward declaration of specializations template <> -auto getEnumNameFromValue<caosdb::entity::AtomicDataType>(caosdb::entity::AtomicDataType v) +auto getEnumNameFromValue<linkahead::entity::AtomicDataType>(linkahead::entity::AtomicDataType v) -> std::string; template <> -auto getEnumNameFromValue<caosdb::entity::Importance>(caosdb::entity::Importance v) -> std::string; -template <> auto getEnumNameFromValue<caosdb::entity::Role>(caosdb::entity::Role v) -> std::string; +auto getEnumNameFromValue<linkahead::entity::Importance>(linkahead::entity::Importance v) + -> std::string; +template <> +auto getEnumNameFromValue<linkahead::entity::Role>(linkahead::entity::Role v) -> std::string; /** * @brief Get the enum value from a string. @@ -56,13 +58,14 @@ template <typename Enum> auto getEnumValueFromName(const std::string &name) -> E // Forward declaration of specializations template <> -auto getEnumValueFromName<caosdb::entity::AtomicDataType>(const std::string &name) - -> caosdb::entity::AtomicDataType; +auto getEnumValueFromName<linkahead::entity::AtomicDataType>(const std::string &name) + -> linkahead::entity::AtomicDataType; template <> -auto getEnumValueFromName<caosdb::entity::Importance>(const std::string &name) - -> caosdb::entity::Importance; +auto getEnumValueFromName<linkahead::entity::Importance>(const std::string &name) + -> linkahead::entity::Importance; template <> -auto getEnumValueFromName<caosdb::entity::Role>(const std::string &name) -> caosdb::entity::Role; +auto getEnumValueFromName<linkahead::entity::Role>(const std::string &name) + -> linkahead::entity::Role; /** * @brief Read a text file into a string and return the file's content. @@ -85,8 +88,8 @@ inline auto get_env_fallback(const char *key, const char *fallback) -> const cha * @brief Return the value of an environment variable or - if undefined - the * fallback value. */ -inline auto get_env_fallback(const std::string &key, - const std::string &fallback) -> const std::string { +inline auto get_env_fallback(const std::string &key, const std::string &fallback) + -> const std::string { const char *val = get_env_fallback(key.c_str(), fallback.c_str()); auto const result = std::string(val); @@ -181,5 +184,5 @@ inline auto get_home_directory() -> const path { return home; } -} // namespace caosdb::utility +} // namespace linkahead::utility #endif diff --git a/include/linkahead/value.h b/include/linkahead/value.h index 3208566d7a60687279ec031ab8dc9136bf2a0271..513731a5266508b2509cb11df4bedb872e95a7c8 100644 --- a/include/linkahead/value.h +++ b/include/linkahead/value.h @@ -21,14 +21,14 @@ #ifndef CAOSDB_VALUE_H #define CAOSDB_VALUE_H -#include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper -#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 -#include <string> // for string, operator== -#include <utility> // for move -#include <vector> // for vector +#include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper +#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 +#include <string> // for string, operator== +#include <utility> // for move +#include <vector> // for vector #define LIST_VALUE_CONSTRUCTOR(TYPE, SETTER) \ explicit inline Value(const std::vector<TYPE> &values) \ @@ -42,11 +42,11 @@ } \ } -namespace caosdb::entity { -using caosdb::utility::get_arena; -using caosdb::utility::ProtoMessageWrapper; -using caosdb::utility::ScalarProtoMessageWrapper; +namespace linkahead::entity { using google::protobuf::Arena; +using linkahead::utility::get_arena; +using linkahead::utility::ProtoMessageWrapper; +using linkahead::utility::ScalarProtoMessageWrapper; using ProtoSpecialValue = caosdb::entity::v1::SpecialValue; using ProtoValue = caosdb::entity::v1::Value; using ProtoScalarValue = caosdb::entity::v1::ScalarValue; @@ -170,7 +170,7 @@ public: /** * Destructor. */ - inline ~ScalarValue() {}; + inline ~ScalarValue(){}; /** * Copy constructor. */ @@ -180,7 +180,7 @@ public: /** * Move constructor. */ - inline ScalarValue(ScalarValue &&other) : ScalarValue(std::move(other.wrapped)) {}; + inline ScalarValue(ScalarValue &&other) : ScalarValue(std::move(other.wrapped)){}; /** * Copy assignment operator. */ @@ -441,6 +441,6 @@ private: mutable std::unique_ptr<std::vector<ScalarValue>> collection_values; }; -} // namespace caosdb::entity +} // namespace linkahead::entity #endif diff --git a/src/clinkahead.cpp b/src/clinkahead.cpp index e93b6813b14a2a1f5dcbf2fe54f3410d28c8daa9..1b4063132bf00b023d2bfe41ac507f721c31608c 100644 --- a/src/clinkahead.cpp +++ b/src/clinkahead.cpp @@ -38,25 +38,28 @@ extern "C" { -#define CCAOSDB_LOGGER_NAME "ccaosdb" +#define CCAOSDB_LOGGER_NAME "clinkahead" -#define WRAPPED_ENTITY_CAST(name) static_cast<caosdb::entity::Entity *>(name->wrapped_entity) +#define WRAPPED_ENTITY_CAST(name) static_cast<linkahead::entity::Entity *>(name->wrapped_entity) -#define WRAPPED_PROPERTY_CAST(name) static_cast<caosdb::entity::Property *>(name->wrapped_property) +#define WRAPPED_PROPERTY_CAST(name) \ + static_cast<linkahead::entity::Property *>(name->wrapped_property) -#define WRAPPED_PARENT_CAST(name) static_cast<caosdb::entity::Parent *>(name->wrapped_parent) +#define WRAPPED_PARENT_CAST(name) static_cast<linkahead::entity::Parent *>(name->wrapped_parent) -#define WRAPPED_MESSAGE_CAST(name) static_cast<caosdb::entity::Message *>(name->wrapped_message) +#define WRAPPED_MESSAGE_CAST(name) static_cast<linkahead::entity::Message *>(name->wrapped_message) -#define WRAPPED_DATATYPE_CAST(name) static_cast<caosdb::entity::DataType *>(name->wrapped_datatype) +#define WRAPPED_DATATYPE_CAST(name) \ + static_cast<linkahead::entity::DataType *>(name->wrapped_datatype) -#define WRAPPED_VALUE_CAST(name) static_cast<caosdb::entity::AbstractValue *>(name->wrapped_value) +#define WRAPPED_VALUE_CAST(name) \ + static_cast<linkahead::entity::AbstractValue *>(name->wrapped_value) #define ENUM_NAME_FROM_VALUE(arg, etype) \ - caosdb::utility::getEnumNameFromValue<caosdb::entity::etype>(arg) + linkahead::utility::getEnumNameFromValue<linkahead::entity::etype>(arg) #define ENUM_VALUE_FROM_NAME(arg, etype) \ - caosdb::utility::getEnumValueFromName<caosdb::entity::etype>(arg) + linkahead::utility::getEnumValueFromName<linkahead::entity::etype>(arg) /* * Macro for wrapping every function into a try-catch clause. If an exception @@ -68,8 +71,8 @@ extern "C" { try { \ body \ } catch (const std::exception &exc) { \ - caosdb::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); \ - return caosdb::StatusCode::code; \ + linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); \ + return linkahead::StatusCode::code; \ } \ } @@ -158,7 +161,7 @@ extern "C" { #define CREATE_VALUE(fname, arg) \ ERROR_RETURN_CODE(GENERIC_ERROR, \ int caosdb_entity_create_##fname(caosdb_entity_value *out, arg), { \ - out->wrapped_value = new caosdb::entity::Value(value); \ + out->wrapped_value = new linkahead::entity::Value(value); \ out->_deletable = true; \ return 0; \ }) @@ -173,7 +176,7 @@ extern "C" { for (int i = 0; i < length; i++) { \ value_vec.push_back(assign); \ } \ - out->wrapped_value = new caosdb::entity::Value(value_vec); \ + out->wrapped_value = new linkahead::entity::Value(value_vec); \ out->_deletable = true; \ return 0; \ }) @@ -200,36 +203,36 @@ extern "C" { return 0; \ }) -int caosdb_constants_LIBCAOSDB_VERSION_MAJOR() { return caosdb::LIBCAOSDB_VERSION_MAJOR; } +int caosdb_constants_LIBCAOSDB_VERSION_MAJOR() { return linkahead::LIBCAOSDB_VERSION_MAJOR; } -int caosdb_constants_LIBCAOSDB_VERSION_MINOR() { return caosdb::LIBCAOSDB_VERSION_MINOR; } +int caosdb_constants_LIBCAOSDB_VERSION_MINOR() { return linkahead::LIBCAOSDB_VERSION_MINOR; } -int caosdb_constants_LIBCAOSDB_VERSION_PATCH() { return caosdb::LIBCAOSDB_VERSION_PATCH; } +int caosdb_constants_LIBCAOSDB_VERSION_PATCH() { return linkahead::LIBCAOSDB_VERSION_PATCH; } int caosdb_constants_COMPATIBLE_SERVER_VERSION_MAJOR() { - return caosdb::COMPATIBLE_SERVER_VERSION_MAJOR; + return linkahead::COMPATIBLE_SERVER_VERSION_MAJOR; } int caosdb_constants_COMPATIBLE_SERVER_VERSION_MINOR() { - return caosdb::COMPATIBLE_SERVER_VERSION_MINOR; + return linkahead::COMPATIBLE_SERVER_VERSION_MINOR; } int caosdb_constants_COMPATIBLE_SERVER_VERSION_PATCH() { - return caosdb::COMPATIBLE_SERVER_VERSION_PATCH; + return linkahead::COMPATIBLE_SERVER_VERSION_PATCH; } const char *caosdb_constants_COMPATIBLE_SERVER_VERSION_PRE_RELEASE() { - return caosdb::COMPATIBLE_SERVER_VERSION_PRE_RELEASE; + return linkahead::COMPATIBLE_SERVER_VERSION_PRE_RELEASE; } -int caosdb_status_code_OTHER_CLIENT_ERROR() { return caosdb::StatusCode::OTHER_CLIENT_ERROR; } +int caosdb_status_code_OTHER_CLIENT_ERROR() { return linkahead::StatusCode::OTHER_CLIENT_ERROR; } const char *caosdb_utility_get_env_fallback(const char *name, const char *fallback) { - return caosdb::utility::get_env_fallback(name, fallback); + return linkahead::utility::get_env_fallback(name, fallback); } const char *caosdb_get_status_description(int code) { - return caosdb::get_status_description(code).c_str(); + return linkahead::get_status_description(code).c_str(); } ERROR_RETURN_CODE(GENERIC_ERROR, @@ -237,7 +240,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_connection_certificate_provider *out, const char *path), { out->wrapped_certificate_provider = - new caosdb::configuration::PemFileCertificateProvider(std::string(path)); + new linkahead::configuration::PemFileCertificateProvider(std::string(path)); out->_deletable = true; return 0; }) @@ -247,7 +250,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_connection_certificate_provider *provider), { if (provider->_deletable && provider->wrapped_certificate_provider) { - delete static_cast<caosdb::configuration::CertificateProvider *>( + delete static_cast<linkahead::configuration::CertificateProvider *>( provider->wrapped_certificate_provider); } provider->wrapped_certificate_provider = nullptr; @@ -261,8 +264,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, const char *password), { out->wrapped_authenticator = - new caosdb::authentication::PlainPasswordAuthenticator(std::string(username), - std::string(password)); + new linkahead::authentication::PlainPasswordAuthenticator( + std::string(username), std::string(password)); out->_deletable = true; return 0; }) @@ -272,7 +275,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_authentication_authenticator *authenticator), { if (authenticator->_deletable && authenticator->wrapped_authenticator) { - delete static_cast<caosdb::authentication::Authenticator *>( + delete static_cast<linkahead::authentication::Authenticator *>( authenticator->wrapped_authenticator); } authenticator->wrapped_authenticator = nullptr; @@ -289,25 +292,27 @@ ERROR_RETURN_CODE( { auto host_str = std::string(host); if (authenticator != nullptr && provider != nullptr) { - auto wrapped_provider = static_cast<caosdb::configuration::CertificateProvider *>( + auto wrapped_provider = static_cast<linkahead::configuration::CertificateProvider *>( provider->wrapped_certificate_provider); - auto wrapped_authenticator = - static_cast<caosdb::authentication::Authenticator *>(authenticator->wrapped_authenticator); - out->wrapped_connection_configuration = new caosdb::configuration::TlsConnectionConfiguration( - host_str, port, *wrapped_provider, *wrapped_authenticator); + auto wrapped_authenticator = static_cast<linkahead::authentication::Authenticator *>( + authenticator->wrapped_authenticator); + out->wrapped_connection_configuration = + new linkahead::configuration::TlsConnectionConfiguration(host_str, port, *wrapped_provider, + *wrapped_authenticator); } else if (authenticator != nullptr) { - auto wrapped_authenticator = - static_cast<caosdb::authentication::Authenticator *>(authenticator->wrapped_authenticator); - out->wrapped_connection_configuration = new caosdb::configuration::TlsConnectionConfiguration( - host_str, port, *wrapped_authenticator); + auto wrapped_authenticator = static_cast<linkahead::authentication::Authenticator *>( + authenticator->wrapped_authenticator); + out->wrapped_connection_configuration = + new linkahead::configuration::TlsConnectionConfiguration(host_str, port, + *wrapped_authenticator); } else if (provider != nullptr) { - auto wrapped_provider = static_cast<caosdb::configuration::CertificateProvider *>( + auto wrapped_provider = static_cast<linkahead::configuration::CertificateProvider *>( provider->wrapped_certificate_provider); out->wrapped_connection_configuration = - new caosdb::configuration::TlsConnectionConfiguration(host_str, port, *wrapped_provider); + new linkahead::configuration::TlsConnectionConfiguration(host_str, port, *wrapped_provider); } else { out->wrapped_connection_configuration = - new caosdb::configuration::TlsConnectionConfiguration(host_str, port); + new linkahead::configuration::TlsConnectionConfiguration(host_str, port); } out->_deletable = true; return 0; @@ -319,7 +324,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, const int port), { out->wrapped_connection_configuration = - new caosdb::configuration::InsecureConnectionConfiguration(host, port); + new linkahead::configuration::InsecureConnectionConfiguration(host, port); out->_deletable = true; return 0; }) @@ -330,7 +335,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, { if (configuration->_deletable && configuration->wrapped_connection_configuration) { - delete static_cast<caosdb::configuration::ConnectionConfiguration *>( + delete static_cast<linkahead::configuration::ConnectionConfiguration *>( configuration->wrapped_connection_configuration); } configuration->wrapped_connection_configuration = nullptr; @@ -343,10 +348,10 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_connection_connection *out, const caosdb_connection_connection_configuration *configuration), { - caosdb::configuration::ConnectionConfiguration *config = - static_cast<caosdb::configuration::ConnectionConfiguration *>( + linkahead::configuration::ConnectionConfiguration *config = + static_cast<linkahead::configuration::ConnectionConfiguration *>( configuration->wrapped_connection_configuration); - out->wrapped_connection = new caosdb::connection::Connection(*config); + out->wrapped_connection = new linkahead::connection::Connection(*config); out->_deletable = true; return 0; }) @@ -355,7 +360,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_connection_delete_connection(caosdb_connection_connection *connection), { if (connection->_deletable && connection->wrapped_connection) { - delete static_cast<caosdb::connection::Connection *>( + delete static_cast<linkahead::connection::Connection *>( connection->wrapped_connection); } connection->wrapped_connection = nullptr; @@ -369,7 +374,7 @@ ERROR_RETURN_CODE( const caosdb_connection_connection *connection), { auto *wrapped_connection = - static_cast<caosdb::connection::Connection *>(connection->wrapped_connection); + static_cast<linkahead::connection::Connection *>(connection->wrapped_connection); auto status = wrapped_connection->RetrieveVersionInfoNoExceptions(); if (status.IsError()) { @@ -399,22 +404,23 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_connection_connection *out), { out->wrapped_connection = - caosdb::connection::ConnectionManager::GetDefaultConnection().get(); + linkahead::connection::ConnectionManager::GetDefaultConnection().get(); out->_deletable = false; return 0; }) -ERROR_RETURN_CODE(GENERIC_ERROR, - int caosdb_connection_connection_manager_get_connection( - caosdb_connection_connection *out, const char *name), - { - out->wrapped_connection = - caosdb::connection::ConnectionManager::GetConnection(std::string(name)).get(); - // managed by the connection manager now, so not - // to be deleted manually - out->_deletable = false; - return 0; - }) +ERROR_RETURN_CODE( + GENERIC_ERROR, + int caosdb_connection_connection_manager_get_connection(caosdb_connection_connection *out, + const char *name), + { + out->wrapped_connection = + linkahead::connection::ConnectionManager::GetConnection(std::string(name)).get(); + // managed by the connection manager now, so not + // to be deleted manually + out->_deletable = false; + return 0; + }) /**************************************************************************** * ENTITY STUFF AND TRANSACTIONS @@ -423,8 +429,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_connection_connection_create_transaction( caosdb_connection_connection *connection, caosdb_transaction_transaction *out), { - auto *wrapped_connection = - static_cast<caosdb::connection::Connection *>(connection->wrapped_connection); + auto *wrapped_connection = static_cast<linkahead::connection::Connection *>( + connection->wrapped_connection); out->wrapped_transaction = wrapped_connection->CreateTransaction().release(); out->_deletable = true; return 0; @@ -434,7 +440,7 @@ ERROR_RETURN_CODE( GENERIC_ERROR, int caosdb_transaction_delete_transaction(caosdb_transaction_transaction *transaction), { if (transaction->_deletable && transaction->wrapped_transaction) { - delete static_cast<caosdb::transaction::Transaction *>(transaction->wrapped_transaction); + delete static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); } transaction->wrapped_transaction = nullptr; transaction->_deletable = false; @@ -445,7 +451,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_transaction_retrieve_by_id( caosdb_transaction_transaction *transaction, const char *id), { - auto *wrapped_transaction = static_cast<caosdb::transaction::Transaction *>( + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( transaction->wrapped_transaction); return wrapped_transaction->RetrieveById(std::string(id)); }) @@ -454,7 +460,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_transaction_retrieve_and_download_file_by_id( caosdb_transaction_transaction *transaction, const char *id, const char *path), { - auto *wrapped_transaction = static_cast<caosdb::transaction::Transaction *>( + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( transaction->wrapped_transaction); return wrapped_transaction->RetrieveAndDownloadFileById(std::string(id), std::string(path)); @@ -464,7 +470,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_transaction_retrieve_by_ids( caosdb_transaction_transaction *transaction, const char *ids[], int length), { - auto *wrapped_transaction = static_cast<caosdb::transaction::Transaction *>( + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( transaction->wrapped_transaction); return wrapped_transaction->RetrieveById(ids, ids + length); }) @@ -473,7 +479,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_transaction_query( caosdb_transaction_transaction *transaction, const char *query), { - auto *wrapped_transaction = static_cast<caosdb::transaction::Transaction *>( + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( transaction->wrapped_transaction); return wrapped_transaction->Query(std::string(query)); }) @@ -484,8 +490,8 @@ ERROR_RETURN_CODE( caosdb_entity_entity *entity), { auto *wrapped_transaction = - static_cast<caosdb::transaction::Transaction *>(transaction->wrapped_transaction); - auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); + auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); return wrapped_transaction->InsertEntity(wrapped_entity); }) @@ -496,8 +502,8 @@ ERROR_RETURN_CODE( caosdb_entity_entity *entity), { auto *wrapped_transaction = - static_cast<caosdb::transaction::Transaction *>(transaction->wrapped_transaction); - auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); + auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); return wrapped_transaction->UpdateEntity(wrapped_entity); }) @@ -506,7 +512,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_transaction_delete_by_id( caosdb_transaction_transaction *transaction, const char *id), { - auto *wrapped_transaction = static_cast<caosdb::transaction::Transaction *>( + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( transaction->wrapped_transaction); return wrapped_transaction->DeleteById(std::string(id)); @@ -516,7 +522,7 @@ ERROR_RETURN_CODE( GENERIC_ERROR, int caosdb_transaction_transaction_execute(caosdb_transaction_transaction *transaction), { auto *wrapped_transaction = - static_cast<caosdb::transaction::Transaction *>(transaction->wrapped_transaction); + static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); wrapped_transaction->ExecuteAsynchronously(); auto status = wrapped_transaction->WaitForIt(); return status.GetCode(); @@ -528,7 +534,7 @@ ERROR_RETURN_CODE( caosdb_transaction_result_set *out), { auto *wrapped_transaction = - static_cast<caosdb::transaction::Transaction *>(transaction->wrapped_transaction); + static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); out->wrapped_result_set = (void *)(&(wrapped_transaction->GetResultSet())); out->_deletable = false; return 0; @@ -540,7 +546,7 @@ ERROR_RETURN_CODE( caosdb_transaction_result_set *out), { auto *wrapped_transaction = - static_cast<caosdb::transaction::Transaction *>(transaction->wrapped_transaction); + static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); out->wrapped_result_set = (void *)(wrapped_transaction->ReleaseResultSet()); // out is the owner now, that are the semantics of ReleaseResultSet out->_deletable = true; @@ -551,7 +557,7 @@ ERROR_RETURN_CODE( GENERIC_ERROR, int caosdb_transaction_delete_result_set(caosdb_transaction_result_set *result_set), { if (result_set->_deletable && result_set->wrapped_result_set) { - delete static_cast<caosdb::entity::Entity *>(result_set->wrapped_result_set); + delete static_cast<linkahead::entity::Entity *>(result_set->wrapped_result_set); } result_set->wrapped_result_set = nullptr; result_set->_deletable = false; @@ -562,7 +568,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_transaction_get_count_result( caosdb_transaction_transaction *transaction, long *out), { - auto *wrapped_transaction = static_cast<caosdb::transaction::Transaction *>( + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( transaction->wrapped_transaction); long cr(wrapped_transaction->GetCountResult()); *out = cr; @@ -573,8 +579,9 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_transaction_result_set_at(caosdb_transaction_result_set *result_set, caosdb_entity_entity *entity, int index), { - auto *wrapped_result_set = static_cast<caosdb::transaction::MultiResultSet *>( - result_set->wrapped_result_set); + auto *wrapped_result_set = + static_cast<linkahead::transaction::MultiResultSet *>( + result_set->wrapped_result_set); entity->wrapped_entity = wrapped_result_set->mutable_at(index); return 0; }) @@ -585,33 +592,32 @@ ERROR_RETURN_CODE( caosdb_entity_entity *entity, int index), { auto *wrapped_result_set = - static_cast<caosdb::transaction::MultiResultSet *>(result_set->wrapped_result_set); + static_cast<linkahead::transaction::MultiResultSet *>(result_set->wrapped_result_set); entity->wrapped_entity = wrapped_result_set->release_at(index); // entity is the owner now. That are the semantics of release_at. entity->_deletable = true; return 0; }) -ERROR_RETURN_CODE(GENERIC_ERROR, - int caosdb_transaction_result_set_size(caosdb_transaction_result_set *result_set, - int *out), - { - auto *wrapped_result_set = static_cast<caosdb::transaction::MultiResultSet *>( - result_set->wrapped_result_set); - int size(wrapped_result_set->size()); - *out = size; - return 0; - }) +ERROR_RETURN_CODE( + GENERIC_ERROR, + int caosdb_transaction_result_set_size(caosdb_transaction_result_set *result_set, int *out), { + auto *wrapped_result_set = + static_cast<linkahead::transaction::MultiResultSet *>(result_set->wrapped_result_set); + int size(wrapped_result_set->size()); + *out = size; + return 0; + }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_create_entity(caosdb_entity_entity *out), { - out->wrapped_entity = new caosdb::entity::Entity(); + out->wrapped_entity = new linkahead::entity::Entity(); out->_deletable = true; return 0; }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_entity(caosdb_entity_entity *out), { if (out->_deletable && out->wrapped_entity) { - delete static_cast<caosdb::entity::Entity *>(out->wrapped_entity); + delete static_cast<linkahead::entity::Entity *>(out->wrapped_entity); } out->wrapped_entity = nullptr; out->_deletable = false; @@ -619,14 +625,14 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_entity(caosdb_entity_e }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_create_property(caosdb_entity_property *out), { - out->wrapped_property = new caosdb::entity::Property(); + out->wrapped_property = new linkahead::entity::Property(); out->_deletable = true; return 0; }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_property(caosdb_entity_property *out), { if (out->_deletable && out->wrapped_property) { - delete static_cast<caosdb::entity::Property *>(out->wrapped_property); + delete static_cast<linkahead::entity::Property *>(out->wrapped_property); } out->wrapped_property = nullptr; out->_deletable = false; @@ -634,14 +640,14 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_property(caosdb_entity }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_create_parent(caosdb_entity_parent *out), { - out->wrapped_parent = new caosdb::entity::Parent(); + out->wrapped_parent = new linkahead::entity::Parent(); out->_deletable = true; return 0; }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_parent(caosdb_entity_parent *out), { if (out->_deletable && out->wrapped_parent) { - delete static_cast<caosdb::entity::Parent *>(out->wrapped_parent); + delete static_cast<linkahead::entity::Parent *>(out->wrapped_parent); } out->wrapped_parent = nullptr; out->_deletable = false; @@ -654,19 +660,19 @@ ERROR_RETURN_CODE(GENERIC_ERROR, { try { auto enum_value = ENUM_VALUE_FROM_NAME(std::string(name), AtomicDataType); - out->wrapped_datatype = new caosdb::entity::DataType(enum_value); + out->wrapped_datatype = new linkahead::entity::DataType(enum_value); out->_deletable = true; return 0; } catch (const std::out_of_range &exc) { - caosdb::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); - return caosdb::StatusCode::ENUM_MAPPING_ERROR; + linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_create_reference_datatype(caosdb_entity_datatype *out, const char *name), { - out->wrapped_datatype = new caosdb::entity::DataType(std::string(name)); + out->wrapped_datatype = new linkahead::entity::DataType(std::string(name)); out->_deletable = true; return 0; }) @@ -676,21 +682,21 @@ ERROR_RETURN_CODE(GENERIC_ERROR, { try { auto enum_value = ENUM_VALUE_FROM_NAME(std::string(name), AtomicDataType); - out->wrapped_datatype = - new caosdb::entity::DataType(caosdb::entity::DataType::ListOf(enum_value)); + out->wrapped_datatype = new linkahead::entity::DataType( + linkahead::entity::DataType::ListOf(enum_value)); out->_deletable = true; return 0; } catch (const std::out_of_range &exc) { - caosdb::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); - return caosdb::StatusCode::ENUM_MAPPING_ERROR; + linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_create_reference_list_datatype(caosdb_entity_datatype *out, const char *name), { - out->wrapped_datatype = new caosdb::entity::DataType( - caosdb::entity::DataType::ListOf(std::string(name))); + out->wrapped_datatype = new linkahead::entity::DataType( + linkahead::entity::DataType::ListOf(std::string(name))); out->_deletable = true; return 0; }) @@ -773,7 +779,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_errors_size(caosdb_entity_entity *entity, int *out), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); *out = wrapped_entity->GetErrors().size(); return 0; }) @@ -783,7 +789,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_message *out, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); out->wrapped_message = wrapped_entity->GetErrors().mutable_at(index); out->_deletable = false; return 0; @@ -794,7 +800,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int *out), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); *out = wrapped_entity->GetWarnings().size(); return 0; }) @@ -804,7 +810,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_message *out, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); out->wrapped_message = wrapped_entity->GetWarnings().mutable_at(index); out->_deletable = false; return 0; @@ -813,7 +819,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_infos_size(caosdb_entity_entity *entity, int *out), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); *out = wrapped_entity->GetInfos().size(); return 0; }) @@ -823,7 +829,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_message *out, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); out->wrapped_message = wrapped_entity->GetInfos().mutable_at(index); out->_deletable = false; return 0; @@ -834,7 +840,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int *out), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); *out = wrapped_entity->GetProperties().size(); return 0; }) @@ -844,7 +850,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_property *out, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); out->wrapped_property = wrapped_entity->GetProperties().mutable_at(index); out->_deletable = false; return 0; @@ -854,7 +860,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_parents_size(caosdb_entity_entity *entity, int *out), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); *out = wrapped_entity->GetParents().size(); return 0; }) @@ -864,7 +870,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_parent *out, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); out->wrapped_parent = wrapped_entity->GetParents().mutable_at(index); out->_deletable = false; return 0; @@ -914,7 +920,7 @@ CAOSDB_PROPERTY_GET(unit, GetUnit()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_message_get_code(caosdb_entity_message *message, int *out), { auto *wrapped_message = - static_cast<caosdb::entity::Message *>(message->wrapped_message); + static_cast<linkahead::entity::Message *>(message->wrapped_message); *out = wrapped_message->GetCode(); return 0; }) @@ -922,7 +928,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE( GENERIC_ERROR, int caosdb_entity_message_get_description(caosdb_entity_message *message, char **out), { - auto *wrapped_message = static_cast<caosdb::entity::Message *>(message->wrapped_message); + auto *wrapped_message = static_cast<linkahead::entity::Message *>(message->wrapped_message); auto *tmp = (char *)malloc(sizeof(char) * wrapped_message->GetDescription().length() + 1); strcpy(tmp, wrapped_message->GetDescription().c_str()); delete[] *out; @@ -1045,8 +1051,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, wrapped_entity->SetRole(enum_value); return 0; } catch (const std::out_of_range &exc) { - caosdb::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); - return caosdb::StatusCode::ENUM_MAPPING_ERROR; + linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) CAOSDB_ENTITY_SET(name, name, wrapped_entity->SetName(std::string(name));) @@ -1080,9 +1086,9 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_parent *parent), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); auto *wrapped_parent = - static_cast<caosdb::entity::Parent *>(parent->wrapped_parent); + static_cast<linkahead::entity::Parent *>(parent->wrapped_parent); wrapped_entity->AppendParent(*wrapped_parent); return 0; }) @@ -1090,7 +1096,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_remove_parent(caosdb_entity_entity *entity, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); wrapped_entity->RemoveParent(index); return 0; }) @@ -1100,9 +1106,9 @@ ERROR_RETURN_CODE(GENERIC_ERROR, caosdb_entity_property *property), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); auto *wrapped_property = - static_cast<caosdb::entity::Property *>(property->wrapped_property); + static_cast<linkahead::entity::Property *>(property->wrapped_property); wrapped_entity->AppendProperty(*wrapped_property); return 0; }) @@ -1110,7 +1116,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_remove_property(caosdb_entity_entity *entity, int index), { auto *wrapped_entity = - static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); + static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); wrapped_entity->RemoveProperty(index); return 0; }) @@ -1149,8 +1155,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, wrapped_property->SetImportance(enum_value); return 0; } catch (const std::out_of_range &exc) { - caosdb::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); - return caosdb::StatusCode::ENUM_MAPPING_ERROR; + linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) diff --git a/src/cxxlinkaheadcli.cpp b/src/cxxlinkaheadcli.cpp index 34d468c643c1db2dbfe719161c9ac9b3680b67fa..816d08da9effb7f4b0a5deaf385a23cb4b2a6a13 100644 --- a/src/cxxlinkaheadcli.cpp +++ b/src/cxxlinkaheadcli.cpp @@ -39,17 +39,18 @@ #include <memory> // for unique_ptr, allocator, __shared_ptr_... #include <string> // for operator<<, char_traits -const auto logger_name = "libcaosdb"; +const auto logger_name = "liblinkahead"; auto main() -> int { - std::cout << "CaosDB C++ client (libcaosdb " << caosdb::LIBCAOSDB_VERSION_MINOR << "." - << caosdb::LIBCAOSDB_VERSION_MINOR << "." << caosdb::LIBCAOSDB_VERSION_PATCH << ")\n" + std::cout << "CaosDB C++ client (libcaosdb " << linkahead::LIBCAOSDB_VERSION_MINOR << "." + << linkahead::LIBCAOSDB_VERSION_MINOR << "." << linkahead::LIBCAOSDB_VERSION_PATCH + << ")\n" << "We don't miss the H of caos.\n" << std::endl; try { - const auto &connection = caosdb::connection::ConnectionManager::GetDefaultConnection(); + const auto &connection = linkahead::connection::ConnectionManager::GetDefaultConnection(); connection->RetrieveVersionInfoNoExceptions(); // get version info of the server @@ -85,7 +86,7 @@ auto main() -> int { } return 0; - } catch (const caosdb::exceptions::ConfigurationError &exc) { + } catch (const linkahead::exceptions::ConfigurationError &exc) { std::cout << "ConfigurationError: " << exc.what() << std::endl; return exc.GetCode(); } catch (const std::exception &exc) { diff --git a/src/linkahead/acm/user.cpp b/src/linkahead/acm/user.cpp index bd5a600a798236b2f24bb8d576f3775861c5f108..392c7e60fcc9ed1d1ca5833367e600d5f2f5c775 100644 --- a/src/linkahead/acm/user.cpp +++ b/src/linkahead/acm/user.cpp @@ -24,8 +24,8 @@ #include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper #include <utility> // for move -namespace caosdb::acm { -using caosdb::utility::ScalarProtoMessageWrapper; +namespace linkahead::acm { +using linkahead::utility::ScalarProtoMessageWrapper; using ProtoUser = caosdb::acm::v1alpha1::User; UserImpl::UserImpl() = default; @@ -113,4 +113,4 @@ auto User::SetPassword(const std::string &password) -> void { auto User::ToString() const -> std::string { return this->wrapped->ToString(); } -} // namespace caosdb::acm +} // namespace linkahead::acm diff --git a/src/linkahead/acm/user_impl.h b/src/linkahead/acm/user_impl.h index 4fc625d38371966c0ae3d3ca35bc4acd401913c8..5cbe1ab8796970b8bd5eb830b31f5ce5e9cf0359 100644 --- a/src/linkahead/acm/user_impl.h +++ b/src/linkahead/acm/user_impl.h @@ -24,8 +24,8 @@ #include <memory> // for unique_ptr #include <utility> // for move -namespace caosdb::acm { -using caosdb::utility::ScalarProtoMessageWrapper; +namespace linkahead::acm { +using linkahead::utility::ScalarProtoMessageWrapper; using ProtoUser = caosdb::acm::v1alpha1::User; /** @@ -49,10 +49,10 @@ public: UserImpl(ProtoUser *user); friend class User; - friend class caosdb::connection::Connection; + friend class linkahead::connection::Connection; private: std::string password; }; -} // namespace caosdb::acm +} // namespace linkahead::acm diff --git a/src/linkahead/authentication.cpp b/src/linkahead/authentication.cpp index 66c9c440ec5831f7a00893c94bd69d1984e4a1f4..2d3cd96f2e4fa2360ebfe7c9b06dae82fb70e483 100644 --- a/src/linkahead/authentication.cpp +++ b/src/linkahead/authentication.cpp @@ -19,7 +19,7 @@ * */ #include "linkahead/authentication.h" -#include "linkahead/utility.h" // for base64_encode +#include "linkahead/utility.h" // for base64_encode #include <grpcpp/security/credentials.h> // for MetadataCredentialsPlugin #include <grpcpp/security/auth_context.h> // for AuthContext #include <map> // for multimap @@ -27,20 +27,21 @@ #include <string> // for basic_string, operator+ #include <utility> // for pair, move, make_pair -namespace caosdb::authentication { -using caosdb::utility::base64_encode; +namespace linkahead::authentication { using grpc::AuthContext; using grpc::MetadataCredentialsPlugin; using grpc::Status; using grpc::string_ref; +using linkahead::utility::base64_encode; MetadataCredentialsPluginImpl::MetadataCredentialsPluginImpl(std::string key, std::string value) : key(std::move(key)), value(std::move(value)) {} -auto MetadataCredentialsPluginImpl::GetMetadata( - string_ref /*service_url*/, string_ref /*method_name*/, - const AuthContext & /*channel_auth_context*/, - std::multimap<grpc::string, grpc::string> *metadata) -> Status { +auto MetadataCredentialsPluginImpl::GetMetadata(string_ref /*service_url*/, + string_ref /*method_name*/, + const AuthContext & /*channel_auth_context*/, + std::multimap<grpc::string, grpc::string> *metadata) + -> Status { metadata->insert(std::make_pair(this->key, this->value)); return Status::OK; @@ -59,4 +60,4 @@ auto PlainPasswordAuthenticator::GetCallCredentials() const return call_creds; } -} // namespace caosdb::authentication +} // namespace linkahead::authentication diff --git a/src/linkahead/configuration.cpp b/src/linkahead/configuration.cpp index bd528a2e71d8624ef7db58ca9dd74e278088fafa..d5316717364ceba4473a0d417c588491df7329a7 100644 --- a/src/linkahead/configuration.cpp +++ b/src/linkahead/configuration.cpp @@ -19,14 +19,14 @@ * */ #include "linkahead/configuration.h" -#include "linkahead/authentication.h" // for Authenticator -#include "linkahead/connection.h" // for ConnectionManager -#include "linkahead/constants.h" // for LIBCAOSDB_CONF... -#include "linkahead/exceptions.h" // for ConfigurationE... -#include "linkahead/log_level.h" // for CAOSDB_DEFAULT... -#include "linkahead/logging.h" // for SinkConfiguration, Loggin... -#include "linkahead/status_code.h" // for StatusCode -#include "linkahead/utility.h" // for get_home_direc... +#include "linkahead/authentication.h" // for Authenticator +#include "linkahead/connection.h" // for ConnectionManager +#include "linkahead/constants.h" // for LIBCAOSDB_CONF... +#include "linkahead/exceptions.h" // for ConfigurationE... +#include "linkahead/log_level.h" // for CAOSDB_DEFAULT... +#include "linkahead/logging.h" // for SinkConfiguration, Loggin... +#include "linkahead/status_code.h" // for StatusCode +#include "linkahead/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 @@ -55,7 +55,7 @@ throw ConfigurationError("This CaosDB client has not been configured."); \ } \ assert(WRAPPED_JSON_CONFIGURATION(this)->is_object()); \ - const auto &configuration = WRAPPED_JSON_CONFIGURATION(this)->as_object(); \ + const auto &configuration = WRAPPED_JSON_CONFIGURATION(this) -> as_object(); \ if (!configuration.contains("connections")) { \ throw ConfigurationError("This CaosDB client hasn't any configured connections."); \ } \ @@ -69,24 +69,24 @@ throw ConfigurationError("This CaosDB client hasn't any configured connections."); \ } -namespace caosdb::configuration { +namespace linkahead::configuration { using boost::json::object; using boost::json::value; -using caosdb::authentication::Authenticator; -using caosdb::authentication::PlainPasswordAuthenticator; -using caosdb::connection::ConnectionManager; -using caosdb::exceptions::ConfigurationError; -using caosdb::logging::ConsoleSinkConfiguration; -using caosdb::logging::FileSinkConfiguration; -using caosdb::logging::LoggingConfiguration; -using caosdb::logging::SinkConfiguration; -using caosdb::logging::SyslogSinkConfiguration; -using caosdb::utility::get_home_directory; -using caosdb::utility::load_json_file; -using caosdb::utility::load_string_file; using grpc::InsecureChannelCredentials; using grpc::SslCredentials; using grpc::SslCredentialsOptions; +using linkahead::authentication::Authenticator; +using linkahead::authentication::PlainPasswordAuthenticator; +using linkahead::connection::ConnectionManager; +using linkahead::exceptions::ConfigurationError; +using linkahead::logging::ConsoleSinkConfiguration; +using linkahead::logging::FileSinkConfiguration; +using linkahead::logging::LoggingConfiguration; +using linkahead::logging::SinkConfiguration; +using linkahead::logging::SyslogSinkConfiguration; +using linkahead::utility::get_home_directory; +using linkahead::utility::load_json_file; +using linkahead::utility::load_string_file; using std::filesystem::exists; using std::filesystem::path; @@ -274,19 +274,19 @@ auto CreateConnectionConfiguration(const object &from) -> std::unique_ptr<Connec } auto CreateConsoleSinkConfiguration(const object & /*from*/, const std::string &name, int level) - -> std::shared_ptr<caosdb::logging::SinkConfiguration> { + -> std::shared_ptr<linkahead::logging::SinkConfiguration> { auto result = std::make_shared<ConsoleSinkConfiguration>(name, level); return result; } auto CreateSyslogSinkConfiguration(const object & /*from*/, const std::string &name, int level) - -> std::shared_ptr<caosdb::logging::SinkConfiguration> { + -> std::shared_ptr<linkahead::logging::SinkConfiguration> { auto result = std::make_shared<SyslogSinkConfiguration>(name, level); return result; } -auto CreateFileSinkConfiguration(const object &from, const std::string &name, - int level) -> std::shared_ptr<caosdb::logging::SinkConfiguration> { +auto CreateFileSinkConfiguration(const object &from, const std::string &name, int level) + -> std::shared_ptr<linkahead::logging::SinkConfiguration> { auto result = std::make_shared<FileSinkConfiguration>(name, level); if (from.contains("directory")) { result->SetDirectory(from.at("directory").as_string().c_str()); @@ -309,7 +309,7 @@ auto ConvertLogLevel(const std::string &string_level) -> int { } auto CreateSinkConfiguration(const object &from, const std::string &name, int default_level) - -> std::shared_ptr<caosdb::logging::SinkConfiguration> { + -> std::shared_ptr<linkahead::logging::SinkConfiguration> { assert(from.contains("destination")); const auto &destination = std::string(from.at("destination").as_string().c_str()); @@ -358,7 +358,7 @@ auto ConfigurationManager::mReset() noexcept -> int { mClear(); InitializeDefaults(); return StatusCode::SUCCESS; - } catch (const caosdb::exceptions::Exception &exc) { + } catch (const linkahead::exceptions::Exception &exc) { return exc.GetCode(); } catch (const std::exception &exc) { CAOSDB_LOG_ERROR(logger_name) << "Unknown error during the reset of the ConfigurationManager: " @@ -372,7 +372,7 @@ auto ConfigurationManager::mClear() noexcept -> int { json_configuration.Reset(); ConnectionManager::Reset(); return StatusCode::SUCCESS; - } catch (const caosdb::exceptions::Exception &exc) { + } catch (const linkahead::exceptions::Exception &exc) { return exc.GetCode(); } catch (const std::exception &exc) { CAOSDB_LOG_ERROR(logger_name) << "Unknown error during the reset of the ConfigurationManager: " @@ -429,7 +429,8 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT // find the configuration file... std::unique_ptr<path> configuration_file_path; - for (const char *const &configuration_file : caosdb::LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE) { + for (const char *const &configuration_file : + linkahead::LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE) { if (strcmp(configuration_file, "$CAOSDB_CLIENT_CONFIGURATION") == 0) { // user specified a file via the environment variable // TODO(tf) make this thread-secure (concurrency-mt-unsafe) @@ -493,4 +494,4 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT const int IS_INITIALIZED = ConfigurationManager::Reset(); -} // namespace caosdb::configuration +} // namespace linkahead::configuration diff --git a/src/linkahead/connection.cpp b/src/linkahead/connection.cpp index 42a5d7b50e1195ec56c17a7a759c5f3b60362872..91d5a0c2208cd2c7cfd4b57743cfe1aca7ac257d 100644 --- a/src/linkahead/connection.cpp +++ b/src/linkahead/connection.cpp @@ -21,30 +21,29 @@ */ #include "linkahead/connection.h" #ifdef BUILD_ACM -#include "linkahead/acm/user_impl.h" // for UserImpl +#include "linkahead/acm/user_impl.h" // for UserImpl #include "caosdb/acm/v1alpha1/main.grpc.pb.h" // for AccessControlMan... #include "caosdb/acm/v1alpha1/main.pb.h" // for CreateSingleUser... #endif -#include "linkahead/configuration.h" // for ConnectionConfigur... -#include "linkahead/exceptions.h" // for ConfigurationError -#include "linkahead/info.h" // for VersionInfo -#include "caosdb/info/v1/main.grpc.pb.h" // for GeneralInfoService -#include "caosdb/info/v1/main.pb.h" // for GetVersionInfoRequest -#include "linkahead/transaction.h" // for Transaction -#include "linkahead/transaction_status.h" // for TransactionStatus -#include <grpcpp/client_context.h> // for ClientContext -#include <grpcpp/create_channel.h> // for CreateChannel -#include <grpcpp/support/status.h> // for Status -#include <string> // for string, operator+ -#include <memory> // for make_shared +#include "linkahead/configuration.h" // for ConnectionConfigur... +#include "linkahead/exceptions.h" // for ConfigurationError +#include "linkahead/info.h" // for VersionInfo +#include "caosdb/info/v1/main.grpc.pb.h" // for GeneralInfoService +#include "caosdb/info/v1/main.pb.h" // for GetVersionInfoRequest +#include "linkahead/transaction.h" // for Transaction +#include "linkahead/transaction_status.h" // for TransactionStatus +#include <grpcpp/client_context.h> // for ClientContext +#include <grpcpp/create_channel.h> // for CreateChannel +#include <grpcpp/support/status.h> // for Status +#include <string> // for string, operator+ +#include <memory> // for make_shared #ifdef BUILD_ACM #include <vector> // for vector #endif // IWYU pragma: no_include "net/proto2/public/repeated_field.h" -namespace caosdb::connection { +namespace linkahead::connection { #ifdef BUILD_ACM -using caosdb::acm::UserImpl; using caosdb::acm::v1alpha1::AccessControlManagementService; using caosdb::acm::v1alpha1::CreateSingleUserRequest; using caosdb::acm::v1alpha1::CreateSingleUserResponse; @@ -54,17 +53,18 @@ using caosdb::acm::v1alpha1::ListUsersRequest; using caosdb::acm::v1alpha1::ListUsersResponse; using caosdb::acm::v1alpha1::RetrieveSingleUserRequest; using caosdb::acm::v1alpha1::RetrieveSingleUserResponse; +using linkahead::acm::UserImpl; #endif -using caosdb::configuration::ConfigurationManager; -using caosdb::configuration::ConnectionConfiguration; using caosdb::entity::v1::EntityTransactionService; using caosdb::entity::v1::FileTransmissionService; -using caosdb::info::VersionInfo; using caosdb::info::v1::GeneralInfoService; using caosdb::info::v1::GetVersionInfoRequest; using caosdb::info::v1::GetVersionInfoResponse; -using caosdb::transaction::Transaction; -using caosdb::transaction::TransactionStatus; +using linkahead::configuration::ConfigurationManager; +using linkahead::configuration::ConnectionConfiguration; +using linkahead::info::VersionInfo; +using linkahead::transaction::Transaction; +using linkahead::transaction::TransactionStatus; Connection::Connection(const ConnectionConfiguration &configuration) { const std::string target = @@ -254,9 +254,9 @@ auto ConnectionManager::mGetConnection(const std::string &name) const try { auto connection = ConfigurationManager::GetConnectionConfiguration(name); connections[name] = std::make_shared<Connection>(*connection.release()); - } catch (const caosdb::exceptions::ConfigurationError &exc) { - throw caosdb::exceptions::ConnectionConfigurationError("Error with the connection named '" + - name + "': " + exc.what()); + } catch (const linkahead::exceptions::ConfigurationError &exc) { + throw linkahead::exceptions::ConnectionConfigurationError( + "Error with the connection named '" + name + "': " + exc.what()); } } return this->connections.at(name); @@ -273,4 +273,4 @@ auto ConnectionManager::mGetDefaultConnection() const -> const std::shared_ptr<C return connections.at(default_connection_name); } -} // namespace caosdb::connection +} // namespace linkahead::connection diff --git a/src/linkahead/entity.cpp b/src/linkahead/entity.cpp index ce582506812e1e88e2386e95d4ff79fa2dbaf4d4..b4230444d6f2c0b8281e4e70e0b50220d64247ed 100644 --- a/src/linkahead/entity.cpp +++ b/src/linkahead/entity.cpp @@ -20,15 +20,15 @@ * */ #include "linkahead/entity.h" -#include "linkahead/data_type.h" // for DataType -#include "caosdb/entity/v1/main.pb.h" // for Messages -#include "linkahead/protobuf_helper.h" // for get_arena -#include "linkahead/status_code.h" // for StatusCode -#include <google/protobuf/arena.h> // for Arena -#include <string> // for string -#include <vector> // for vector - -namespace caosdb::entity { +#include "linkahead/data_type.h" // for DataType +#include "caosdb/entity/v1/main.pb.h" // for Messages +#include "linkahead/protobuf_helper.h" // for get_arena +#include "linkahead/status_code.h" // for StatusCode +#include <google/protobuf/arena.h> // for Arena +#include <string> // for string +#include <vector> // for vector + +namespace linkahead::entity { using ProtoParent = caosdb::entity::v1::Parent; using ProtoProperty = caosdb::entity::v1::Property; using ProtoEntity = caosdb::entity::v1::Entity; @@ -36,8 +36,8 @@ 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; +using linkahead::utility::get_arena; // Parent ///////////////////////////////////////////////////////////////////// @@ -272,4 +272,4 @@ auto Entity::SetFilePath(const std::string &path) -> void { this->wrapped->mutable_file_descriptor()->set_path(path); } -} // namespace caosdb::entity +} // namespace linkahead::entity diff --git a/src/linkahead/file_transmission/download_request_handler.cpp b/src/linkahead/file_transmission/download_request_handler.cpp index 6501cf1fd833584f4539b86f1f7dafcc5ee1ec53..6578e75b64a3798be366bf6e7a82f2a9ffd7e1f5 100644 --- a/src/linkahead/file_transmission/download_request_handler.cpp +++ b/src/linkahead/file_transmission/download_request_handler.cpp @@ -47,26 +47,26 @@ * > DEALINGS IN THE SOFTWARE. */ #include "linkahead/file_transmission/download_request_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE -#include "linkahead/protobuf_helper.h" // for get_arena -#include "linkahead/status_code.h" // for GENERIC_RPC_E... -#include "linkahead/transaction_status.h" // for TransactionStatus -#include <exception> // IWYU pragma: keep -#include <filesystem> // for operator<<, path -#include <google/protobuf/arena.h> // for Arena -#include <grpcpp/client_context.h> // for ClientContext -#include <grpcpp/completion_queue.h> // for CompletionQueue -#include <grpcpp/support/async_stream.h> // for ClientAsyncReader -#include <grpcpp/support/status.h> // for Status -#include <stdexcept> // for runtime_error -#include <string> // for string, opera... -#include <utility> // for move +#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE +#include "linkahead/protobuf_helper.h" // for get_arena +#include "linkahead/status_code.h" // for GENERIC_RPC_E... +#include "linkahead/transaction_status.h" // for TransactionStatus +#include <exception> // IWYU pragma: keep +#include <filesystem> // for operator<<, path +#include <google/protobuf/arena.h> // for Arena +#include <grpcpp/client_context.h> // for ClientContext +#include <grpcpp/completion_queue.h> // for CompletionQueue +#include <grpcpp/support/async_stream.h> // for ClientAsyncReader +#include <grpcpp/support/status.h> // for Status +#include <stdexcept> // for runtime_error +#include <string> // for string, opera... +#include <utility> // for move // IWYU pragma: no_include <bits/exception.h> // -namespace caosdb::transaction { -using caosdb::StatusCode; -using caosdb::utility::get_arena; +namespace linkahead::transaction { using google::protobuf::Arena; +using linkahead::StatusCode; +using linkahead::utility::get_arena; DownloadRequestHandler::DownloadRequestHandler(HandlerTag tag, FileTransmissionService::Stub *stub, grpc::CompletionQueue *cq, @@ -187,4 +187,4 @@ void DownloadRequestHandler::handleCallCompleteState() { CAOSDB_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleCallCompleteState"; } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/file_transmission/file_reader.cpp b/src/linkahead/file_transmission/file_reader.cpp index 9e68f0954072f28b90f8bf560ea405382cbb8252..d2d39b5a9afb9b4edc3755a1ea0ed569ec569b3e 100644 --- a/src/linkahead/file_transmission/file_reader.cpp +++ b/src/linkahead/file_transmission/file_reader.cpp @@ -48,10 +48,10 @@ */ #include "linkahead/file_transmission/file_reader.h" #include "linkahead/file_transmission/file_error.h" // for FileIOError -#include <filesystem> // for path -#include <utility> // for move +#include <filesystem> // for path +#include <utility> // for move -namespace caosdb::transaction { +namespace linkahead::transaction { FileReader::FileReader(std::filesystem::path filename) : filename_(std::move(filename)), size_(0) { this->openFile(); @@ -88,4 +88,4 @@ std::size_t FileReader::read(std::string &buffer) { return bytesRead; } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/file_transmission/file_writer.cpp b/src/linkahead/file_transmission/file_writer.cpp index f7c138e330a225118f830d669af606423478bf62..e6030c05352e977d031d88b491d6ebfdd5686075 100644 --- a/src/linkahead/file_transmission/file_writer.cpp +++ b/src/linkahead/file_transmission/file_writer.cpp @@ -48,10 +48,10 @@ */ #include "linkahead/file_transmission/file_writer.h" #include "linkahead/file_transmission/file_error.h" // for FileIOError -#include <filesystem> // for path -#include <utility> // for move +#include <filesystem> // for path +#include <utility> // for move -namespace caosdb::transaction { +namespace linkahead::transaction { FileWriter::FileWriter(std::filesystem::path filename) : filename_(std::move(filename)) { this->openFile(); @@ -74,4 +74,4 @@ void FileWriter::write(const std::string &buffer) { } } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/file_transmission/register_file_upload_handler.cpp b/src/linkahead/file_transmission/register_file_upload_handler.cpp index 95a04ddf71249123121183cdc113830328e0a761..58abb2e079a29462719908f6e20c367e3f4313e1 100644 --- a/src/linkahead/file_transmission/register_file_upload_handler.cpp +++ b/src/linkahead/file_transmission/register_file_upload_handler.cpp @@ -49,7 +49,7 @@ #include "linkahead/file_transmission/register_file_upload_handler.h" #include "linkahead/logging.h" // for CAOSDB_LOG_TRACE -namespace caosdb::transaction { +namespace linkahead::transaction { RegisterFileUploadHandler::~RegisterFileUploadHandler() = default; @@ -73,4 +73,4 @@ void RegisterFileUploadHandler::handleNewCallState() { CAOSDB_LOG_TRACE(logger_name) << "Leave RegisterFileUploadHandler::handleNewCallState"; } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/file_transmission/upload_request_handler.cpp b/src/linkahead/file_transmission/upload_request_handler.cpp index d3a52406d70fecd800f5c401b4ade18f042ae725..0e4311315e725f9b022f59e01f996dd5ca72094f 100644 --- a/src/linkahead/file_transmission/upload_request_handler.cpp +++ b/src/linkahead/file_transmission/upload_request_handler.cpp @@ -47,10 +47,10 @@ * > DEALINGS IN THE SOFTWARE. */ #include "linkahead/file_transmission/upload_request_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_ERROR -#include "linkahead/protobuf_helper.h" // for get_arena -#include "linkahead/status_code.h" // for GENERIC_RPC_E... -#include "linkahead/transaction_status.h" // for TransactionStatus +#include "linkahead/logging.h" // for CAOSDB_LOG_ERROR +#include "linkahead/protobuf_helper.h" // for get_arena +#include "linkahead/status_code.h" // for GENERIC_RPC_E... +#include "linkahead/transaction_status.h" // for TransactionStatus #include <algorithm> // for min #include <cstdint> // for uint64_t #include <exception> // IWYU pragma: keep @@ -61,10 +61,10 @@ #include <utility> // for move // IWYU pragma: no_include <bits/exception.h> -namespace caosdb::transaction { -using caosdb::StatusCode; -using caosdb::utility::get_arena; +namespace linkahead::transaction { using google::protobuf::Arena; +using linkahead::StatusCode; +using linkahead::utility::get_arena; UploadRequestHandler::UploadRequestHandler(HandlerTag tag, FileTransmissionService::Stub *stub, grpc::CompletionQueue *cq, @@ -197,4 +197,4 @@ void UploadRequestHandler::handleCallCompleteState() { CAOSDB_LOG_TRACE(logger_name) << "Leave UploadRequestHandler::handleCallCompleteState"; } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/logging.cpp b/src/linkahead/logging.cpp index d85677bf8bb6662d9c6046bfa2c65bbc84f5a653..28d07ac5310fc9b7674f88e9436f673433f7f4b2 100644 --- a/src/linkahead/logging.cpp +++ b/src/linkahead/logging.cpp @@ -35,7 +35,7 @@ #include <utility> // for move #include <vector> -namespace caosdb::logging { +namespace linkahead::logging { using boost_logger_class = boost::log::sources::severity_channel_logger_mt<int, std::string>; class logger { @@ -54,68 +54,68 @@ LoggerOutputStream::LoggerOutputStream(std::string channel, int level) : channel(std::move(channel)), level(level) {} auto LoggerOutputStream::operator<<(std::ostream &(*f)(std::ostream &)) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), this->channel, this->level) << f; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), this->channel, this->level) << f; return *this; } auto LoggerOutputStream::operator<<(bool msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), this->channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), this->channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(std::streambuf *msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(int msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(int64_t msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(uint64_t msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(const char *msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(const std::string &msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(void *msg) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg; + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << msg; return *this; } auto LoggerOutputStream::operator<<(std::filesystem::path *path) -> LoggerOutputStream & { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << path->string(); + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << path->string(); return *this; } LoggerOutputStream &LoggerOutputStream::operator<<(const std::filesystem::path &path) { - BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << path.string(); + BOOST_LOG_CHANNEL_SEV(linkahead::logging::logger::get(), channel, this->level) << path.string(); return *this; } @@ -266,4 +266,4 @@ void caosdb_log_trace(const char *channel, const char *msg) { LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_TRACE) << msg; } -} // namespace caosdb::logging +} // namespace linkahead::logging diff --git a/src/linkahead/protobuf_helper.cpp b/src/linkahead/protobuf_helper.cpp index 8eb48287bdf53e76954a00cd7535ed250bd34f08..287fa5f4dfe83e5d0559b656cf38178e1e224a84 100644 --- a/src/linkahead/protobuf_helper.cpp +++ b/src/linkahead/protobuf_helper.cpp @@ -22,12 +22,12 @@ #include "linkahead/configuration.h" #include <google/protobuf/arena.h> // for Arena -namespace caosdb::utility { +namespace linkahead::utility { using google::protobuf::Arena; -auto get_arena() -> Arena * { return caosdb::configuration::ConfigurationManager::GetArena(); } +auto get_arena() -> Arena * { return linkahead::configuration::ConfigurationManager::GetArena(); } auto reset_arena() -> void { get_arena()->Reset(); } -} // namespace caosdb::utility +} // namespace linkahead::utility diff --git a/src/linkahead/result_set.cpp b/src/linkahead/result_set.cpp index 04f8c5c040e23338ee6a983504a8cd992012cab7..2517e61d98ea5e852205db17d137cf6dfb9b596e 100644 --- a/src/linkahead/result_set.cpp +++ b/src/linkahead/result_set.cpp @@ -18,11 +18,11 @@ * */ #include "linkahead/result_set.h" // for ResultSet -#include <memory> // for unique_ptr -#include <utility> // for move, pair +#include <memory> // for unique_ptr +#include <utility> // for move, pair #include <vector> -namespace caosdb::transaction { +namespace linkahead::transaction { ResultSet::iterator::iterator(const ResultSet *result_set_param, int index) : current_index(index), result_set(result_set_param) {} @@ -53,4 +53,4 @@ auto ResultSet::end() const -> ResultSet::iterator { return ResultSet::iterator( MultiResultSet::MultiResultSet(std::vector<std::unique_ptr<Entity>> result_set) : AbstractMultiResultSet(std::move(result_set)) {} -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/result_table.cpp b/src/linkahead/result_table.cpp index 4704020394fb77162c10031f2117c6322cd12725..c08cc4db516f9b4c238cc3c5a7f18a90ea557cde 100644 --- a/src/linkahead/result_table.cpp +++ b/src/linkahead/result_table.cpp @@ -18,11 +18,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#include "linkahead/result_table.h" // for ResultTable, ResultTab... +#include "linkahead/result_table.h" // for ResultTable, ResultTab... #include "caosdb/entity/v1/main.pb.h" // for SelectQueryResult, Sel... -#include "linkahead/protobuf_helper.h" // for ScalarProtoMessageWrapper -#include "linkahead/result_table_impl.h" // for ResultTableImpl, Resul... -#include "linkahead/value.h" // for Value +#include "linkahead/protobuf_helper.h" // for ScalarProtoMessageWrapper +#include "linkahead/result_table_impl.h" // for ResultTableImpl, Resul... +#include "linkahead/value.h" // for Value #include <algorithm> // for max #include <google/protobuf/repeated_field.h> // IWYU pragma: keep for RepeatedPtrField #include <memory> // for unique_ptr @@ -31,13 +31,13 @@ #include <vector> // for vector // IWYU pragma: no_include "net/proto2/public/repeated_field.h" -namespace caosdb::transaction { -using caosdb::entity::Value; +namespace linkahead::transaction { +using linkahead::entity::Value; using ProtoSelectQueryResult = caosdb::entity::v1::SelectQueryResult; using ProtoSelectQueryHeader = caosdb::entity::v1::SelectQueryHeader; using ProtoSelectQueryColumn = caosdb::entity::v1::SelectQueryColumn; using ProtoSelectQueryRow = caosdb::entity::v1::SelectQueryRow; -using caosdb::utility::ScalarProtoMessageWrapper; +using linkahead::utility::ScalarProtoMessageWrapper; ResultTableRowImpl::ResultTableRowImpl(ProtoSelectQueryResult *table, int row) : header(*table->mutable_header()), row(*table->mutable_data_rows(row)) {} @@ -179,4 +179,4 @@ auto ResultTable::HeaderIterator::end() const -> HeaderIterator { return HeaderIterator(this->result_table, size()); } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/result_table_impl.h b/src/linkahead/result_table_impl.h index 05510646d496787ec793209dac62126373fea8f1..cb1202710d13513f5ecee3ad42aef5dc332995ab 100644 --- a/src/linkahead/result_table_impl.h +++ b/src/linkahead/result_table_impl.h @@ -21,8 +21,8 @@ #define CAOSDB_RESULT_TABLE_IMPL_H #include "linkahead/transaction.h" -#include "caosdb/entity/v1/main.pb.h" // for EntityTransac... -#include "caosdb/entity/v1/main.pb.h" // for TransactionRe... +#include "caosdb/entity/v1/main.pb.h" // for EntityTransac... +#include "caosdb/entity/v1/main.pb.h" // for TransactionRe... #include "linkahead/file_transmission/download_request_handler.h" // Download... #include "linkahead/file_transmission/file_reader.h" // for path #include "linkahead/file_transmission/register_file_upload_handler.h" // for RegisterFileUploadHandler @@ -30,25 +30,25 @@ #include "linkahead/logging.h" // for CAOSDB_LOG_FATAL #include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper #include "linkahead/status_code.h" // for StatusCode -#include "linkahead/transaction_handler.h" // for EntityTransactionHandler -#include <algorithm> // for max -#include <filesystem> // for operator<<, path -#include <future> // for async, future -#include <google/protobuf/arena.h> // for Arena -#include <grpc/grpc.h> // for gpr_timespec -#include <map> // for map, operator!= -#include <memory> // for unique_ptr -#include <random> // for mt19937, rand... -#include <system_error> // for std::system_error -#include <utility> // for move, pair +#include "linkahead/transaction_handler.h" // for EntityTransactionHandler +#include <algorithm> // for max +#include <filesystem> // for operator<<, path +#include <future> // for async, future +#include <google/protobuf/arena.h> // for Arena +#include <grpc/grpc.h> // for gpr_timespec +#include <map> // for map, operator!= +#include <memory> // for unique_ptr +#include <random> // for mt19937, rand... +#include <system_error> // for std::system_error +#include <utility> // for move, pair -namespace caosdb::transaction { -using caosdb::entity::Value; +namespace linkahead::transaction { +using linkahead::entity::Value; using ProtoSelectQueryResult = caosdb::entity::v1::SelectQueryResult; using ProtoSelectQueryHeader = caosdb::entity::v1::SelectQueryHeader; using ProtoSelectQueryColumn = caosdb::entity::v1::SelectQueryColumn; using ProtoSelectQueryRow = caosdb::entity::v1::SelectQueryRow; -using caosdb::utility::ScalarProtoMessageWrapper; +using linkahead::utility::ScalarProtoMessageWrapper; class ResultTableRowImpl { explicit ResultTableRowImpl(ProtoSelectQueryResult *table, int row); @@ -76,9 +76,9 @@ class ResultTableImpl : public ScalarProtoMessageWrapper<ProtoSelectQueryResult> friend class ResultTable; friend class ResultTable::HeaderIterator; friend class ResultTableColumn; - friend auto - ProcessSelectResponse(ProtoSelectQueryResult *select_result) -> std::unique_ptr<ResultTable>; + friend auto ProcessSelectResponse(ProtoSelectQueryResult *select_result) + -> std::unique_ptr<ResultTable>; }; -} // namespace caosdb::transaction +} // namespace linkahead::transaction #endif diff --git a/src/linkahead/status_code_description.cpp b/src/linkahead/status_code_description.cpp index 3e422a7aca9aa9982547d549467e1bc8141724fd..59517c4763a2450d5c01675b54fe23a4a8b6955d 100644 --- a/src/linkahead/status_code_description.cpp +++ b/src/linkahead/status_code_description.cpp @@ -19,11 +19,11 @@ */ #include "linkahead/status_code.h" // for StatusCode, ABORTED, ALREADY_EXISTS -#include <map> // for allocator, map -#include <stdexcept> // for out_of_range -#include <string> // for string, basic_string +#include <map> // for allocator, map +#include <stdexcept> // for out_of_range +#include <string> // for string, basic_string -namespace caosdb { +namespace linkahead { /* * The descriptions of the StatusCodes 1-16 are originally taken from @@ -171,6 +171,6 @@ auto get_status_description(int code) -> const std::string & { } } -} // namespace caosdb +} // namespace linkahead // LocalWords: ConnectionManager Extern diff --git a/src/linkahead/transaction.cpp b/src/linkahead/transaction.cpp index bf1c5358b0e9d2834681174b13e45fb03b775579..fe055b1512fac5459ec9d1ac63fee18575d030e8 100644 --- a/src/linkahead/transaction.cpp +++ b/src/linkahead/transaction.cpp @@ -18,8 +18,8 @@ * */ #include "linkahead/transaction.h" -#include "caosdb/entity/v1/main.pb.h" // for EntityTransac... -#include "caosdb/entity/v1/main.pb.h" // for TransactionRe... +#include "caosdb/entity/v1/main.pb.h" // for EntityTransac... +#include "caosdb/entity/v1/main.pb.h" // for TransactionRe... #include "linkahead/file_transmission/download_request_handler.h" // Download... #include "linkahead/file_transmission/file_reader.h" // for path #include "linkahead/file_transmission/register_file_upload_handler.h" // for RegisterFileUploadHandler @@ -30,23 +30,23 @@ #include "linkahead/result_table.h" // for ResultTable #include "linkahead/result_table_impl.h" // for ResultTableImpl #include "linkahead/status_code.h" // for StatusCode -#include "linkahead/transaction_handler.h" // for EntityTransactionHandler -#include <algorithm> // for max -#include <exception> // IWYU pragma: keep -#include <filesystem> // for operator<<, path -#include <future> // for async, future -#include <google/protobuf/arena.h> // for Arena -#include <grpc/grpc.h> // for gpr_timespec -#include <map> // for map, operator!= -#include <memory> // for unique_ptr -#include <random> // for mt19937, rand... -#include <string> // for string -#include <system_error> // for std::system_error -#include <utility> // for move, pair +#include "linkahead/transaction_handler.h" // for EntityTransactionHandler +#include <algorithm> // for max +#include <exception> // IWYU pragma: keep +#include <filesystem> // for operator<<, path +#include <future> // for async, future +#include <google/protobuf/arena.h> // for Arena +#include <grpc/grpc.h> // for gpr_timespec +#include <map> // for map, operator!= +#include <memory> // for unique_ptr +#include <random> // for mt19937, rand... +#include <string> // for string +#include <system_error> // for std::system_error +#include <utility> // for move, pair // IWYU pragma: no_include <cxxabi.h> // IWYU pragma: no_include "net/proto2/public/repeated_field.h" -namespace caosdb::transaction { +namespace linkahead::transaction { using caosdb::entity::v1::EntityTransactionService; using caosdb::entity::v1::FileTransmissionService; using caosdb::entity::v1::MultiTransactionRequest; @@ -79,8 +79,9 @@ auto Transaction::RetrieveById(const std::string &id) noexcept -> StatusCode { return this->status.GetCode(); } -auto Transaction::RetrieveAndDownloadFileById( - const std::string &id, const std::string &local_path) noexcept -> StatusCode { +auto Transaction::RetrieveAndDownloadFileById(const std::string &id, + const std::string &local_path) noexcept + -> StatusCode { ASSERT_CAN_ADD_RETRIEVAL auto *retrieve_request = this->request->add_requests()->mutable_retrieve_request(); @@ -168,7 +169,7 @@ auto Transaction::UpdateEntity(Entity *entity) noexcept -> StatusCode { auto Transaction::Execute() -> TransactionStatus { auto status_code = ExecuteAsynchronously(); TransactionStatus::ThrowExceptionIfError(status_code, - caosdb::get_status_description(status_code)); + linkahead::get_status_description(status_code)); auto status = WaitForIt(); status.ThrowExceptionIfError(); return status; @@ -297,9 +298,10 @@ auto ProcessSelectResponse(ProtoSelectQueryResult *select_result) -> std::unique return ResultTableImpl::create(select_result); } -auto Transaction::ProcessRetrieveResponse( - RetrieveResponse *retrieve_response, std::vector<std::unique_ptr<Entity>> *entities, - bool *set_error) const noexcept -> std::unique_ptr<Entity> { +auto Transaction::ProcessRetrieveResponse(RetrieveResponse *retrieve_response, + std::vector<std::unique_ptr<Entity>> *entities, + bool *set_error) const noexcept + -> std::unique_ptr<Entity> { std::unique_ptr<Entity> result; switch (retrieve_response->retrieve_response_case()) { case RetrieveResponseCase::kEntityResponse: { @@ -491,4 +493,4 @@ void Transaction::Cancel() { } } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/transaction_handler.cpp b/src/linkahead/transaction_handler.cpp index d5c168e2d96cee43f4e90cd8bf26716f9941604a..c672587fdadbf906b54aefeea3b45865dfe53909 100644 --- a/src/linkahead/transaction_handler.cpp +++ b/src/linkahead/transaction_handler.cpp @@ -1,9 +1,9 @@ #include "linkahead/transaction_handler.h" #include "linkahead/logging.h" // for CAOSDB_LOG_TRACE -#include <exception> // IWYU pragma: keep +#include <exception> // IWYU pragma: keep // IWYU pragma: no_include <bits/exception.h> -namespace caosdb::transaction { +namespace linkahead::transaction { EntityTransactionHandler::EntityTransactionHandler(HandlerTag tag, EntityTransactionService::Stub *stub, @@ -23,4 +23,4 @@ void EntityTransactionHandler::handleNewCallState() { rpc_->Finish(response_, &status_, tag_); } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/unary_rpc_handler.cpp b/src/linkahead/unary_rpc_handler.cpp index 8ea6a4c16e9f8118fe4351ad75cfffe7da8a321e..9f6c6313152743b238b9ad3515917030c112c13e 100644 --- a/src/linkahead/unary_rpc_handler.cpp +++ b/src/linkahead/unary_rpc_handler.cpp @@ -49,11 +49,11 @@ #include "linkahead/unary_rpc_handler.h" #include "linkahead/logging.h" // for CAOSDB_LOG_TRACE #include "linkahead/status_code.h" // for GENERIC_RPC_E... -#include <exception> // IWYU pragma: keep -#include <string> // for string, opera... +#include <exception> // IWYU pragma: keep +#include <string> // for string, opera... // IWYU pragma: no_include <bits/exception.h> -namespace caosdb::transaction { +namespace linkahead::transaction { bool UnaryRpcHandler::OnNext(bool ok) { CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "UnaryRpcHandler::OnNext(bool)") @@ -121,4 +121,4 @@ void UnaryRpcHandler::handleCallCompleteState() { } } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/src/linkahead/utility.cpp b/src/linkahead/utility.cpp index d9ea1989c2eb2ad9f42f8ab39ccc1f667822cc5d..4fabfbcfd39e6aa83fd0f33f64b4bcc525c7a4c7 100644 --- a/src/linkahead/utility.cpp +++ b/src/linkahead/utility.cpp @@ -19,8 +19,8 @@ * */ #include "linkahead/utility.h" -#include "linkahead/data_type.h" // for AtomicDataType, atomicdatatype_names -#include "linkahead/entity.h" // for Importance, Role, importance_names +#include "linkahead/data_type.h" // for AtomicDataType, atomicdatatype_names +#include "linkahead/entity.h" // for Importance, Role, importance_names #include <boost/beast/core/detail/base64.hpp> // for encoded_size #include <boost/beast/core/detail/base64.ipp> // for encode #include <boost/filesystem/string_file.hpp> // for load_string_file @@ -34,13 +34,13 @@ #include <typeinfo> // for type_info #include <utility> // for pair -namespace caosdb::utility { +namespace linkahead::utility { using boost::json::stream_parser; using boost::json::value; -using caosdb::entity::AtomicDataType; -using caosdb::entity::Importance; -using caosdb::entity::Role; +using linkahead::entity::AtomicDataType; +using linkahead::entity::Importance; +using linkahead::entity::Role; template <typename Enum> auto getEnumNameFromValue(Enum v) -> std::string { if (std::is_same_v<std::underlying_type_t<Enum>, int>) { @@ -51,32 +51,32 @@ template <typename Enum> auto getEnumNameFromValue(Enum v) -> std::string { // Enum helper template specializations ////////////////////////////////////// template <> auto getEnumNameFromValue<Importance>(Importance v) -> std::string { - auto result = caosdb::entity::importance_names.at(v); + auto result = linkahead::entity::importance_names.at(v); return result; } template <> auto getEnumNameFromValue<Role>(Role v) -> std::string { - auto result = caosdb::entity::role_names.at(v); + auto result = linkahead::entity::role_names.at(v); return result; } template <> auto getEnumNameFromValue<AtomicDataType>(AtomicDataType v) -> std::string { - auto result = caosdb::entity::atomicdatatype_names.at(v); + auto result = linkahead::entity::atomicdatatype_names.at(v); return result; } template <> auto getEnumValueFromName<Importance>(const std::string &name) -> Importance { // TODO (dh): Why does this compile? - // if (caosdb::entity::importance_names.begin()->second == name) {} - // std::for_each(caosdb::entity::importance_names.begin(), - // caosdb::entity::importance_names.end(), + // if (linkahead::entity::importance_names.begin()->second == name) {} + // std::for_each(linkahead::entity::importance_names.begin(), + // linkahead::entity::importance_names.end(), // [](const auto &entry){}); // TODO (dh): Whereas this does not? - // auto result = std::find(caosdb::entity::importance_names.cbegin(), - // caosdb::entity::importance_names.cend(), + // auto result = std::find(linkahead::entity::importance_names.cbegin(), + // linkahead::entity::importance_names.cend(), // [name](const auto& entry){ return entry.second == name; }); // Workaround: plaint old iteration: - for (auto const &entry : caosdb::entity::importance_names) { + for (auto const &entry : linkahead::entity::importance_names) { if (entry.second == name) { return entry.first; } @@ -85,7 +85,7 @@ template <> auto getEnumValueFromName<Importance>(const std::string &name) -> Im } template <> auto getEnumValueFromName<AtomicDataType>(const std::string &name) -> AtomicDataType { - for (auto const &entry : caosdb::entity::atomicdatatype_names) { + for (auto const &entry : linkahead::entity::atomicdatatype_names) { if (entry.second == name) { return entry.first; } @@ -94,7 +94,7 @@ template <> auto getEnumValueFromName<AtomicDataType>(const std::string &name) - } template <> auto getEnumValueFromName<Role>(const std::string &name) -> Role { - for (auto const &entry : caosdb::entity::role_names) { + for (auto const &entry : linkahead::entity::role_names) { if (entry.second == name) { return entry.first; } @@ -182,4 +182,4 @@ auto JsonValue::operator=(JsonValue &&other) noexcept -> JsonValue & { return *this; } -} // namespace caosdb::utility +} // namespace linkahead::utility diff --git a/test/test_ccaosdb.cpp b/test/test_ccaosdb.cpp index eb81fe004202903eb74e83e3ccf2debd738d6a07..1eb844c43e910eb5ef16e1a45b384bfda3dfce0e 100644 --- a/test/test_ccaosdb.cpp +++ b/test/test_ccaosdb.cpp @@ -21,11 +21,11 @@ */ #include "linkahead/configuration.h" -#include "linkahead/status_code.h" // for StatusCode -#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_DATA_DIR -#include "clinkahead.h" // for caosdb_utility_get_env_fallback -#include <cstdint> // for int64_t -#include <cstring> // for strcmp +#include "linkahead/status_code.h" // for StatusCode +#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_DATA_DIR +#include "clinkahead.h" // for caosdb_utility_get_env_fallback +#include <cstdint> // for int64_t +#include <cstring> // for strcmp #include <gtest/gtest.h> #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl @@ -35,12 +35,12 @@ class test_ccaosdb : public ::testing::Test { protected: void SetUp() override { - caosdb::configuration::ConfigurationManager::Clear(); - caosdb::configuration::ConfigurationManager::LoadSingleJSONConfiguration( + linkahead::configuration::ConfigurationManager::Clear(); + linkahead::configuration::ConfigurationManager::LoadSingleJSONConfiguration( TEST_DATA_DIR + "/test_caosdb_client.json"); } - void TearDown() override { caosdb::configuration::ConfigurationManager::Clear(); } + void TearDown() override { linkahead::configuration::ConfigurationManager::Clear(); } }; TEST_F(test_ccaosdb, test_get_env_fallback) { @@ -49,7 +49,7 @@ TEST_F(test_ccaosdb, test_get_env_fallback) { } TEST_F(test_ccaosdb, test_other_client_error) { - EXPECT_EQ(caosdb_status_code_OTHER_CLIENT_ERROR(), caosdb::StatusCode::OTHER_CLIENT_ERROR); + EXPECT_EQ(caosdb_status_code_OTHER_CLIENT_ERROR(), linkahead::StatusCode::OTHER_CLIENT_ERROR); } TEST_F(test_ccaosdb, test_get_default_connection) { @@ -76,10 +76,10 @@ TEST_F(test_ccaosdb, test_execute_transaction) { EXPECT_TRUE(transaction.wrapped_transaction); int return_code(caosdb_transaction_transaction_retrieve_by_id(&transaction, "some_id")); - EXPECT_EQ(return_code, caosdb::StatusCode::GO_ON); + EXPECT_EQ(return_code, linkahead::StatusCode::GO_ON); return_code = caosdb_transaction_transaction_execute(&transaction); - EXPECT_EQ(return_code, caosdb::StatusCode::CONNECTION_ERROR); + EXPECT_EQ(return_code, linkahead::StatusCode::CONNECTION_ERROR); return_code = caosdb_transaction_delete_transaction(&transaction); EXPECT_EQ(return_code, 0); @@ -91,7 +91,7 @@ TEST_F(test_ccaosdb, test_execute_transaction) { // linting const char *ids[] = {"id1", "id2", "id3"}; // NOLINT return_code = caosdb_transaction_transaction_retrieve_by_ids(&multi_transaction, ids, 3); - EXPECT_EQ(return_code, caosdb::StatusCode::GO_ON); + EXPECT_EQ(return_code, linkahead::StatusCode::GO_ON); return_code = caosdb_transaction_delete_transaction(&multi_transaction); EXPECT_EQ(return_code, 0); @@ -108,7 +108,7 @@ TEST_F(test_ccaosdb, test_multi_retrieve) { // linting const char *ids[] = {"id1", "id2", "id3"}; // NOLINT int return_code(caosdb_transaction_transaction_retrieve_by_ids(&multi_transaction, ids, 3)); - EXPECT_EQ(return_code, caosdb::StatusCode::GO_ON); + EXPECT_EQ(return_code, linkahead::StatusCode::GO_ON); return_code = caosdb_transaction_delete_transaction(&multi_transaction); EXPECT_EQ(return_code, 0); @@ -122,7 +122,7 @@ TEST_F(test_ccaosdb, test_query) { caosdb_connection_connection_create_transaction(&connection, &transaction); int return_code(caosdb_transaction_transaction_query(&transaction, "FIND ENTITY WITH id=123")); - EXPECT_EQ(return_code, caosdb::StatusCode::GO_ON); + EXPECT_EQ(return_code, linkahead::StatusCode::GO_ON); return_code = caosdb_transaction_delete_transaction(&transaction); EXPECT_EQ(return_code, 0); @@ -133,7 +133,7 @@ TEST_F(test_ccaosdb, test_datatype) { caosdb_entity_datatype atomic; // check that this fails int return_code(caosdb_entity_create_atomic_datatype(&atomic, "some type")); - EXPECT_EQ(return_code, caosdb::StatusCode::ENUM_MAPPING_ERROR); + EXPECT_EQ(return_code, linkahead::StatusCode::ENUM_MAPPING_ERROR); return_code = caosdb_entity_create_atomic_datatype(&atomic, "INTEGER"); EXPECT_EQ(return_code, 0); @@ -388,7 +388,7 @@ TEST_F(test_ccaosdb, test_entity) { // cannot be created again without deletion // return_code = caosdb_entity_create_entity(&entity); - // EXPECT_EQ(return_code, caosdb::StatusCode::EXTERN_C_ASSIGNMENT_ERROR); + // EXPECT_EQ(return_code, linkahead::StatusCode::EXTERN_C_ASSIGNMENT_ERROR); // deletion and re-creation is ok return_code = caosdb_entity_delete_entity(&entity); @@ -417,7 +417,7 @@ TEST_F(test_ccaosdb, test_entity) { // invalid role return_code = caosdb_entity_entity_set_role(&entity, "Role does not exist"); - EXPECT_EQ(return_code, caosdb::StatusCode::ENUM_MAPPING_ERROR); + EXPECT_EQ(return_code, linkahead::StatusCode::ENUM_MAPPING_ERROR); caosdb_entity_entity_set_role(&entity, "PROPERTY"); caosdb_entity_entity_get_role(&entity, &out); @@ -433,7 +433,7 @@ TEST_F(test_ccaosdb, test_entity) { // verify that this doesn't work ... // return_code = caosdb_entity_entity_get_datatype(&entity, &in_type); - // EXPECT_EQ(return_code, caosdb::StatusCode::EXTERN_C_ASSIGNMENT_ERROR); + // EXPECT_EQ(return_code, linkahead::StatusCode::EXTERN_C_ASSIGNMENT_ERROR); caosdb_entity_datatype out_type; // ... but does with a clean property return_code = caosdb_entity_entity_get_datatype(&entity, &out_type); @@ -829,7 +829,7 @@ TEST_F(test_ccaosdb, test_entity_with_parent_and_property) { // cannot assign an already assigned property // return_code = caosdb_entity_entity_get_property(&entity, &input_property, 0); - // EXPECT_EQ(return_code, caosdb::StatusCode::EXTERN_C_ASSIGNMENT_ERROR); + // EXPECT_EQ(return_code, linkahead::StatusCode::EXTERN_C_ASSIGNMENT_ERROR); caosdb_entity_property output_property; return_code = caosdb_entity_entity_get_property(&entity, &output_property, 0); EXPECT_EQ(return_code, 0); @@ -988,21 +988,21 @@ TEST_F(test_ccaosdb, test_insert_update_delete) { caosdb_entity_entity_set_file_path(&entity, "some_name"); auto return_code = caosdb_transaction_transaction_insert_entity(&insert_transaction, &entity); - EXPECT_EQ(return_code, caosdb::StatusCode::GO_ON); + EXPECT_EQ(return_code, linkahead::StatusCode::GO_ON); caosdb_transaction_transaction update_transaction; caosdb_connection_connection_create_transaction(&connection, &update_transaction); return_code = caosdb_transaction_transaction_update_entity(&update_transaction, &entity); // No ID, so this should be an error - EXPECT_EQ(return_code, caosdb::StatusCode::ORIGINAL_ENTITY_MISSING_ID); + EXPECT_EQ(return_code, linkahead::StatusCode::ORIGINAL_ENTITY_MISSING_ID); caosdb_transaction_transaction delete_transaction; caosdb_connection_connection_create_transaction(&connection, &delete_transaction); return_code = caosdb_transaction_transaction_delete_by_id(&delete_transaction, "some_id"); // Could add further deletions - EXPECT_EQ(return_code, caosdb::StatusCode::GO_ON); + EXPECT_EQ(return_code, linkahead::StatusCode::GO_ON); caosdb_entity_delete_entity(&entity); caosdb_transaction_delete_transaction(&insert_transaction); diff --git a/test/test_configuration.cpp b/test/test_configuration.cpp index 6a9ae245e2ebd300fac56eea4954e4c7c93da0c9..0e23725da37c2d874c6fa56d905cc96226bf493c 100644 --- a/test/test_configuration.cpp +++ b/test/test_configuration.cpp @@ -23,7 +23,7 @@ #include "linkahead/exceptions.h" // for ConfigurationError #include "linkahead/log_level.h" // for CAOSDB_DEFAULT_LOG_LEVEL, CAOSDB_... #include "linkahead/logging.h" // for ConsoleSinkConfiguration, Logging... -#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_DATA_DIR +#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_DATA_DIR #include <gtest/gtest.h> #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver @@ -31,7 +31,7 @@ #include <memory> // for make_shared #include <string> // for operator+, allocator, string -namespace caosdb::configuration { +namespace linkahead::configuration { class test_configuration : public ::testing::Test { protected: @@ -74,12 +74,12 @@ TEST_F(test_configuration, get_default_connection_configuration_error) { } TEST_F(test_configuration, initialize_logging) { - auto logging_configuration = caosdb::logging::LoggingConfiguration(CAOSDB_LOG_LEVEL_ALL); - auto console_sink = std::make_shared<caosdb::logging::ConsoleSinkConfiguration>( + auto logging_configuration = linkahead::logging::LoggingConfiguration(CAOSDB_LOG_LEVEL_ALL); + auto console_sink = std::make_shared<linkahead::logging::ConsoleSinkConfiguration>( "console", CAOSDB_DEFAULT_LOG_LEVEL); logging_configuration.AddSink(console_sink); initialize_logging(logging_configuration); } -} // namespace caosdb::configuration +} // namespace linkahead::configuration diff --git a/test/test_connection.cpp b/test/test_connection.cpp index e15f7d9e311a3327ca3c03705b292402e3c4a625..ef9934c1e02d49c466f86859c9e9a3bf8e518196 100644 --- a/test/test_connection.cpp +++ b/test/test_connection.cpp @@ -26,7 +26,7 @@ #include "linkahead/configuration.h" // for InsecureConnectionConfigura... #include "linkahead/connection.h" // for ConnectionManager #include "linkahead/exceptions.h" // for ConnectionConfigurationError -#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_... +#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_... #include <gtest/gtest.h> #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartR... @@ -34,14 +34,14 @@ #include <memory> // for allocator, operator!=, shar... #include <string> // for operator+, string -namespace caosdb::connection { +namespace linkahead::connection { #ifdef BUILD_ACM -using caosdb::acm::User; +using linkahead::acm::User; #endif -using caosdb::configuration::ConfigurationManager; -using caosdb::configuration::InsecureConnectionConfiguration; -using caosdb::configuration::PemCertificateProvider; -using caosdb::configuration::TlsConnectionConfiguration; +using linkahead::configuration::ConfigurationManager; +using linkahead::configuration::InsecureConnectionConfiguration; +using linkahead::configuration::PemCertificateProvider; +using linkahead::configuration::TlsConnectionConfiguration; class test_connection : public ::testing::Test { protected: @@ -73,13 +73,13 @@ TEST_F(test_connection, configure_ssl_localhost_8080) { TEST_F(test_connection, connection_manager_unknown_connection) { EXPECT_THROW_MESSAGE( - ConnectionManager::GetConnection("test"), caosdb::exceptions::ConnectionConfigurationError, + ConnectionManager::GetConnection("test"), linkahead::exceptions::ConnectionConfigurationError, "Error with the connection named 'test': The connection 'test' has not been defined."); } TEST_F(test_connection, connection_missing_certificate) { EXPECT_THROW_MESSAGE(ConnectionManager::GetConnection("missing"), - caosdb::exceptions::ConnectionConfigurationError, + linkahead::exceptions::ConnectionConfigurationError, std::string("Error with the connection named 'missing': ") + "File does not exist (server_certificate_path): /missing"); } @@ -98,7 +98,7 @@ TEST_F(test_connection, connection_manager_get_connection) { TEST_F(test_connection, test_create_single_user) { auto connection = ConnectionManager::GetDefaultConnection(); User user; - EXPECT_THROW_MESSAGE(connection->CreateSingleUser(user), caosdb::exceptions::ConnectionError, + EXPECT_THROW_MESSAGE(connection->CreateSingleUser(user), linkahead::exceptions::ConnectionError, "The attempt to execute this transaction was not successful because the " "connection to the server could not be established."); } @@ -106,7 +106,7 @@ TEST_F(test_connection, test_create_single_user) { TEST_F(test_connection, test_delete_single_user) { auto connection = ConnectionManager::GetDefaultConnection(); EXPECT_THROW_MESSAGE(connection->DeleteSingleUser("realm", "user"), - caosdb::exceptions::ConnectionError, + linkahead::exceptions::ConnectionError, "The attempt to execute this transaction was not successful because the " "connection to the server could not be established."); } @@ -114,10 +114,10 @@ TEST_F(test_connection, test_delete_single_user) { TEST_F(test_connection, test_retrieve_single_user) { auto connection = ConnectionManager::GetDefaultConnection(); EXPECT_THROW_MESSAGE(auto results = connection->RetrieveSingleUser("realm", "user"), - caosdb::exceptions::ConnectionError, + linkahead::exceptions::ConnectionError, "The attempt to execute this transaction was not successful because the " "connection to the server could not be established."); } #endif -} // namespace caosdb::connection +} // namespace linkahead::connection diff --git a/test/test_data_type.cpp b/test/test_data_type.cpp index 500b7e76792a23f3ce759bf435efd065101c1f29..aab03adeaafb101b748e20354c124c20ff7032e4 100644 --- a/test/test_data_type.cpp +++ b/test/test_data_type.cpp @@ -33,7 +33,7 @@ #include <string> // for allocator #include <utility> // for pair -namespace caosdb::entity { +namespace linkahead::entity { using ProtoEntity = caosdb::entity::v1::Entity; using ProtoParent = caosdb::entity::v1::Parent; using ProtoDataType = caosdb::entity::v1::DataType; @@ -60,7 +60,7 @@ TEST(test_data_type, test_atomic) { EXPECT_TRUE(data_type.IsAtomic()); EXPECT_EQ(data_type.GetAsAtomic(), map_el.first); } - caosdb::utility::reset_arena(); + linkahead::utility::reset_arena(); } TEST(test_data_type, test_reference) { @@ -109,7 +109,7 @@ TEST(test_data_type, test_list_of_reference) { EXPECT_FALSE(list_data_type.IsListOfAtomic()); const auto *wrapped = list_data_type.GetReferenceDataType().GetWrapped(); CAOSDB_DEBUG_MESSAGE_STRING(*wrapped, out) - CAOSDB_LOG_DEBUG("caosdb::entity") << "wrapped " + out; + CAOSDB_LOG_DEBUG("linkahead::entity") << "wrapped " + out; EXPECT_EQ(list_data_type.GetReferenceDataType().GetName(), "person"); } @@ -175,4 +175,4 @@ TEST(test_data_type, data_type_move_assignment) { EXPECT_EQ(move_data_type.ToString(), dt_string); } -} // namespace caosdb::entity +} // namespace linkahead::entity diff --git a/test/test_entity.cpp b/test/test_entity.cpp index 920f4dbeb844a54f1d1c8de6e210861391cb1db3..de9154c2c3732b0b8c34fc6d52a08cbc6cd6de33 100644 --- a/test/test_entity.cpp +++ b/test/test_entity.cpp @@ -29,7 +29,7 @@ #include "linkahead/status_code.h" // for StatusCode, FILE_DO... #include "linkahead/transaction.h" // for Transaction #include "linkahead/value.h" // for Value -#include "linkahead_test_utility.h" // for TEST_DATA_DIR +#include "linkahead_test_utility.h" // for TEST_DATA_DIR #include <google/protobuf/arena.h> // for Arena #include <gtest/gtest.h> #include <gtest/gtest-message.h> // for Message @@ -42,14 +42,14 @@ #include <utility> // for move // IWYU pragma: no_include "net/proto2/public/repeated_field.h" -namespace caosdb::entity { +namespace linkahead::entity { using caosdb::entity::v1::IdResponse; using ProtoEntity = caosdb::entity::v1::Entity; using ProtoParent = caosdb::entity::v1::Parent; using ProtoProperty = caosdb::entity::v1::Property; using ProtoAtomicDataType = caosdb::entity::v1::AtomicDataType; using caosdb::entity::v1::EntityResponse; -using caosdb::utility::get_arena; +using linkahead::utility::get_arena; using ProtoEntityRole = caosdb::entity::v1::EntityRole; TEST(test_entity, test_parent_setters) { @@ -498,7 +498,7 @@ TEST(test_entity, test_copy_to) { } TEST(test_entity, test_insert_entity) { - auto transaction = caosdb::transaction::Transaction( + auto transaction = linkahead::transaction::Transaction( std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr), std::shared_ptr<transaction::FileTransmissionService::Stub>(nullptr)); @@ -516,7 +516,7 @@ TEST(test_entity, test_insert_entity) { } TEST(test_entity, test_insert_with_role) { - auto transaction = caosdb::transaction::Transaction( + auto transaction = linkahead::transaction::Transaction( std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr), std::shared_ptr<transaction::FileTransmissionService::Stub>(nullptr)); @@ -539,7 +539,7 @@ TEST(test_entity, test_insert_with_role) { } TEST(test_entity, test_insert_with_parent) { - auto transaction = caosdb::transaction::Transaction( + auto transaction = linkahead::transaction::Transaction( std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr), std::shared_ptr<transaction::FileTransmissionService::Stub>(nullptr)); @@ -564,7 +564,7 @@ TEST(test_entity, test_insert_with_parent) { } TEST(test_entity, test_insert_with_property) { - auto transaction = caosdb::transaction::Transaction( + auto transaction = linkahead::transaction::Transaction( std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr), std::shared_ptr<transaction::FileTransmissionService::Stub>(nullptr)); @@ -937,4 +937,4 @@ TEST(test_entity, test_message_to_string) { "{\n \"code\": 2,\n \"description\": \"error_desc\"\n}\n"); } -} // namespace caosdb::entity +} // namespace linkahead::entity diff --git a/test/test_file_transmission.cpp b/test/test_file_transmission.cpp index c8cf5af3479ce6733ed0688f93db05f126da5bb3..b91918c094644f2432bb12ae6dd058b03b093101 100644 --- a/test/test_file_transmission.cpp +++ b/test/test_file_transmission.cpp @@ -29,7 +29,7 @@ namespace fs = std::filesystem; -namespace caosdb::transaction { +namespace linkahead::transaction { class test_file_transmission : public ::testing::Test { protected: @@ -58,4 +58,4 @@ TEST_F(test_file_transmission, test_file_writer_reader) { } } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/test/test_info.cpp b/test/test_info.cpp index d43a2610264af36b1fab53b5a13fb7300eab3d5e..20be8fb5ff43d7b5481ab4e01d95728ed80ab606 100644 --- a/test/test_info.cpp +++ b/test/test_info.cpp @@ -28,7 +28,7 @@ #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include <memory> // for allocator -namespace caosdb::info { +namespace linkahead::info { using ProtoVersionInfo = caosdb::info::v1::VersionInfo; TEST(test_info, create_info_from_proto_info) { @@ -47,4 +47,4 @@ TEST(test_info, create_info_from_proto_info) { EXPECT_EQ("1234asdf", wrapper.GetBuild()); } -} // namespace caosdb::info +} // namespace linkahead::info diff --git a/test/test_issues.cpp b/test/test_issues.cpp index 6ced23d7e62e28c0c224c043cc3afcf529428edb..41a004689a33b338dd50468cd94f5be6e6178f98 100644 --- a/test/test_issues.cpp +++ b/test/test_issues.cpp @@ -29,9 +29,9 @@ #include <gtest/gtest_pred_impl.h> // for Test, TestInfo, TEST #include <memory> // for allocator, unique_ptr -namespace caosdb::transaction { -using caosdb::configuration::InsecureConnectionConfiguration; -using caosdb::connection::Connection; +namespace linkahead::transaction { +using linkahead::configuration::InsecureConnectionConfiguration; +using linkahead::connection::Connection; TEST(test_issues, test_issue_11) { const auto *host = "localhost"; @@ -48,4 +48,4 @@ TEST(test_issues, test_issue_11) { EXPECT_EQ(transaction->GetResultSet().size(), 0); } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/test/test_list_properties.cpp b/test/test_list_properties.cpp index 5e6284ba8b7dac7c5e34968d1df96dc21cbed136..63d4aa65d3d4296484248133bd6a1ff5357153ca 100644 --- a/test/test_list_properties.cpp +++ b/test/test_list_properties.cpp @@ -33,7 +33,7 @@ #include <string> // for string #include <vector> // for vector -namespace caosdb::entity { +namespace linkahead::entity { using ProtoEntity = caosdb::entity::v1::Entity; using ProtoParent = caosdb::entity::v1::Parent; using ProtoDataType = caosdb::entity::v1::DataType; @@ -98,4 +98,4 @@ TEST(test_list_property, test_list_reassignment) { } } -} // namespace caosdb::entity +} // namespace linkahead::entity diff --git a/test/test_protobuf.cpp b/test/test_protobuf.cpp index 6a9949f467a02604dffe426fb585115130b5a5f2..ed9fbf13878897aa21a1a747b2f018ab3ec72ff1 100644 --- a/test/test_protobuf.cpp +++ b/test/test_protobuf.cpp @@ -31,7 +31,7 @@ namespace caosdb { using ProtoEntity = caosdb::entity::v1::Entity; -using caosdb::entity::Entity; +using linkahead::entity::Entity; using caosdb::entity::v1::Message; using google::protobuf::Arena; diff --git a/test/test_transaction.cpp b/test/test_transaction.cpp index 3641332ea36b1312750a216dddf299defeb51c1d..666775eeda8dfc742bb62ba3b239e4811bafdd9a 100644 --- a/test/test_transaction.cpp +++ b/test/test_transaction.cpp @@ -27,7 +27,7 @@ #include "linkahead/transaction.h" // for Transaction #include "linkahead/transaction_handler.h" // for MultiTransactionResponse #include "linkahead/transaction_status.h" // for ConnectionError -#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE +#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE #include <algorithm> // for max #include <google/protobuf/arena.h> // for Arena #include <gtest/gtest.h> @@ -41,13 +41,13 @@ #include <vector> // for vector // IWYU pragma: no_include "net/proto2/public/repeated_field.h" -namespace caosdb::transaction { -using caosdb::configuration::InsecureConnectionConfiguration; -using caosdb::connection::Connection; -using caosdb::entity::Entity; -using caosdb::exceptions::ConnectionError; +namespace linkahead::transaction { +using linkahead::configuration::InsecureConnectionConfiguration; +using linkahead::connection::Connection; +using linkahead::entity::Entity; +using linkahead::exceptions::ConnectionError; using ProtoEntity = caosdb::entity::v1::Entity; -using caosdb::entity::Role; +using linkahead::entity::Role; using caosdb::entity::v1::RetrieveResponse; TEST(test_transaction, create_transaction) { @@ -289,4 +289,4 @@ TEST(test_transaction, test_multiple_wait_for_it) { EXPECT_EQ(transaction->WaitForIt().GetCode(), StatusCode::CONNECTION_ERROR); } -} // namespace caosdb::transaction +} // namespace linkahead::transaction diff --git a/test/test_user.cpp b/test/test_user.cpp index f29e988981512d1455ca168d1d3641976a04c3dc..a2dab195fc67f29472bf371fbd066767e22e6c2e 100644 --- a/test/test_user.cpp +++ b/test/test_user.cpp @@ -28,7 +28,7 @@ #include <string> // for allocator, string #include <utility> // for move -namespace caosdb::acm { +namespace linkahead::acm { TEST(test_user, user_name) { auto user = User("user1"); @@ -118,4 +118,4 @@ TEST(test_user, test_move_assign) { EXPECT_EQ(user1.GetPassword(), ""); } -} // namespace caosdb::acm +} // namespace linkahead::acm diff --git a/test/test_utility.cpp b/test/test_utility.cpp index 8455f56b21ef7f5bcad7da1d58c89f3a5d2ff9bb..8abe42e6bc77221863d20386a8e5f3b1c7c1312c 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -25,7 +25,7 @@ #include "linkahead/entity.h" // for importance_names, role... #include "linkahead/status_code.h" // for get_status_description #include "linkahead/utility.h" // for base64_encode, load_js... -#include "linkahead_test_utility.h" // for TEST_DATA_DIR +#include "linkahead_test_utility.h" // for TEST_DATA_DIR #include <gtest/gtest.h> #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for TestPartResult, SuiteA... @@ -35,7 +35,7 @@ #include <string> // for allocator, string, ope... #include <utility> // for pair -namespace caosdb::utility { +namespace linkahead::utility { TEST(test_utility, base64_encode) { auto test_plain = std::string("admin:caosdb"); @@ -47,28 +47,28 @@ TEST(test_utility, base64_encode) { TEST(test_utility, enum_names) { // All working enums - for (const auto &entry : caosdb::entity::importance_names) { - EXPECT_EQ(getEnumNameFromValue<caosdb::entity::Importance>(entry.first), entry.second); - EXPECT_EQ(getEnumValueFromName<caosdb::entity::Importance>(entry.second), entry.first); + for (const auto &entry : linkahead::entity::importance_names) { + EXPECT_EQ(getEnumNameFromValue<linkahead::entity::Importance>(entry.first), entry.second); + EXPECT_EQ(getEnumValueFromName<linkahead::entity::Importance>(entry.second), entry.first); } - for (const auto &entry : caosdb::entity::role_names) { - EXPECT_EQ(getEnumNameFromValue<caosdb::entity::Role>(entry.first), entry.second); - EXPECT_EQ(getEnumValueFromName<caosdb::entity::Role>(entry.second), entry.first); + for (const auto &entry : linkahead::entity::role_names) { + EXPECT_EQ(getEnumNameFromValue<linkahead::entity::Role>(entry.first), entry.second); + EXPECT_EQ(getEnumValueFromName<linkahead::entity::Role>(entry.second), entry.first); } - for (const auto &entry : caosdb::entity::atomicdatatype_names) { - EXPECT_EQ(getEnumNameFromValue<caosdb::entity::AtomicDataType>(entry.first), entry.second); - EXPECT_EQ(getEnumValueFromName<caosdb::entity::AtomicDataType>(entry.second), entry.first); + for (const auto &entry : linkahead::entity::atomicdatatype_names) { + EXPECT_EQ(getEnumNameFromValue<linkahead::entity::AtomicDataType>(entry.first), entry.second); + EXPECT_EQ(getEnumValueFromName<linkahead::entity::AtomicDataType>(entry.second), entry.first); } // Some non-working examples - EXPECT_THROW_MESSAGE(getEnumValueFromName<caosdb::entity::Importance>("Invalid name"), + EXPECT_THROW_MESSAGE(getEnumValueFromName<linkahead::entity::Importance>("Invalid name"), std::out_of_range, "Could not find enum value for string 'Invalid name'."); } TEST(test_utility, test_status_code_description) { - EXPECT_EQ(caosdb::get_status_description(12412323), "MISSING DESCRIPTION"); - EXPECT_EQ(caosdb::get_status_description(static_cast<int>(StatusCode::UNKNOWN)), + EXPECT_EQ(linkahead::get_status_description(12412323), "MISSING DESCRIPTION"); + EXPECT_EQ(linkahead::get_status_description(static_cast<int>(StatusCode::UNKNOWN)), "Unknown error. This is typically a bug (server or client)."); } -} // namespace caosdb::utility +} // namespace linkahead::utility diff --git a/test/test_value.cpp b/test/test_value.cpp index 0dec246ad9a79b2d6f8323778f017b0b6a8112f3..f39181272adddcb28c009d055fa5943e465d656e 100644 --- a/test/test_value.cpp +++ b/test/test_value.cpp @@ -33,7 +33,7 @@ #include <string> // for string, basic_string #include <vector> // for vector -namespace caosdb::entity { +namespace linkahead::entity { using ProtoValue = caosdb::entity::v1::Value; using ProtoEntity = caosdb::entity::v1::Entity; using ProtoParent = caosdb::entity::v1::Parent; @@ -202,4 +202,4 @@ TEST(test_value, test_value_to_string) { "{\n \"booleanValue\": false\n }\n ]\n }\n}\n"); } -} // namespace caosdb::entity +} // namespace linkahead::entity