diff --git a/include/clinkahead.h b/include/clinkahead.h index a690de889e62c3f38c8753d5897e8e45edee1126..eddc2dfb7fabddf67af2fc20276d9b45c68155cb 100644 --- a/include/clinkahead.h +++ b/include/clinkahead.h @@ -20,8 +20,8 @@ * */ -#ifndef CCAOSDB_H -#define CCAOSDB_H +#ifndef CLINKAHEAD_H +#define CLINKAHEAD_H #ifdef __cplusplus #include <cstdint> // for int64_t extern "C" { @@ -31,17 +31,17 @@ extern "C" { #endif /** - * Return the constant linkahead::LIBCAOSDB_VERSION_MAJOR. + * Return the constant linkahead::LIBLINKAHEAD_VERSION_MAJOR. */ -int caosdb_constants_LIBCAOSDB_VERSION_MAJOR(); +int caosdb_constants_LIBLINKAHEAD_VERSION_MAJOR(); /** - * Return the constant linkahead::LIBCAOSDB_VERSION_MINOR + * Return the constant linkahead::LIBLINKAHEAD_VERSION_MINOR */ -int caosdb_constants_LIBCAOSDB_VERSION_MINOR(); +int caosdb_constants_LIBLINKAHEAD_VERSION_MINOR(); /** - * Return the constant linkahead::LIBCAOSDB_VERSION_PATCH. + * Return the constant linkahead::LIBLINKAHEAD_VERSION_PATCH. */ -int caosdb_constants_LIBCAOSDB_VERSION_PATCH(); +int caosdb_constants_LIBLINKAHEAD_VERSION_PATCH(); /** * Return the constant linkahead::COMPATIBLE_SERVER_VERSION_MAJOR. */ diff --git a/include/linkahead/acm/user.h b/include/linkahead/acm/user.h index 81db9c3361687af6c77f130060be4434ddf18401..073f95b25d0c0f297a6636ea83b7cf6f0da2c42b 100644 --- a/include/linkahead/acm/user.h +++ b/include/linkahead/acm/user.h @@ -28,8 +28,8 @@ * @date 2022-06-29 */ #ifdef BUILD_ACM -#ifndef CAOSDB_ACM_USER_H -#define CAOSDB_ACM_USER_H +#ifndef LINKAHEAD_ACM_USER_H +#define LINKAHEAD_ACM_USER_H #include <memory> // for unique_ptr #include <string> // for string diff --git a/include/linkahead/authentication.h b/include/linkahead/authentication.h index 8c2325cf64db634398a2fa67baba835e80906246..600a6c3f3c7fbf1b4da5ef99811f7796cd400990 100644 --- a/include/linkahead/authentication.h +++ b/include/linkahead/authentication.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_AUTHENTICATION_H -#define CAOSDB_AUTHENTICATION_H +#ifndef LINKAHEAD_AUTHENTICATION_H +#define LINKAHEAD_AUTHENTICATION_H /** * @file caosdb/authentication.h * @author Timm Fitschen diff --git a/include/linkahead/certificate_provider.h b/include/linkahead/certificate_provider.h index 19098989789cc653936217214d8287cb31112dee..468500aeb66eabdff9a8ce94a772197114b5dd0d 100644 --- a/include/linkahead/certificate_provider.h +++ b/include/linkahead/certificate_provider.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_CERTIFICATE_PROVIDER_H -#define CAOSDB_CERTIFICATE_PROVIDER_H +#ifndef LINKAHEAD_CERTIFICATE_PROVIDER_H +#define LINKAHEAD_CERTIFICATE_PROVIDER_H #include <filesystem> // for path namespace linkahead::configuration { diff --git a/include/linkahead/configuration.h b/include/linkahead/configuration.h index 9a204d3675165b09e542b7f25dc57cc177f16391..06754cf5f2006e03774486325b15e41c2131d114 100644 --- a/include/linkahead/configuration.h +++ b/include/linkahead/configuration.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_CONFIGURATION_H -#define CAOSDB_CONFIGURATION_H +#ifndef LINKAHEAD_CONFIGURATION_H +#define LINKAHEAD_CONFIGURATION_H #include "linkahead/authentication.h" // for Authenticator, PlainPassw... #include "linkahead/certificate_provider.h" // for CertificateProvider, path @@ -166,7 +166,7 @@ private: * Initialize this ConfigurationManager with the defaults. * * Currently, this means, that the ConfigurationManager attempts to load the - * first existing file from the LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE list + * first existing file from the LIBLINKAHEAD_CONFIGURATION_FILES_PRECEDENCE list * of file locations. */ auto InitializeDefaults() -> int; diff --git a/include/linkahead/connection.h b/include/linkahead/connection.h index 43e92469cd61aa9e4a6fcc49a6c52b509ea0ff4c..fd43d2ca988b65595df5bec8b9fc431b3f3fc940 100644 --- a/include/linkahead/connection.h +++ b/include/linkahead/connection.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_CONNECTION_H -#define CAOSDB_CONNECTION_H +#ifndef LINKAHEAD_CONNECTION_H +#define LINKAHEAD_CONNECTION_H /** * @file caosdb/connection.h * @author Timm Fitschen diff --git a/include/linkahead/constants.h.in b/include/linkahead/constants.h.in index f4454553fd5be00f01ecca60e81786d58b944fbc..e57c96d0312cecc92e4669c2ddc771a0410d8bc3 100644 --- a/include/linkahead/constants.h.in +++ b/include/linkahead/constants.h.in @@ -20,8 +20,8 @@ * */ -#ifndef CAOSDB_CONSTANTS_H -#define CAOSDB_CONSTANTS_H +#ifndef LINKAHEAD_CONSTANTS_H +#define LINKAHEAD_CONSTANTS_H #ifndef __GNUC__ #define __attribute__(x) #endif @@ -29,9 +29,9 @@ namespace linkahead { #endif // clang-format off -static const int LIBCAOSDB_VERSION_MAJOR = @liblinkahead_VERSION_MAJOR@; -static const int LIBCAOSDB_VERSION_MINOR = @liblinkahead_VERSION_MINOR@; -static const int LIBCAOSDB_VERSION_PATCH = @liblinkahead_VERSION_PATCH@; +static const int LIBLINKAHEAD_VERSION_MAJOR = @liblinkahead_VERSION_MAJOR@; +static const int LIBLINKAHEAD_VERSION_MINOR = @liblinkahead_VERSION_MINOR@; +static const int LIBLINKAHEAD_VERSION_PATCH = @liblinkahead_VERSION_PATCH@; static const int COMPATIBLE_SERVER_VERSION_MAJOR = @liblinkahead_COMPATIBLE_SERVER_VERSION_MAJOR@; static const int COMPATIBLE_SERVER_VERSION_MINOR = @liblinkahead_COMPATIBLE_SERVER_VERSION_MINOR@; static const int COMPATIBLE_SERVER_VERSION_PATCH = @liblinkahead_COMPATIBLE_SERVER_VERSION_PATCH@; @@ -40,8 +40,8 @@ __attribute__((unused)) static const char* COMPATIBLE_SERVER_VERSION_PRE_RELEASE /** * Precedence of configuration files from highest to lowest. */ -__attribute__((unused)) static const char* LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE[] = { - "$CAOSDB_CLIENT_CONFIGURATION", +__attribute__((unused)) static const char* LIBLINKAHEAD_CONFIGURATION_FILES_PRECEDENCE[] = { + "$LINKAHEAD_CLIENT_CONFIGURATION", "caosdb_client.json", "caosdb-client.json", ".caosdb_client.json", diff --git a/include/linkahead/data_type.h b/include/linkahead/data_type.h index 2a4fda6f1033148b60947aee7902dbd971843767..950c84c1cf413cb9a6538b8a57947a8d1a1ad184 100644 --- a/include/linkahead/data_type.h +++ b/include/linkahead/data_type.h @@ -26,8 +26,8 @@ * obtained with GetName(). */ -#ifndef CAOSDB_DATA_TYPE_H -#define CAOSDB_DATA_TYPE_H +#ifndef LINKAHEAD_DATA_TYPE_H +#define LINKAHEAD_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 diff --git a/include/linkahead/entity.h b/include/linkahead/entity.h index e63dd32b48f9051e81c57d199dea73214327ecc2..ca1802a253f463646bf633a848d53900e8926de3 100644 --- a/include/linkahead/entity.h +++ b/include/linkahead/entity.h @@ -26,13 +26,13 @@ * @author Timm Fitchen * @date 2021-07-07 */ -#ifndef CAOSDB_ENTITY_H -#define CAOSDB_ENTITY_H +#ifndef LINKAHEAD_ENTITY_H +#define LINKAHEAD_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/logging.h" // for LINKAHEAD_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 @@ -165,7 +165,7 @@ public: } std::string result("[\n"); for (int i = 0; i < this->size();) { - CAOSDB_DEBUG_MESSAGE_STRING(this->wrapped->at(i), next); + LINKAHEAD_DEBUG_MESSAGE_STRING(this->wrapped->at(i), next); result += next; if (++i < this->size()) { result.replace(result.size() - 1, 1, ",\n"); @@ -496,7 +496,7 @@ public: */ inline Property(const Property &other) : Property(ProtoMessageWrapper<ProtoProperty>::CopyProtoMessage(other.wrapped)) { - CAOSDB_LOG_TRACE(logger_name) << "Property::Property(const Property &) " + LINKAHEAD_LOG_TRACE(logger_name) << "Property::Property(const Property &) " << "- Copy constructor"; }; @@ -504,7 +504,7 @@ public: * Move constructor. */ inline Property(Property &&other) : Property(other.wrapped) { - CAOSDB_LOG_TRACE(logger_name) << "Property::Property(Property &&) " + LINKAHEAD_LOG_TRACE(logger_name) << "Property::Property(Property &&) " << "- Move constructor"; other.wrapped = nullptr; other.data_type.wrapped = nullptr; @@ -606,7 +606,7 @@ public: * Copy assignment operator. */ auto operator=(const Property &other) -> Property & { - CAOSDB_LOG_TRACE(logger_name) << "Property::operator=(const Property &) " + LINKAHEAD_LOG_TRACE(logger_name) << "Property::operator=(const Property &) " << "- Copy assignment operator"; this->wrapped->CopyFrom(*other.wrapped); @@ -622,7 +622,7 @@ public: * Move assignment operator. */ auto operator=(Property &&other) -> Property & { - CAOSDB_LOG_TRACE(logger_name) << "Property::operator=(Property &&) " + LINKAHEAD_LOG_TRACE(logger_name) << "Property::operator=(Property &&) " << "- Move assignment operator"; this->wrapped = other.wrapped; other.wrapped = nullptr; @@ -874,21 +874,21 @@ public: inline auto SetLocalPath(const std::filesystem::path &local_path) noexcept -> StatusCode { if (GetRole() != Role::FILE) { - CAOSDB_LOG_WARN(logger_name) << "Entity::SetLocalPath failed. This is not a file entity."; + LINKAHEAD_LOG_WARN(logger_name) << "Entity::SetLocalPath failed. This is not a file entity."; return StatusCode::NOT_A_FILE_ENTITY; } if (!exists(local_path)) { - CAOSDB_LOG_WARN(logger_name) + LINKAHEAD_LOG_WARN(logger_name) << "Entity::SetLocalPath failed. This file does not exists: " << local_path.string(); return StatusCode::FILE_DOES_NOT_EXIST_LOCALLY; } if (is_directory(local_path)) { - CAOSDB_LOG_WARN(logger_name) + LINKAHEAD_LOG_WARN(logger_name) << "Entity::SetLocalPath failed. This file is a directory: " << local_path.string(); return StatusCode::PATH_IS_A_DIRECTORY; } - CAOSDB_LOG_TRACE(logger_name) << "Entity::SetLocalPath(" << local_path.string() << ");"; + LINKAHEAD_LOG_TRACE(logger_name) << "Entity::SetLocalPath(" << local_path.string() << ");"; this->file_descriptor.local_path = local_path; return StatusCode::SUCCESS; } diff --git a/include/linkahead/exceptions.h b/include/linkahead/exceptions.h index a65d7ac67b63db7a8db4b7aa20bd25b6a8a0f0b3..68c1b350545176e260ba4bc557cf8e181ef921a2 100644 --- a/include/linkahead/exceptions.h +++ b/include/linkahead/exceptions.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_EXCEPTIONS_H -#define CAOSDB_EXCEPTIONS_H +#ifndef LINKAHEAD_EXCEPTIONS_H +#define LINKAHEAD_EXCEPTIONS_H #include "linkahead/status_code.h" #include <stdexcept> #include <string> diff --git a/include/linkahead/file_descriptor.h b/include/linkahead/file_descriptor.h index ead4885efc277a0856c86a1f0b661c2e996455d6..08d5a7c4ead0dd5d2a134915392aa7a79c061fbb 100644 --- a/include/linkahead/file_descriptor.h +++ b/include/linkahead/file_descriptor.h @@ -26,8 +26,8 @@ * @author Timm Fitchen * @date 2022-01-21 */ -#ifndef CAOSDB_FILE_DESCRIPTOR_H -#define CAOSDB_FILE_DESCRIPTOR_H +#ifndef LINKAHEAD_FILE_DESCRIPTOR_H +#define LINKAHEAD_FILE_DESCRIPTOR_H #include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField #include <filesystem> // for path diff --git a/include/linkahead/file_transmission/download_request_handler.h b/include/linkahead/file_transmission/download_request_handler.h index 10ccea9c5c88413dedce8f3e18dd55a656f88558..deec6c23eefe8b2b29dd689eb91c805dd3d9b593 100644 --- a/include/linkahead/file_transmission/download_request_handler.h +++ b/include/linkahead/file_transmission/download_request_handler.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_FILE_TRANSMISSION_DOWNLOAD_REQUEST_HANDLER_H -#define CAOSDB_FILE_TRANSMISSION_DOWNLOAD_REQUEST_HANDLER_H +#ifndef LINKAHEAD_FILE_TRANSMISSION_DOWNLOAD_REQUEST_HANDLER_H +#define LINKAHEAD_FILE_TRANSMISSION_DOWNLOAD_REQUEST_HANDLER_H #include "linkahead/file_descriptor.h" // for FileDescriptor #include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... diff --git a/include/linkahead/file_transmission/file_error.h b/include/linkahead/file_transmission/file_error.h index e47710c6b25da7d21ec10f5bb62aa96c29e1910c..d3f32833986e6f9def1cd94ad442ea349eb6c8d5 100644 --- a/include/linkahead/file_transmission/file_error.h +++ b/include/linkahead/file_transmission/file_error.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_FILE_TRANSMISSION_FILE_ERROR_H -#define CAOSDB_FILE_TRANSMISSION_FILE_ERROR_H +#ifndef LINKAHEAD_FILE_TRANSMISSION_FILE_ERROR_H +#define LINKAHEAD_FILE_TRANSMISSION_FILE_ERROR_H #include <stdexcept> #include <string> diff --git a/include/linkahead/file_transmission/file_reader.h b/include/linkahead/file_transmission/file_reader.h index 7fcc30ab1c83dfd1741bf0c9ba0590ae1fac8965..510983a3b0cf44911d902152d3ad58b6884be3b7 100644 --- a/include/linkahead/file_transmission/file_reader.h +++ b/include/linkahead/file_transmission/file_reader.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_FILE_TRANSMISSION_FILE_READER_H -#define CAOSDB_FILE_TRANSMISSION_FILE_READER_H +#ifndef LINKAHEAD_FILE_TRANSMISSION_FILE_READER_H +#define LINKAHEAD_FILE_TRANSMISSION_FILE_READER_H #include <cstddef> // for size_t #include <cstdint> // for uint64_t diff --git a/include/linkahead/file_transmission/file_writer.h b/include/linkahead/file_transmission/file_writer.h index c7c00de7bff932c843fd65a19fd7ebc91b26bf8c..8e913b1710cfd5b636a10edea1a7d70a527256d3 100644 --- a/include/linkahead/file_transmission/file_writer.h +++ b/include/linkahead/file_transmission/file_writer.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_FILE_TRANSMISSION_FILE_WRITER_H -#define CAOSDB_FILE_TRANSMISSION_FILE_WRITER_H +#ifndef LINKAHEAD_FILE_TRANSMISSION_FILE_WRITER_H +#define LINKAHEAD_FILE_TRANSMISSION_FILE_WRITER_H #include <filesystem> // for path #include <fstream> // for ofstream diff --git a/include/linkahead/file_transmission/register_file_upload_handler.h b/include/linkahead/file_transmission/register_file_upload_handler.h index a8f3283d2f119173977149d29d3979a33b550bd0..40f25d45c01c5058cbb6638c37634fbcad311e29 100644 --- a/include/linkahead/file_transmission/register_file_upload_handler.h +++ b/include/linkahead/file_transmission/register_file_upload_handler.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H -#define CAOSDB_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H +#ifndef LINKAHEAD_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H +#define LINKAHEAD_FILE_TRANSMISSION_REGISTER_FILE_UPLOAD_H #include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... #include "caosdb/entity/v1/main.grpc.pb.h" // for FileDownloadResponse diff --git a/include/linkahead/file_transmission/upload_request_handler.h b/include/linkahead/file_transmission/upload_request_handler.h index 82d749803248d380506badb87a1fa68092ddeb5d..7218152364265b988b90249519beb226e8228421 100644 --- a/include/linkahead/file_transmission/upload_request_handler.h +++ b/include/linkahead/file_transmission/upload_request_handler.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H -#define CAOSDB_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H +#ifndef LINKAHEAD_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H +#define LINKAHEAD_FILE_TRANSMISSION_UPLOAD_REQUEST_HANDLER_H #include "caosdb/entity/v1/main.pb.h" // for FileTransmissionS... #include "caosdb/entity/v1/main.grpc.pb.h" // for FileTransmissionS... diff --git a/include/linkahead/handler_interface.h b/include/linkahead/handler_interface.h index 271a581a7c5afd499694663268ec7cc1fa438e2e..3ac97d04ddc356f97aca5febabeb512417cccbb4 100644 --- a/include/linkahead/handler_interface.h +++ b/include/linkahead/handler_interface.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_HANDLER_INTERFACE_H -#define CAOSDB_HANDLER_INTERFACE_H +#ifndef LINKAHEAD_HANDLER_INTERFACE_H +#define LINKAHEAD_HANDLER_INTERFACE_H #include "linkahead/transaction_status.h" // for TransactionStatus #include <memory> diff --git a/include/linkahead/info.h b/include/linkahead/info.h index d68e6fd43114a97484d99892c483b87c23a294ba..c71c8f27d0163f14ded3e89dc85a4ee97d6fe7a4 100644 --- a/include/linkahead/info.h +++ b/include/linkahead/info.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_INFO_H -#define CAOSDB_INFO_H +#ifndef LINKAHEAD_INFO_H +#define LINKAHEAD_INFO_H /** * @file linkahead/info.h * @author Timm Fitschen diff --git a/include/linkahead/log_level.h b/include/linkahead/log_level.h index 8bf5af97a85eaf01960e01f0dfd9ba5f236eb86b..82c63a8f4b024ac8a1edfdc1e973cf08cdc47531 100644 --- a/include/linkahead/log_level.h +++ b/include/linkahead/log_level.h @@ -19,20 +19,20 @@ * */ -#ifndef CAOSDB_LOG_LEVEL_H -#define CAOSDB_LOG_LEVEL_H +#ifndef LINKAHEAD_LOG_LEVEL_H +#define LINKAHEAD_LOG_LEVEL_H -#define CAOSDB_LOG_LEVEL_OFF 1000000 -#define CAOSDB_LOG_LEVEL_FATAL 700 -#define CAOSDB_LOG_LEVEL_ERROR 600 -#define CAOSDB_LOG_LEVEL_WARN 500 -#define CAOSDB_LOG_LEVEL_INFO 400 -#define CAOSDB_LOG_LEVEL_DEBUG 300 -#define CAOSDB_LOG_LEVEL_TRACE 200 -#define CAOSDB_LOG_LEVEL_ALL 0 +#define LINKAHEAD_LOG_LEVEL_OFF 1000000 +#define LINKAHEAD_LOG_LEVEL_FATAL 700 +#define LINKAHEAD_LOG_LEVEL_ERROR 600 +#define LINKAHEAD_LOG_LEVEL_WARN 500 +#define LINKAHEAD_LOG_LEVEL_INFO 400 +#define LINKAHEAD_LOG_LEVEL_DEBUG 300 +#define LINKAHEAD_LOG_LEVEL_TRACE 200 +#define LINKAHEAD_LOG_LEVEL_ALL 0 -#ifndef CAOSDB_DEFAULT_LOG_LEVEL -#define CAOSDB_DEFAULT_LOG_LEVEL CAOSDB_LOG_LEVEL_ERROR +#ifndef LINKAHEAD_DEFAULT_LOG_LEVEL +#define LINKAHEAD_DEFAULT_LOG_LEVEL LINKAHEAD_LOG_LEVEL_ERROR #endif #endif diff --git a/include/linkahead/logging.h b/include/linkahead/logging.h index 4b83fd88f03831b9e7d965d8f1bc8a6ee9dc833c..bc6216b52def7405b36971e1128ec89ede1e8ccf 100644 --- a/include/linkahead/logging.h +++ b/include/linkahead/logging.h @@ -20,10 +20,10 @@ * */ -#ifndef CAOSDB_LOGGING_H -#define CAOSDB_LOGGING_H +#ifndef LINKAHEAD_LOGGING_H +#define LINKAHEAD_LOGGING_H -#include "linkahead/log_level.h" // for CAOSDB_LOG_... +#include "linkahead/log_level.h" // for LINKAHEAD_LOG_... #include <cstdint> // for uint64_t #include <iosfwd> // for streamsize #include <memory> // for shared_ptr @@ -64,17 +64,17 @@ private: * * Please Use the macro * - * CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, function_name); + * LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, function_name); */ class TraceEnterLeaveLogger { public: inline TraceEnterLeaveLogger(const std::string &channel, const std::string &function_name) : channel(channel), function_name(function_name) { - linkahead::logging::LoggerOutputStream::get(this->channel, CAOSDB_LOG_LEVEL_TRACE) + linkahead::logging::LoggerOutputStream::get(this->channel, LINKAHEAD_LOG_LEVEL_TRACE) << "Enter " << this->function_name; } inline ~TraceEnterLeaveLogger() { - linkahead::logging::LoggerOutputStream::get(this->channel, CAOSDB_LOG_LEVEL_TRACE) + linkahead::logging::LoggerOutputStream::get(this->channel, LINKAHEAD_LOG_LEVEL_TRACE) << "Leave " << this->function_name; } @@ -227,24 +227,24 @@ void caosdb_log_trace(const char *channel, const char *msg); } // namespace linkahead::logging -#define CAOSDB_LOG_FATAL(Channel) \ - linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_FATAL) -#define CAOSDB_LOG_ERROR(Channel) \ - linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_ERROR) -#define CAOSDB_LOG_WARN(Channel) \ - linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_WARN) -#define CAOSDB_LOG_INFO(Channel) \ - linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_INFO) -#define CAOSDB_LOG_DEBUG(Channel) \ - linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_DEBUG) -#define CAOSDB_LOG_TRACE(Channel) \ - linkahead::logging::LoggerOutputStream::get(Channel, CAOSDB_LOG_LEVEL_TRACE) - -#define CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(Channel, FunctionName) \ +#define LINKAHEAD_LOG_FATAL(Channel) \ + linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_FATAL) +#define LINKAHEAD_LOG_ERROR(Channel) \ + linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_ERROR) +#define LINKAHEAD_LOG_WARN(Channel) \ + linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_WARN) +#define LINKAHEAD_LOG_INFO(Channel) \ + linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_INFO) +#define LINKAHEAD_LOG_DEBUG(Channel) \ + linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_DEBUG) +#define LINKAHEAD_LOG_TRACE(Channel) \ + linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_TRACE) + +#define LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(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 << ") " \ +#define LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS(Channel, StatusCode, Message) \ + LINKAHEAD_LOG_ERROR(Channel) << "StatusCode (" << StatusCode << ") " \ << linkahead::get_status_description(StatusCode) << ": " << Message; \ return StatusCode; diff --git a/include/linkahead/message_code.h b/include/linkahead/message_code.h index e060ff9673c367c6738b60952abdc87e2e539a6f..e3063d2d69d8a1b7c357a93efbca649ef7beb82e 100644 --- a/include/linkahead/message_code.h +++ b/include/linkahead/message_code.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_MESSAGE_CODE_H -#define CAOSDB_MESSAGE_CODE_H +#ifndef LINKAHEAD_MESSAGE_CODE_H +#define LINKAHEAD_MESSAGE_CODE_H #include "caosdb/entity/v1/main.pb.h" // for Entity, RepeatedField diff --git a/include/linkahead/protobuf_helper.h b/include/linkahead/protobuf_helper.h index 402b0f6f37a886d9a6206dd169030b71eec964fc..646ed6e89ee302946b2cd59aea077f7b5814589d 100644 --- a/include/linkahead/protobuf_helper.h +++ b/include/linkahead/protobuf_helper.h @@ -19,15 +19,15 @@ * */ -#ifndef CAOSDB_PROTOBUF_HELPER_H -#define CAOSDB_PROTOBUF_HELPER_H +#ifndef LINKAHEAD_PROTOBUF_HELPER_H +#define LINKAHEAD_PROTOBUF_HELPER_H // IWYU pragma: no_include <google/protobuf/extension_set.h> #include <google/protobuf/arena.h> // for Arena #include <google/protobuf/util/json_util.h> // for JsonOptions, MessageToJs... #include <string> // for string -#define CAOSDB_DEBUG_MESSAGE_STRING(message, out) \ +#define LINKAHEAD_DEBUG_MESSAGE_STRING(message, out) \ std::string out; \ { \ google::protobuf::util::JsonOptions options; \ @@ -104,7 +104,7 @@ public: if (this->wrapped == nullptr) { return "{}\n"; } - CAOSDB_DEBUG_MESSAGE_STRING(*this->wrapped, out) + LINKAHEAD_DEBUG_MESSAGE_STRING(*this->wrapped, out) return out; } }; diff --git a/include/linkahead/result_set.h b/include/linkahead/result_set.h index 97e00dd97f31e7220b2b4bff42c48cdf79c8e295..d12d417635f38478d2262cf8dceb2dcedfeb820e 100644 --- a/include/linkahead/result_set.h +++ b/include/linkahead/result_set.h @@ -18,8 +18,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#ifndef CAOSDB_RESULT_SET_H -#define CAOSDB_RESULT_SET_H +#ifndef LINKAHEAD_RESULT_SET_H +#define LINKAHEAD_RESULT_SET_H #include "linkahead/entity.h" // for Entity, FileDe... #include <algorithm> // for max diff --git a/include/linkahead/result_table.h b/include/linkahead/result_table.h index 387ff8c7cbb39f43d558a987aa7efb01a9c7b439..bbdbf363e0932b9fcea5df2c1db18390f99fd5c6 100644 --- a/include/linkahead/result_table.h +++ b/include/linkahead/result_table.h @@ -18,8 +18,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#ifndef CAOSDB_RESULT_TABLE_H -#define CAOSDB_RESULT_TABLE_H +#ifndef LINKAHEAD_RESULT_TABLE_H +#define LINKAHEAD_RESULT_TABLE_H #include "linkahead/value.h" // for Value #include <iterator> // for iterator, next diff --git a/include/linkahead/status_code.h b/include/linkahead/status_code.h index 3cc46459ff9369fa6bea22e6f5e6298c251a6785..4dc5f80e1d94e0bf8c737effb4507175108c04b4 100644 --- a/include/linkahead/status_code.h +++ b/include/linkahead/status_code.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_STATUS_CODE_H -#define CAOSDB_STATUS_CODE_H +#ifndef LINKAHEAD_STATUS_CODE_H +#define LINKAHEAD_STATUS_CODE_H #include <grpcpp/impl/codegen/status_code_enum.h> // for StatusCode #include <string> // for string diff --git a/include/linkahead/transaction.h b/include/linkahead/transaction.h index ff768917fbfa0d53febee933756f548ccfdced51..9c7baa380d2f3d18d09daaf05d48e94a3432c2c8 100644 --- a/include/linkahead/transaction.h +++ b/include/linkahead/transaction.h @@ -18,8 +18,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#ifndef CAOSDB_TRANSACTION_H -#define CAOSDB_TRANSACTION_H +#ifndef LINKAHEAD_TRANSACTION_H +#define LINKAHEAD_TRANSACTION_H #include "linkahead/entity.h" // for Entity, FileDe... #include "caosdb/entity/v1/main.pb.h" // for EntityTransact... @@ -27,7 +27,7 @@ #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/logging.h" // for LINKAHEAD_LOG_ERR... #include "linkahead/protobuf_helper.h" // for get_arena #include "linkahead/status_code.h" // for StatusCode #include "linkahead/result_set.h" // for ResultSet @@ -63,7 +63,7 @@ case TransactionType::MIXED_READ_AND_WRITE: \ break; \ default: \ - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \ + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( \ logger_name, StatusCode::TRANSACTION_TYPE_ERROR, \ "You cannot add a retrieval to this transaction because it has the " \ "wrong TransactionType.") \ @@ -76,7 +76,7 @@ #define ASSERT_CAN_ADD_QUERY \ ASSERT_CAN_ADD_RETRIEVAL \ if (this->has_query) { \ - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \ + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( \ logger_name, StatusCode::UNSUPPORTED_FEATURE, \ "Currently the number of queries which can be processed in a single " \ "transaction is limitted to one."); \ @@ -99,7 +99,7 @@ case TransactionType::MIXED_READ_AND_WRITE: \ break; \ default: \ - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \ + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( \ logger_name, StatusCode::TRANSACTION_TYPE_ERROR, \ "You cannot add a deletion to this transaction because it has the " \ "wrong TransactionType.") \ @@ -122,7 +122,7 @@ case TransactionType::MIXED_READ_AND_WRITE: \ break; \ default: \ - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \ + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( \ logger_name, StatusCode::TRANSACTION_TYPE_ERROR, \ "You cannot add an insertion to this transaction because it has the " \ "wrong TransactionType.") \ @@ -145,13 +145,13 @@ case TransactionType::MIXED_READ_AND_WRITE: \ break; \ default: \ - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \ + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( \ logger_name, StatusCode::TRANSACTION_TYPE_ERROR, \ "You cannot add an update to this transaction because it has the " \ "wrong TransactionType.") \ } \ if (!entity->HasId()) { \ - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( \ + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( \ logger_name, StatusCode::ORIGINAL_ENTITY_MISSING_ID, \ "You cannot update this entity without any id. Probably you did not " \ "retrieve it first? Entity updates should always start with the " \ @@ -317,7 +317,7 @@ public: */ [[nodiscard]] inline auto GetResultSet() const noexcept -> const ResultSet & { if (this->GetStatus().GetCode() < 0) { - CAOSDB_LOG_ERROR(logger_name) + LINKAHEAD_LOG_ERROR(logger_name) << "GetResultSet was called before the transaction has terminated. This is a programming " "error of the code which uses the transaction."; // TODO(tf) This is a really bad SegFault factory. When the transaction @@ -325,7 +325,7 @@ public: // created here will be deleted and any client of the return ResultSet // will have a SegFault. } else if (this->GetStatus().GetCode() == StatusCode::SPOILED) { - CAOSDB_LOG_ERROR(logger_name) + LINKAHEAD_LOG_ERROR(logger_name) << "GetResultSet was called on a \"spoiled\" transaction. That means " "that the result set has already been released via " "ReleaseResultSet(). This is a programming error of the code which " @@ -339,11 +339,11 @@ public: */ [[nodiscard]] inline auto GetResultTable() const noexcept -> const ResultTable & { if (this->GetStatus().GetCode() < 0) { - CAOSDB_LOG_ERROR(logger_name) + LINKAHEAD_LOG_ERROR(logger_name) << "GetResultTable was called before the transaction has terminated. This is a programming " "error of the code which uses the transaction."; } else if (this->GetStatus().GetCode() == StatusCode::SPOILED) { - CAOSDB_LOG_ERROR(logger_name) + LINKAHEAD_LOG_ERROR(logger_name) << "GetResultTable was called on a \"spoiled\" transaction. That means " "that the result table has already been released via " "ReleaseResultTable(). This is a programming error of the code which " diff --git a/include/linkahead/transaction_status.h b/include/linkahead/transaction_status.h index fbdedafb762c128715aa0c437b974492575c9a24..230ad05758c28da8eab5f140dc36cb8ca5124d26 100644 --- a/include/linkahead/transaction_status.h +++ b/include/linkahead/transaction_status.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_TRANSACTION_STATUS_H -#define CAOSDB_TRANSACTION_STATUS_H +#ifndef LINKAHEAD_TRANSACTION_STATUS_H +#define LINKAHEAD_TRANSACTION_STATUS_H #include "linkahead/status_code.h" #include "linkahead/exceptions.h" @@ -39,7 +39,7 @@ using linkahead::exceptions::TransactionTypeError; /** * Define static factory method in the TransactionStatus class. */ -#define CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(_StatusName, _StatusCode) \ +#define LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(_StatusName, _StatusCode) \ inline static auto _StatusName() -> const TransactionStatus & { \ static const TransactionStatus instance(_StatusCode, \ linkahead::get_status_description(_StatusCode)); \ @@ -62,7 +62,7 @@ public: * This status means that the transaction has not been executed yet and the * transaction does not contain any sub-transactions yet. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(INITIAL, StatusCode::INITIAL) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(INITIAL, StatusCode::INITIAL) /** * Factory for a GO_ON status. * @@ -71,7 +71,7 @@ public: * * However, it also can be executed right now. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(GO_ON, StatusCode::GO_ON) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(GO_ON, StatusCode::GO_ON) /** * Factory for a READY status. * @@ -79,26 +79,26 @@ public: * ready to be executed and it is not possible anymore to add further * sub-transactions. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(READY, StatusCode::READY) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(READY, StatusCode::READY) /** * Factory for an EXECUTING status. * * This status means that the transaction is currently being executed. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(EXECUTING, StatusCode::EXECUTING) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(EXECUTING, StatusCode::EXECUTING) /** * Factory for a SUCCESS status. * * This status means that the transaction has been executed successfully. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(SUCCESS, StatusCode::SUCCESS) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(SUCCESS, StatusCode::SUCCESS) /** * Factory for a CANCELLED status. * * This status means that the transaction has been canceled and should not be * used anymore. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(CANCELLED, StatusCode::CANCELLED) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(CANCELLED, StatusCode::CANCELLED) /** * Factory for a CONNECTION_ERROR status. * @@ -106,13 +106,13 @@ public: * possibly due to misconfiguration of the client, errors in the network or * because the server is down. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(CONNECTION_ERROR, StatusCode::CONNECTION_ERROR) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(CONNECTION_ERROR, StatusCode::CONNECTION_ERROR) /** * Factory for an AUTHENTICATION_ERROR status. * * This status means that the RPC layer reported an authentication error. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(AUTHENTICATION_ERROR, StatusCode::AUTHENTICATION_ERROR) + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(AUTHENTICATION_ERROR, StatusCode::AUTHENTICATION_ERROR) /** * Another factory for an TRANSACTION_ERROR Status with a detailed * description. @@ -128,21 +128,21 @@ public: * This status means that the transaction failed during the upload of the * file blobs of file entities. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(FILE_UPLOAD_ERROR, StatusCode::FILE_UPLOAD_ERROR); + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(FILE_UPLOAD_ERROR, StatusCode::FILE_UPLOAD_ERROR); /** * Factory for a FILE_DOWN_ERROR status. * * This status means that the transaction failed during the download of the * file blobs of file entities. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(FILE_DOWNLOAD_ERROR, StatusCode::FILE_DOWNLOAD_ERROR); + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(FILE_DOWNLOAD_ERROR, StatusCode::FILE_DOWNLOAD_ERROR); /** * Factory for a TRANSACTION_ERROR status. * * This status means that the transaction failed due to errors thrown by the * server. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(TRANSACTION_ERROR, + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(TRANSACTION_ERROR, StatusCode::GENERIC_TRANSACTION_ERROR) /** * Factory for a SPOILED status. @@ -151,7 +151,7 @@ public: * GetResultSet() will not return the actual results of the transaction * anymore. */ - CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(SPOILED, StatusCode::SPOILED); + LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(SPOILED, StatusCode::SPOILED); /** * Another factory for a TRANSACTION_ERROR status with a detailed * description. diff --git a/include/linkahead/unary_rpc_handler.h b/include/linkahead/unary_rpc_handler.h index a23484dd2739420fc519f1bd509af08efc76f5ff..4122c3f918ac0df97660f752b8539f4d5236ad83 100644 --- a/include/linkahead/unary_rpc_handler.h +++ b/include/linkahead/unary_rpc_handler.h @@ -46,8 +46,8 @@ * > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * > DEALINGS IN THE SOFTWARE. */ -#ifndef CAOSDB_UNARY_RPC_HANDLER_H -#define CAOSDB_UNARY_RPC_HANDLER_H +#ifndef LINKAHEAD_UNARY_RPC_HANDLER_H +#define LINKAHEAD_UNARY_RPC_HANDLER_H #include "linkahead/handler_interface.h" // for HandlerTag, Handl... #include "linkahead/transaction_status.h" // for TransactionStatus diff --git a/include/linkahead/utility.h b/include/linkahead/utility.h index 3d73b2d5561599fd57d679cbcd45e4a7405e00e4..d5d9a1422a9c978c4aa8245d4c05dbeffa596213 100644 --- a/include/linkahead/utility.h +++ b/include/linkahead/utility.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_UTILS_H -#define CAOSDB_UTILS_H +#ifndef LINKAHEAD_UTILS_H +#define LINKAHEAD_UTILS_H #include "linkahead/data_type.h" // for AtomicDataType #include "linkahead/entity.h" // for Importance, Role #include <cstdlib> // for getenv diff --git a/include/linkahead/value.h b/include/linkahead/value.h index 513731a5266508b2509cb11df4bedb872e95a7c8..42b59eecc36ba7bc36128a31ddd0c8000950346f 100644 --- a/include/linkahead/value.h +++ b/include/linkahead/value.h @@ -19,8 +19,8 @@ * */ -#ifndef CAOSDB_VALUE_H -#define CAOSDB_VALUE_H +#ifndef LINKAHEAD_VALUE_H +#define LINKAHEAD_VALUE_H #include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper #include "caosdb/entity/v1/main.pb.h" // for RepeatedPtrField, Message #include <cstdint> // for int64_t diff --git a/linkaheadConfig.cmake b/linkaheadConfig.cmake index eb79c290384d653146f4e79796b29cf4f2d5f8c1..50f4d45613d02ee1df742c313831e56b9b6d1499 100644 --- a/linkaheadConfig.cmake +++ b/linkaheadConfig.cmake @@ -1,4 +1,4 @@ -get_filename_component(CAOSDB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(LINKAHEAD_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(CMakeFindDependencyMacro) @@ -7,5 +7,5 @@ find_dependency(Protobuf CONFIG REQUIRED) find_dependency(gRPC CONFIG REQUIRED) if(NOT TARGET linkahead::linkahead) - include("${CAOSDB_CMAKE_DIR}/linkaheadTargets.cmake") + include("${LINKAHEAD_CMAKE_DIR}/linkaheadTargets.cmake") endif() diff --git a/src/clinkahead.cpp b/src/clinkahead.cpp index 1b4063132bf00b023d2bfe41ac507f721c31608c..3fcd6a3b333f16685b5b2a0f7c96ca19045b0b2d 100644 --- a/src/clinkahead.cpp +++ b/src/clinkahead.cpp @@ -38,7 +38,7 @@ extern "C" { -#define CCAOSDB_LOGGER_NAME "clinkahead" +#define CLINKAHEAD_LOGGER_NAME "clinkahead" #define WRAPPED_ENTITY_CAST(name) static_cast<linkahead::entity::Entity *>(name->wrapped_entity) @@ -67,11 +67,11 @@ extern "C" { */ #define ERROR_RETURN_CODE(code, fun, body) \ fun { \ - CAOSDB_LOG_TRACE(CCAOSDB_LOGGER_NAME) << "Enter " << #fun; \ + LINKAHEAD_LOG_TRACE(CLINKAHEAD_LOGGER_NAME) << "Enter " << #fun; \ try { \ body \ } catch (const std::exception &exc) { \ - linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); \ + linkahead::logging::caosdb_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); \ return linkahead::StatusCode::code; \ } \ } @@ -79,7 +79,7 @@ extern "C" { /** * Macro for entity getters */ -#define CAOSDB_ENTITY_GET(element, GetFunction) \ +#define LINKAHEAD_ENTITY_GET(element, GetFunction) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ int caosdb_entity_entity_get_##element(caosdb_entity_entity *entity, char **out), { \ @@ -94,7 +94,7 @@ extern "C" { /** * Macro for entity setters */ -#define CAOSDB_ENTITY_SET(element, value, body_part) \ +#define LINKAHEAD_ENTITY_SET(element, value, body_part) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ int caosdb_entity_entity_set_##element(caosdb_entity_entity *entity, const char *value), { \ @@ -105,7 +105,7 @@ extern "C" { /** * Macro for property getters */ -#define CAOSDB_PROPERTY_GET(element, GetFunction) \ +#define LINKAHEAD_PROPERTY_GET(element, GetFunction) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ int caosdb_entity_property_get_##element(caosdb_entity_property *property, char **out), { \ @@ -120,7 +120,7 @@ extern "C" { /** * Macro for property setters */ -#define CAOSDB_PROPERTY_SET(element, value, body_part) \ +#define LINKAHEAD_PROPERTY_SET(element, value, body_part) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ int caosdb_entity_property_set_##element(caosdb_entity_property *property, const char *value), \ @@ -132,7 +132,7 @@ extern "C" { /** * Macro for parent getters */ -#define CAOSDB_PARENT_GET(element, GetFunction) \ +#define LINKAHEAD_PARENT_GET(element, GetFunction) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ int caosdb_entity_parent_get_##element(caosdb_entity_parent *parent, char **out), { \ @@ -147,7 +147,7 @@ extern "C" { /** * Macro for parent setters */ -#define CAOSDB_PARENT_SET(element, value, body_part) \ +#define LINKAHEAD_PARENT_SET(element, value, body_part) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ int caosdb_entity_parent_set_##element(caosdb_entity_parent *parent, const char *value), { \ @@ -203,11 +203,11 @@ extern "C" { return 0; \ }) -int caosdb_constants_LIBCAOSDB_VERSION_MAJOR() { return linkahead::LIBCAOSDB_VERSION_MAJOR; } +int caosdb_constants_LIBLINKAHEAD_VERSION_MAJOR() { return linkahead::LIBLINKAHEAD_VERSION_MAJOR; } -int caosdb_constants_LIBCAOSDB_VERSION_MINOR() { return linkahead::LIBCAOSDB_VERSION_MINOR; } +int caosdb_constants_LIBLINKAHEAD_VERSION_MINOR() { return linkahead::LIBLINKAHEAD_VERSION_MINOR; } -int caosdb_constants_LIBCAOSDB_VERSION_PATCH() { return linkahead::LIBCAOSDB_VERSION_PATCH; } +int caosdb_constants_LIBLINKAHEAD_VERSION_PATCH() { return linkahead::LIBLINKAHEAD_VERSION_PATCH; } int caosdb_constants_COMPATIBLE_SERVER_VERSION_MAJOR() { return linkahead::COMPATIBLE_SERVER_VERSION_MAJOR; @@ -664,7 +664,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, out->_deletable = true; return 0; } catch (const std::out_of_range &exc) { - linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + linkahead::logging::caosdb_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) @@ -687,7 +687,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, out->_deletable = true; return 0; } catch (const std::out_of_range &exc) { - linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + linkahead::logging::caosdb_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) @@ -728,7 +728,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_delete_value(caosdb_entity_va return 0; }) -CAOSDB_ENTITY_GET(id, GetId()) +LINKAHEAD_ENTITY_GET(id, GetId()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_role(caosdb_entity_entity *entity, char **out), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); @@ -739,7 +739,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, *out = tmp; return 0; }) -CAOSDB_ENTITY_GET(name, GetName()) +LINKAHEAD_ENTITY_GET(name, GetName()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_local_path(caosdb_entity_entity *entity, char **out), { @@ -751,8 +751,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, *out = tmp; return 0; }) -// CAOSDB_ENTITY_GET(file_path, GetFilePath()) TODO(henrik) -CAOSDB_ENTITY_GET(description, GetDescription()) +// LINKAHEAD_ENTITY_GET(file_path, GetFilePath()) TODO(henrik) +LINKAHEAD_ENTITY_GET(description, GetDescription()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_datatype(caosdb_entity_entity *entity, caosdb_entity_datatype *out), @@ -772,8 +772,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) -CAOSDB_ENTITY_GET(unit, GetUnit()) -CAOSDB_ENTITY_GET(version_id, GetVersionId()) +LINKAHEAD_ENTITY_GET(unit, GetUnit()) +LINKAHEAD_ENTITY_GET(version_id, GetVersionId()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_errors_size(caosdb_entity_entity *entity, int *out), @@ -876,13 +876,13 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) -CAOSDB_PARENT_GET(id, GetId()) -CAOSDB_PARENT_GET(name, GetName()) -CAOSDB_PARENT_GET(description, GetDescription()) +LINKAHEAD_PARENT_GET(id, GetId()) +LINKAHEAD_PARENT_GET(name, GetName()) +LINKAHEAD_PARENT_GET(description, GetDescription()) -CAOSDB_PROPERTY_GET(id, GetId()) -CAOSDB_PROPERTY_GET(name, GetName()) -CAOSDB_PROPERTY_GET(description, GetDescription()) +LINKAHEAD_PROPERTY_GET(id, GetId()) +LINKAHEAD_PROPERTY_GET(name, GetName()) +LINKAHEAD_PROPERTY_GET(description, GetDescription()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_property_get_importance(caosdb_entity_property *property, @@ -915,7 +915,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, out->_deletable = false; return 0; }) -CAOSDB_PROPERTY_GET(unit, GetUnit()) +LINKAHEAD_PROPERTY_GET(unit, GetUnit()) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_message_get_code(caosdb_entity_message *message, int *out), { @@ -1051,17 +1051,17 @@ ERROR_RETURN_CODE(GENERIC_ERROR, wrapped_entity->SetRole(enum_value); return 0; } catch (const std::out_of_range &exc) { - linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + linkahead::logging::caosdb_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) -CAOSDB_ENTITY_SET(name, name, wrapped_entity->SetName(std::string(name));) -CAOSDB_ENTITY_SET(local_path, local_path, +LINKAHEAD_ENTITY_SET(name, name, wrapped_entity->SetName(std::string(name));) +LINKAHEAD_ENTITY_SET(local_path, local_path, return wrapped_entity->SetLocalPath(std::filesystem::path(local_path));) -CAOSDB_ENTITY_SET(file_path, file_path, wrapped_entity->SetFilePath(std::string(file_path));) -CAOSDB_ENTITY_SET(description, description, +LINKAHEAD_ENTITY_SET(file_path, file_path, wrapped_entity->SetFilePath(std::string(file_path));) +LINKAHEAD_ENTITY_SET(description, description, wrapped_entity->SetDescription(std::string(description));) -CAOSDB_ENTITY_SET(unit, unit, wrapped_entity->SetUnit(std::string(unit));) +LINKAHEAD_ENTITY_SET(unit, unit, wrapped_entity->SetUnit(std::string(unit));) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_set_datatype(caosdb_entity_entity *entity, caosdb_entity_datatype *datatype), @@ -1121,11 +1121,11 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) -CAOSDB_PARENT_SET(id, id, wrapped_parent->SetId(std::string(id));) -CAOSDB_PARENT_SET(name, name, wrapped_parent->SetName(std::string(name));) +LINKAHEAD_PARENT_SET(id, id, wrapped_parent->SetId(std::string(id));) +LINKAHEAD_PARENT_SET(name, name, wrapped_parent->SetName(std::string(name));) -CAOSDB_PROPERTY_SET(name, name, wrapped_property->SetName(std::string(name));) -CAOSDB_PROPERTY_SET(id, id, wrapped_property->SetId(std::string(id));) +LINKAHEAD_PROPERTY_SET(name, name, wrapped_property->SetName(std::string(name));) +LINKAHEAD_PROPERTY_SET(id, id, wrapped_property->SetId(std::string(id));) ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_property_set_datatype(caosdb_entity_property *property, caosdb_entity_datatype *datatype), @@ -1155,10 +1155,10 @@ ERROR_RETURN_CODE(GENERIC_ERROR, wrapped_property->SetImportance(enum_value); return 0; } catch (const std::out_of_range &exc) { - linkahead::logging::caosdb_log_fatal(CCAOSDB_LOGGER_NAME, exc.what()); + linkahead::logging::caosdb_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); return linkahead::StatusCode::ENUM_MAPPING_ERROR; } }) -CAOSDB_PROPERTY_SET(unit, unit, wrapped_property->SetUnit(std::string(unit));) +LINKAHEAD_PROPERTY_SET(unit, unit, wrapped_property->SetUnit(std::string(unit));) } diff --git a/src/clinkaheadcli.c b/src/clinkaheadcli.c index 50677ddbbd8452235b9686e7ebaa17a33312dac5..dc0d657f6a15cf80738b2c53aeb4acab92e0fd11 100644 --- a/src/clinkaheadcli.c +++ b/src/clinkaheadcli.c @@ -1,11 +1,11 @@ -#include "linkahead/constants.h" // for LIBCAOSDB_VERSION_MAJOR, LIBCAOSDB_VER... +#include "linkahead/constants.h" // for LIBLINKAHEAD_VERSION_MAJOR, LIBLINKAHEAD_VER... #include "clinkahead.h" // for caosdb_info_version_info, caosdb_conne... #include <stdio.h> // for printf int main(void) { int status = 0; // last function return value printf("CaosDB C client (libcaosdb %d.%d.%d)\nWe don't miss the H of caos.\n\n", - LIBCAOSDB_VERSION_MAJOR, LIBCAOSDB_VERSION_MINOR, LIBCAOSDB_VERSION_PATCH); + LIBLINKAHEAD_VERSION_MAJOR, LIBLINKAHEAD_VERSION_MINOR, LIBLINKAHEAD_VERSION_PATCH); caosdb_connection_connection connection; status = caosdb_connection_connection_manager_get_default_connection(&connection); diff --git a/src/cxxlinkaheadcli.cpp b/src/cxxlinkaheadcli.cpp index 816d08da9effb7f4b0a5deaf385a23cb4b2a6a13..69730fa7502a0982f04ea1fc6314ba9c5d9fdfc0 100644 --- a/src/cxxlinkaheadcli.cpp +++ b/src/cxxlinkaheadcli.cpp @@ -22,11 +22,11 @@ // A simple caosdb client #include "linkahead/connection.h" // for Connection, ConnectionManager -#include "linkahead/constants.h" // for LIBCAOSDB_VERSION_MINOR, LIBCAOSDB_V... +#include "linkahead/constants.h" // for LIBLINKAHEAD_VERSION_MINOR, LIBLINKAHEAD_V... #include "linkahead/entity.h" // for Entity #include "linkahead/exceptions.h" // for ConfigurationError #include "linkahead/info.h" // for VersionInfo -#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE +#include "linkahead/logging.h" // for LINKAHEAD_LOG_TRACE #include "linkahead/transaction.h" // for Transaction, ResultSet #include "linkahead/transaction_status.h" // for TransactionSt... #include <boost/log/core/record.hpp> // for record @@ -43,8 +43,8 @@ const auto logger_name = "liblinkahead"; auto main() -> int { - std::cout << "CaosDB C++ client (libcaosdb " << linkahead::LIBCAOSDB_VERSION_MINOR << "." - << linkahead::LIBCAOSDB_VERSION_MINOR << "." << linkahead::LIBCAOSDB_VERSION_PATCH + std::cout << "CaosDB C++ client (libcaosdb " << linkahead::LIBLINKAHEAD_VERSION_MINOR << "." + << linkahead::LIBLINKAHEAD_VERSION_MINOR << "." << linkahead::LIBLINKAHEAD_VERSION_PATCH << ")\n" << "We don't miss the H of caos.\n" << std::endl; @@ -64,7 +64,7 @@ auto main() -> int { transaction->RetrieveById("21"); transaction->ExecuteAsynchronously(); auto t_stat = transaction->WaitForIt(); - CAOSDB_LOG_INFO(logger_name) << "status: " << t_stat.GetCode() << " // " + LINKAHEAD_LOG_INFO(logger_name) << "status: " << t_stat.GetCode() << " // " << t_stat.GetDescription(); const auto &result_set = transaction->GetResultSet(); for (const auto &entity : result_set) { @@ -78,7 +78,7 @@ auto main() -> int { q_transaction->Query(query); q_transaction->ExecuteAsynchronously(); t_stat = q_transaction->WaitForIt(); - CAOSDB_LOG_INFO(logger_name) << "status: " << t_stat.GetCode() << " // " + LINKAHEAD_LOG_INFO(logger_name) << "status: " << t_stat.GetCode() << " // " << t_stat.GetDescription(); const auto &result_set_2 = q_transaction->GetResultSet(); for (const auto &entity : result_set_2) { diff --git a/src/linkahead/configuration.cpp b/src/linkahead/configuration.cpp index d5316717364ceba4473a0d417c588491df7329a7..f68cea40eb2253ccbe73903e3080f3fb588c0bc9 100644 --- a/src/linkahead/configuration.cpp +++ b/src/linkahead/configuration.cpp @@ -21,9 +21,9 @@ #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/constants.h" // for LIBLINKAHEAD_CONF... #include "linkahead/exceptions.h" // for ConfigurationE... -#include "linkahead/log_level.h" // for CAOSDB_DEFAULT... +#include "linkahead/log_level.h" // for LINKAHEAD_DEFAULT... #include "linkahead/logging.h" // for SinkConfiguration, Loggin... #include "linkahead/status_code.h" // for StatusCode #include "linkahead/utility.h" // for get_home_direc... @@ -296,11 +296,11 @@ auto CreateFileSinkConfiguration(const object &from, const std::string &name, in auto ConvertLogLevel(const std::string &string_level) -> int { static std::map<std::string, int> log_level_names = { - {"", CAOSDB_DEFAULT_LOG_LEVEL}, {"off", CAOSDB_LOG_LEVEL_OFF}, - {"fatal", CAOSDB_LOG_LEVEL_FATAL}, {"error", CAOSDB_LOG_LEVEL_ERROR}, - {"warn", CAOSDB_LOG_LEVEL_WARN}, {"info", CAOSDB_LOG_LEVEL_INFO}, - {"debug", CAOSDB_LOG_LEVEL_DEBUG}, {"trace", CAOSDB_LOG_LEVEL_TRACE}, - {"all", CAOSDB_LOG_LEVEL_ALL}}; + {"", LINKAHEAD_DEFAULT_LOG_LEVEL}, {"off", LINKAHEAD_LOG_LEVEL_OFF}, + {"fatal", LINKAHEAD_LOG_LEVEL_FATAL}, {"error", LINKAHEAD_LOG_LEVEL_ERROR}, + {"warn", LINKAHEAD_LOG_LEVEL_WARN}, {"info", LINKAHEAD_LOG_LEVEL_INFO}, + {"debug", LINKAHEAD_LOG_LEVEL_DEBUG}, {"trace", LINKAHEAD_LOG_LEVEL_TRACE}, + {"all", LINKAHEAD_LOG_LEVEL_ALL}}; try { return log_level_names.at(string_level); } catch (const std::out_of_range &exc) { @@ -333,7 +333,7 @@ auto CreateLoggingConfiguration(const object &from) -> LoggingConfiguration { int default_level = ConvertLogLevel(default_level_str); auto result = LoggingConfiguration(default_level); - if (default_level == CAOSDB_LOG_LEVEL_OFF) { + if (default_level == LINKAHEAD_LOG_LEVEL_OFF) { return result; } @@ -361,7 +361,7 @@ auto ConfigurationManager::mReset() noexcept -> int { } 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: " + LINKAHEAD_LOG_ERROR(logger_name) << "Unknown error during the reset of the ConfigurationManager: " << exc.what(); return StatusCode::CONFIGURATION_ERROR; } @@ -375,7 +375,7 @@ auto ConfigurationManager::mClear() noexcept -> int { } 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: " + LINKAHEAD_LOG_ERROR(logger_name) << "Unknown error during the reset of the ConfigurationManager: " << exc.what(); return StatusCode::CONFIGURATION_ERROR; } @@ -430,11 +430,11 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT // find the configuration file... std::unique_ptr<path> configuration_file_path; for (const char *const &configuration_file : - linkahead::LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE) { - if (strcmp(configuration_file, "$CAOSDB_CLIENT_CONFIGURATION") == 0) { + linkahead::LIBLINKAHEAD_CONFIGURATION_FILES_PRECEDENCE) { + if (strcmp(configuration_file, "$LINKAHEAD_CLIENT_CONFIGURATION") == 0) { // user specified a file via the environment variable // TODO(tf) make this thread-secure (concurrency-mt-unsafe) - const auto *from_env_var = getenv("CAOSDB_CLIENT_CONFIGURATION"); // NOLINT + const auto *from_env_var = getenv("LINKAHEAD_CLIENT_CONFIGURATION"); // NOLINT if (from_env_var != nullptr) { configuration_file_path = std::make_unique<path>(from_env_var); if (exists(*configuration_file_path)) { @@ -442,7 +442,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT } else { configuration_file_path = nullptr; // TODO(tf) log warning: "Configuration file under - // $CAOSDB_CLIENT_CONFIGURATION does not exist. + // $LINKAHEAD_CLIENT_CONFIGURATION does not exist. } } } else { @@ -479,13 +479,13 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT logging::initialize_logging(logging_configuration); } else { logging::initialize_logging_defaults(); - CAOSDB_LOG_INFO(logger_name) << "No logging configuration has been found. " + LINKAHEAD_LOG_INFO(logger_name) << "No logging configuration has been found. " "We are using the default configuration"; } if (configuration_file_path != nullptr && this->json_configuration.wrapped && WRAPPED_JSON_CONFIGURATION(this)->is_object()) { - CAOSDB_LOG_INFO(logger_name) << "Loaded configuration from " << *(configuration_file_path) + LINKAHEAD_LOG_INFO(logger_name) << "Loaded configuration from " << *(configuration_file_path) << "."; } diff --git a/src/linkahead/file_transmission/download_request_handler.cpp b/src/linkahead/file_transmission/download_request_handler.cpp index 6578e75b64a3798be366bf6e7a82f2a9ffd7e1f5..142b3716a34ba0b168fbf9effc7edef6d06566ab 100644 --- a/src/linkahead/file_transmission/download_request_handler.cpp +++ b/src/linkahead/file_transmission/download_request_handler.cpp @@ -47,7 +47,7 @@ * > DEALINGS IN THE SOFTWARE. */ #include "linkahead/file_transmission/download_request_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE +#include "linkahead/logging.h" // for LINKAHEAD_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 @@ -96,11 +96,11 @@ bool DownloadRequestHandler::OnNext(bool ok) { return true; } catch (std::exception &e) { - CAOSDB_LOG_ERROR(logger_name) << "DownloadRequestHandler caught an exception: " << e.what(); + LINKAHEAD_LOG_ERROR(logger_name) << "DownloadRequestHandler caught an exception: " << e.what(); transaction_status = TransactionStatus::GENERIC_ERROR(e.what()); state_ = CallState::CallComplete; } catch (...) { - CAOSDB_LOG_ERROR(logger_name) << "Transaction error: unknown exception caught"; + LINKAHEAD_LOG_ERROR(logger_name) << "Transaction error: unknown exception caught"; transaction_status = TransactionStatus::GENERIC_ERROR("DownloadRequestHandler caught an unknown exception"); state_ = CallState::CallComplete; @@ -121,7 +121,7 @@ void DownloadRequestHandler::Cancel() { } void DownloadRequestHandler::handleNewCallState() { - CAOSDB_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleNewCallState. local_path = " + LINKAHEAD_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleNewCallState. local_path = " << file_descriptor_.local_path << ", download_id = " << file_descriptor_.file_transmission_id; fileWriter_ = std::make_unique<FileWriter>(file_descriptor_.local_path); @@ -134,22 +134,22 @@ void DownloadRequestHandler::handleNewCallState() { transaction_status = TransactionStatus::EXECUTING(); state_ = CallState::SendingRequest; rpc_->StartCall(tag_); - CAOSDB_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleNewCallState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleNewCallState"; } void DownloadRequestHandler::handleSendingRequestState() { - CAOSDB_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleSendingRequestState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleSendingRequestState"; state_ = CallState::ReceivingFile; rpc_->Read(response_, tag_); - CAOSDB_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleSendingRequestState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleSendingRequestState"; } void DownloadRequestHandler::handleReceivingFileState() { - CAOSDB_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleReceivingFileState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleReceivingFileState"; if (response_->has_chunk()) { const auto &chunkData = response_->chunk().data(); if (chunkData.empty()) { - CAOSDB_LOG_DEBUG(logger_name) << "Received an empty FileChunk, ignoring"; + LINKAHEAD_LOG_DEBUG(logger_name) << "Received an empty FileChunk, ignoring"; } else { fileWriter_->write(chunkData); bytesReceived_ += chunkData.size(); @@ -161,15 +161,15 @@ void DownloadRequestHandler::handleReceivingFileState() { } else { throw std::runtime_error("File chunk expected"); } - CAOSDB_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleReceivingFileState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleReceivingFileState"; } void DownloadRequestHandler::handleCallCompleteState() { - CAOSDB_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleCallCompleteState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleCallCompleteState"; switch (status_.error_code()) { case grpc::OK: { - CAOSDB_LOG_INFO(logger_name) << "DownloadRequestHandler finished successfully (" + LINKAHEAD_LOG_INFO(logger_name) << "DownloadRequestHandler finished successfully (" << file_descriptor_.local_path << "): Download complete, " << bytesReceived_ << " bytes received."; } break; @@ -178,13 +178,13 @@ void DownloadRequestHandler::handleCallCompleteState() { std::string description(get_status_description(code) + " Original message: " + status_.error_message()); transaction_status = TransactionStatus(code, description); - CAOSDB_LOG_ERROR(logger_name) << "DownloadRequestHandler finished with an error (" + LINKAHEAD_LOG_ERROR(logger_name) << "DownloadRequestHandler finished with an error (" << file_descriptor_.local_path << "): Download aborted with code " << code << " - " << description; } break; } - CAOSDB_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleCallCompleteState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Leave DownloadRequestHandler::handleCallCompleteState"; } } // 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 58abb2e079a29462719908f6e20c367e3f4313e1..a17a77c8a2c96a2fe9c365c0ef687879abb4d917 100644 --- a/src/linkahead/file_transmission/register_file_upload_handler.cpp +++ b/src/linkahead/file_transmission/register_file_upload_handler.cpp @@ -47,7 +47,7 @@ * > DEALINGS IN THE SOFTWARE. */ #include "linkahead/file_transmission/register_file_upload_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE +#include "linkahead/logging.h" // for LINKAHEAD_LOG_TRACE namespace linkahead::transaction { @@ -62,7 +62,7 @@ RegisterFileUploadHandler::RegisterFileUploadHandler(HandlerTag tag, response_(response) {} void RegisterFileUploadHandler::handleNewCallState() { - CAOSDB_LOG_TRACE(logger_name) << "Enter RegisterFileUploadHandler::handleNewCallState."; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter RegisterFileUploadHandler::handleNewCallState."; rpc_ = stub_->PrepareAsyncRegisterFileUpload(&call_context, *request_, completion_queue); @@ -70,7 +70,7 @@ void RegisterFileUploadHandler::handleNewCallState() { rpc_->StartCall(); rpc_->Finish(response_, &status_, tag_); - CAOSDB_LOG_TRACE(logger_name) << "Leave RegisterFileUploadHandler::handleNewCallState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Leave RegisterFileUploadHandler::handleNewCallState"; } } // namespace linkahead::transaction diff --git a/src/linkahead/file_transmission/upload_request_handler.cpp b/src/linkahead/file_transmission/upload_request_handler.cpp index 0e4311315e725f9b022f59e01f996dd5ca72094f..a1134a9204c0cb723ea7a37829ef9de82439f6be 100644 --- a/src/linkahead/file_transmission/upload_request_handler.cpp +++ b/src/linkahead/file_transmission/upload_request_handler.cpp @@ -47,7 +47,7 @@ * > DEALINGS IN THE SOFTWARE. */ #include "linkahead/file_transmission/upload_request_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_ERROR +#include "linkahead/logging.h" // for LINKAHEAD_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 @@ -95,11 +95,11 @@ bool UploadRequestHandler::OnNext(bool ok) { return true; } catch (std::exception &e) { - CAOSDB_LOG_ERROR(logger_name) << "UploadRequestHandler caught an exception: " << e.what(); + LINKAHEAD_LOG_ERROR(logger_name) << "UploadRequestHandler caught an exception: " << e.what(); transaction_status = TransactionStatus::GENERIC_ERROR(e.what()); state_ = CallState::CallComplete; } catch (...) { - CAOSDB_LOG_ERROR(logger_name) << "Transaction error: unknown exception caught"; + LINKAHEAD_LOG_ERROR(logger_name) << "Transaction error: unknown exception caught"; transaction_status = TransactionStatus::GENERIC_ERROR("UploadRequestHandler caught an unknown exception"); state_ = CallState::CallComplete; @@ -174,12 +174,12 @@ void UploadRequestHandler::handleExpectingResponseState() { } void UploadRequestHandler::handleCallCompleteState() { - CAOSDB_LOG_TRACE(logger_name) << "Enter UploadRequestHandler::handleCallCompleteState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter UploadRequestHandler::handleCallCompleteState"; switch (status_.error_code()) { case grpc::OK: { auto bytesSent = fileReader_ != nullptr ? fileReader_->fileSize() : 0; - CAOSDB_LOG_INFO(logger_name) << "UploadRequestHandler finished successfully (" + LINKAHEAD_LOG_INFO(logger_name) << "UploadRequestHandler finished successfully (" << file_descriptor_.local_path << "): upload complete, " << bytesSent << " bytes sent"; } break; @@ -188,13 +188,13 @@ void UploadRequestHandler::handleCallCompleteState() { std::string description(get_status_description(code) + " Original message: " + status_.error_message()); transaction_status = TransactionStatus(code, description); - CAOSDB_LOG_ERROR(logger_name) << "UploadRequestHandler finished with an error (" + LINKAHEAD_LOG_ERROR(logger_name) << "UploadRequestHandler finished with an error (" << file_descriptor_.local_path << "): Upload aborted with code " << code << " - " << description; } break; } - CAOSDB_LOG_TRACE(logger_name) << "Leave UploadRequestHandler::handleCallCompleteState"; + LINKAHEAD_LOG_TRACE(logger_name) << "Leave UploadRequestHandler::handleCallCompleteState"; } } // namespace linkahead::transaction diff --git a/src/linkahead/logging.cpp b/src/linkahead/logging.cpp index 28d07ac5310fc9b7674f88e9436f673433f7f4b2..7490529b59a1c1b20d1e63f6056f6256c5299371 100644 --- a/src/linkahead/logging.cpp +++ b/src/linkahead/logging.cpp @@ -136,7 +136,7 @@ SinkConfiguration::SinkConfiguration(std::string name, int level) [[nodiscard]] auto SinkConfiguration::GetName() const -> const std::string & { return this->name; } auto SinkConfiguration::Configure(void *settings) const -> void { - CAOSDB_LOG_TRACE(logger_name) << "Enter SinkConfiguration::Configure(*settings)"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter SinkConfiguration::Configure(*settings)"; auto sink = "Sinks." + GetName(); auto *boost_settings = static_cast<boost::log::settings *>(settings); (*boost_settings)[sink]["Destination"] = GetDestination(); @@ -149,12 +149,12 @@ ConsoleSinkConfiguration::ConsoleSinkConfiguration(const std::string &name, int : SinkConfiguration(name, level) {} [[nodiscard]] auto ConsoleSinkConfiguration::GetDestination() const -> const std::string & { - CAOSDB_LOG_TRACE(logger_name) << "Enter ConsoleSinkConfiguration::GetDestination()"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter ConsoleSinkConfiguration::GetDestination()"; return this->destination; } auto ConsoleSinkConfiguration::Configure(void *settings) const -> void { - CAOSDB_LOG_TRACE(logger_name) << "Enter ConsoleSinkConfiguration::Configure(*settings)"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter ConsoleSinkConfiguration::Configure(*settings)"; sink_configuration::Configure(settings); } @@ -162,7 +162,7 @@ FileSinkConfiguration::FileSinkConfiguration(const std::string &name, int level) : SinkConfiguration(name, level) {} [[nodiscard]] auto FileSinkConfiguration::GetDestination() const -> const std::string & { - CAOSDB_LOG_TRACE(logger_name) << "Enter FileSinkConfiguration::GetDestination()"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter FileSinkConfiguration::GetDestination()"; return this->destination; } @@ -171,7 +171,7 @@ auto FileSinkConfiguration::SetDirectory(const std::string &directory) -> void { } auto FileSinkConfiguration::Configure(void *settings) const -> void { - CAOSDB_LOG_TRACE(logger_name) << "Enter FileSinkConfiguration::Configure(*settings)"; + LINKAHEAD_LOG_TRACE(logger_name) << "Enter FileSinkConfiguration::Configure(*settings)"; sink_configuration::Configure(settings); auto *boost_settings = static_cast<boost::log::settings *>(settings); (*boost_settings)["Sink." + GetName() + ".Target"] = this->directory; @@ -196,7 +196,7 @@ auto initialize_logging_defaults() -> int { // now set everything up const static std::vector<std::shared_ptr<SinkConfiguration>> default_sinks = { - std::make_shared<ConsoleSinkConfiguration>("DEFAULT_SINK_1", CAOSDB_DEFAULT_LOG_LEVEL)}; + std::make_shared<ConsoleSinkConfiguration>("DEFAULT_SINK_1", LINKAHEAD_DEFAULT_LOG_LEVEL)}; boost::log::settings default_settings; @@ -209,7 +209,7 @@ auto initialize_logging_defaults() -> int { boost::log::init_from_settings(default_settings); core->add_global_attribute("TimeStamp", boost::log::attributes::local_clock()); - CAOSDB_LOG_DEBUG(logger_name) << "Initialized default settings."; + LINKAHEAD_LOG_DEBUG(logger_name) << "Initialized default settings."; return 0; } @@ -224,7 +224,7 @@ auto initialize_logging(const LoggingConfiguration &configuration) -> void { core->set_logging_enabled(false); } - if (configuration.GetLevel() == CAOSDB_LOG_LEVEL_OFF) { + if (configuration.GetLevel() == LINKAHEAD_LOG_LEVEL_OFF) { // it is off return; } @@ -239,31 +239,31 @@ auto initialize_logging(const LoggingConfiguration &configuration) -> void { boost::log::init_from_settings(new_settings); - CAOSDB_LOG_DEBUG(logger_name) << "Initialized logging with custom settings."; + LINKAHEAD_LOG_DEBUG(logger_name) << "Initialized logging with custom settings."; } void caosdb_log_fatal(const char *channel, const char *msg) { - LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_FATAL) << msg; + LoggerOutputStream::get(channel, LINKAHEAD_LOG_LEVEL_FATAL) << msg; } void caosdb_log_error(const char *channel, const char *msg) { - LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_ERROR) << msg; + LoggerOutputStream::get(channel, LINKAHEAD_LOG_LEVEL_ERROR) << msg; } void caosdb_log_warn(const char *channel, const char *msg) { - LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_WARN) << msg; + LoggerOutputStream::get(channel, LINKAHEAD_LOG_LEVEL_WARN) << msg; } void caosdb_log_info(const char *channel, const char *msg) { - LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_INFO) << msg; + LoggerOutputStream::get(channel, LINKAHEAD_LOG_LEVEL_INFO) << msg; } void caosdb_log_debug(const char *channel, const char *msg) { - LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_DEBUG) << msg; + LoggerOutputStream::get(channel, LINKAHEAD_LOG_LEVEL_DEBUG) << msg; } void caosdb_log_trace(const char *channel, const char *msg) { - LoggerOutputStream::get(channel, CAOSDB_LOG_LEVEL_TRACE) << msg; + LoggerOutputStream::get(channel, LINKAHEAD_LOG_LEVEL_TRACE) << msg; } } // namespace linkahead::logging diff --git a/src/linkahead/result_table_impl.h b/src/linkahead/result_table_impl.h index cb1202710d13513f5ecee3ad42aef5dc332995ab..62d7fa1c67c4d9b9ec2d0ce2c6e6cb6856701040 100644 --- a/src/linkahead/result_table_impl.h +++ b/src/linkahead/result_table_impl.h @@ -17,8 +17,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#ifndef CAOSDB_RESULT_TABLE_IMPL_H -#define CAOSDB_RESULT_TABLE_IMPL_H +#ifndef LINKAHEAD_RESULT_TABLE_IMPL_H +#define LINKAHEAD_RESULT_TABLE_IMPL_H #include "linkahead/transaction.h" #include "caosdb/entity/v1/main.pb.h" // for EntityTransac... @@ -27,7 +27,7 @@ #include "linkahead/file_transmission/file_reader.h" // for path #include "linkahead/file_transmission/register_file_upload_handler.h" // for RegisterFileUploadHandler #include "linkahead/file_transmission/upload_request_handler.h" // Upload... -#include "linkahead/logging.h" // for CAOSDB_LOG_FATAL +#include "linkahead/logging.h" // for LINKAHEAD_LOG_FATAL #include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper #include "linkahead/status_code.h" // for StatusCode #include "linkahead/transaction_handler.h" // for EntityTransactionHandler diff --git a/src/linkahead/transaction.cpp b/src/linkahead/transaction.cpp index fe055b1512fac5459ec9d1ac63fee18575d030e8..cf29ae2cc1b8e7f5ff74f95be338b8cfbf13f2c1 100644 --- a/src/linkahead/transaction.cpp +++ b/src/linkahead/transaction.cpp @@ -24,7 +24,7 @@ #include "linkahead/file_transmission/file_reader.h" // for path #include "linkahead/file_transmission/register_file_upload_handler.h" // for RegisterFileUploadHandler #include "linkahead/file_transmission/upload_request_handler.h" // Upload... -#include "linkahead/logging.h" // for CAOSDB_LOG_FATAL +#include "linkahead/logging.h" // for LINKAHEAD_LOG_FATAL #include "linkahead/protobuf_helper.h" // for ProtoMessageWrapper #include "linkahead/result_set.h" // for ResultSet #include "linkahead/result_table.h" // for ResultTable @@ -183,7 +183,7 @@ auto Transaction::Execute() -> TransactionStatus { auto Transaction::DoExecuteTransaction() noexcept -> void { // upload files first if (!upload_files.empty()) { - CAOSDB_LOG_INFO(logger_name) << "Number of files to be uploaded: " << upload_files.size(); + LINKAHEAD_LOG_INFO(logger_name) << "Number of files to be uploaded: " << upload_files.size(); auto *registration_request = Arena::CreateMessage<RegisterFileUploadRequest>(get_arena()); auto *registration_response = Arena::CreateMessage<RegisterFileUploadResponse>(get_arena()); @@ -208,7 +208,7 @@ auto Transaction::DoExecuteTransaction() noexcept -> void { { TRANSACTION_SYNCRONIZED_BLOCK if (this->status.GetCode() == StatusCode::EXECUTING) { - CAOSDB_LOG_INFO(logger_name) << "Uploading " << file_descriptor.local_path; + LINKAHEAD_LOG_INFO(logger_name) << "Uploading " << file_descriptor.local_path; handler_ = std::make_unique<UploadRequestHandler>(&handler_, file_service.get(), &completion_queue, file_descriptor); } @@ -225,7 +225,7 @@ auto Transaction::DoExecuteTransaction() noexcept -> void { { TRANSACTION_SYNCRONIZED_BLOCK if (this->status.GetCode() == StatusCode::EXECUTING) { - CAOSDB_LOG_DEBUG(logger_name) << "RPC Request: " << RequestToString(); + LINKAHEAD_LOG_DEBUG(logger_name) << "RPC Request: " << RequestToString(); handler_ = std::make_unique<EntityTransactionHandler>(&handler_, entity_service.get(), &completion_queue, request, response); } @@ -254,7 +254,7 @@ auto Transaction::DoExecuteTransaction() noexcept -> void { { TRANSACTION_SYNCRONIZED_BLOCK if (this->status.GetCode() == StatusCode::EXECUTING) { - CAOSDB_LOG_INFO(logger_name) << "Downloading " << file_descriptor.local_path; + LINKAHEAD_LOG_INFO(logger_name) << "Downloading " << file_descriptor.local_path; handler_ = std::make_unique<DownloadRequestHandler>(&handler_, file_service.get(), &completion_queue, file_descriptor); @@ -279,7 +279,7 @@ auto Transaction::ExecuteAsynchronously() noexcept -> StatusCode { } switch (this->transaction_type) { case MIXED_READ_AND_WRITE: - CAOSDB_LOG_ERROR_AND_RETURN_STATUS( + LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS( logger_name, StatusCode::UNSUPPORTED_FEATURE, "MIXED_WRITE UNSUPPORTED: The current implementation does not support " "mixed read and write transactions (containing retrievals, insertions, " @@ -325,14 +325,14 @@ auto Transaction::ProcessRetrieveResponse(RetrieveResponse *retrieve_response, } } break; default: - CAOSDB_LOG_FATAL(logger_name) << "Received invalid QueryResponseCase."; + LINKAHEAD_LOG_FATAL(logger_name) << "Received invalid QueryResponseCase."; break; } return result; } auto Transaction::ProcessTerminated() const noexcept -> void { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::ProcessTerminated()") + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::ProcessTerminated()") bool set_error = false; auto *responses = this->response->mutable_responses(); std::vector<std::unique_ptr<Entity>> entities; @@ -361,7 +361,7 @@ auto Transaction::ProcessTerminated() const noexcept -> void { break; } default: - CAOSDB_LOG_FATAL(logger_name) << "Received invalid TransactionResponseCase."; + LINKAHEAD_LOG_FATAL(logger_name) << "Received invalid TransactionResponseCase."; break; } // default to sub_response.transaction_response_case() if (result != nullptr) { @@ -400,10 +400,10 @@ auto Transaction::WaitForIt() const noexcept -> TransactionStatus { } auto Transaction::ProcessCalls() -> TransactionStatus { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::ProcessCalls()") { + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::ProcessCalls()") { TRANSACTION_SYNCRONIZED_BLOCK if (this->status.GetCode() != StatusCode::EXECUTING) { - CAOSDB_LOG_ERROR(logger_name) + LINKAHEAD_LOG_ERROR(logger_name) << "Transaction::ProcessCalls() was called, TransactionStatus was: " << std::to_string(this->status.GetCode()) << " - " << this->status.GetDescription(); return status; @@ -433,20 +433,20 @@ auto Transaction::ProcessCalls() -> TransactionStatus { } } else { std::string description("Invalid tag delivered by notification queue."); - CAOSDB_LOG_ERROR(logger_name) << description; + LINKAHEAD_LOG_ERROR(logger_name) << description; return TransactionStatus::RPC_ERROR(description); } } break; case NextStatus::SHUTDOWN: { - CAOSDB_LOG_ERROR(logger_name) << "Notification queue has been shut down unexpectedly."; + LINKAHEAD_LOG_ERROR(logger_name) << "Notification queue has been shut down unexpectedly."; result = handler_->GetStatus(); return result; } break; case NextStatus::TIMEOUT: { - CAOSDB_LOG_DEBUG(logger_name) << "Timeout, waiting..."; + LINKAHEAD_LOG_DEBUG(logger_name) << "Timeout, waiting..."; } break; default: - CAOSDB_LOG_FATAL(logger_name) << "Got an invalid NextStatus from CompletionQueue."; + LINKAHEAD_LOG_FATAL(logger_name) << "Got an invalid NextStatus from CompletionQueue."; result = handler_->GetStatus(); return result; } @@ -457,12 +457,12 @@ auto Transaction::ProcessCalls() -> TransactionStatus { } Transaction::~Transaction() { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::~Transaction()") + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::~Transaction()") this->Cancel(); } void Transaction::Cancel() { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::Cancel()") + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "Transaction::Cancel()") if (this->status.GetCode() == StatusCode::CANCELLED) { return; diff --git a/src/linkahead/transaction_handler.cpp b/src/linkahead/transaction_handler.cpp index c672587fdadbf906b54aefeea3b45865dfe53909..a1214a70321952d18bc52547dacbd5c3189dcc48 100644 --- a/src/linkahead/transaction_handler.cpp +++ b/src/linkahead/transaction_handler.cpp @@ -1,5 +1,5 @@ #include "linkahead/transaction_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE +#include "linkahead/logging.h" // for LINKAHEAD_LOG_TRACE #include <exception> // IWYU pragma: keep // IWYU pragma: no_include <bits/exception.h> @@ -14,7 +14,7 @@ EntityTransactionHandler::EntityTransactionHandler(HandlerTag tag, response_(response) {} void EntityTransactionHandler::handleNewCallState() { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "EntityTransactionHandler::handleNewCallState()") + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "EntityTransactionHandler::handleNewCallState()") rpc_ = stub_->PrepareAsyncMultiTransaction(&call_context, *request_, completion_queue); diff --git a/src/linkahead/unary_rpc_handler.cpp b/src/linkahead/unary_rpc_handler.cpp index 9f6c6313152743b238b9ad3515917030c112c13e..e202c35ab588aa4d9569f0fc9fcaa6feee7c03da 100644 --- a/src/linkahead/unary_rpc_handler.cpp +++ b/src/linkahead/unary_rpc_handler.cpp @@ -47,7 +47,7 @@ * > DEALINGS IN THE SOFTWARE. */ #include "linkahead/unary_rpc_handler.h" -#include "linkahead/logging.h" // for CAOSDB_LOG_TRACE +#include "linkahead/logging.h" // for LINKAHEAD_LOG_TRACE #include "linkahead/status_code.h" // for GENERIC_RPC_E... #include <exception> // IWYU pragma: keep #include <string> // for string, opera... @@ -56,7 +56,7 @@ namespace linkahead::transaction { bool UnaryRpcHandler::OnNext(bool ok) { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "UnaryRpcHandler::OnNext(bool)") + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "UnaryRpcHandler::OnNext(bool)") try { if (ok) { if (state_ == CallState::NewCall) { @@ -66,7 +66,7 @@ bool UnaryRpcHandler::OnNext(bool ok) { return false; } } else { - CAOSDB_LOG_ERROR(logger_name) << "UnaryRpcHandler::OnNext(false)!. This should not happen."; + LINKAHEAD_LOG_ERROR(logger_name) << "UnaryRpcHandler::OnNext(false)!. This should not happen."; // TODO(tf) Handle this error: // in CallComplete state: "Client-side Finish: ok should always be true" // in ReceivingFile state: "ok indicates that the RPC is going to go to @@ -80,11 +80,11 @@ bool UnaryRpcHandler::OnNext(bool ok) { return true; } catch (std::exception &e) { - CAOSDB_LOG_ERROR(logger_name) << "UnaryRpcHandler caught an exception: " << e.what(); + LINKAHEAD_LOG_ERROR(logger_name) << "UnaryRpcHandler caught an exception: " << e.what(); transaction_status = TransactionStatus::GENERIC_ERROR(e.what()); state_ = CallState::CallComplete; } catch (...) { - CAOSDB_LOG_ERROR(logger_name) << "Transaction error: unknown exception caught"; + LINKAHEAD_LOG_ERROR(logger_name) << "Transaction error: unknown exception caught"; transaction_status = TransactionStatus::GENERIC_ERROR("UnaryRpcHandler caught an unknown exception"); state_ = CallState::CallComplete; @@ -104,18 +104,18 @@ void UnaryRpcHandler::Cancel() { } void UnaryRpcHandler::handleCallCompleteState() { - CAOSDB_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "UnaryRpcHandler::handleCallCompleteState()") + LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(logger_name, "UnaryRpcHandler::handleCallCompleteState()") switch (status_.error_code()) { case grpc::OK: - CAOSDB_LOG_TRACE(logger_name) << "UnaryRpcHandler finished successfully."; + LINKAHEAD_LOG_TRACE(logger_name) << "UnaryRpcHandler finished successfully."; break; default: auto code(static_cast<StatusCode>(status_.error_code())); std::string description(get_status_description(code) + " Original message: " + status_.error_message()); transaction_status = TransactionStatus(code, description); - CAOSDB_LOG_ERROR(logger_name) << "UnaryRpcHandler finished with an error (Code " << code + LINKAHEAD_LOG_ERROR(logger_name) << "UnaryRpcHandler finished with an error (Code " << code << "): " << description; break; } diff --git a/test/linkahead_test_utility.h.in b/test/linkahead_test_utility.h.in index c5bcd569f3982b665e18ad747b0b47e2ed4023a9..eff2eacdc933cbcbf8adc57ffc939cbd61b54afa 100644 --- a/test/linkahead_test_utility.h.in +++ b/test/linkahead_test_utility.h.in @@ -20,8 +20,8 @@ * */ -#ifndef CAOSDB_TEST_UTILITY_H -#define CAOSDB_TEST_UTILITY_H +#ifndef LINKAHEAD_TEST_UTILITY_H +#define LINKAHEAD_TEST_UTILITY_H #include <string> /** * @file linkahead_test_utility.h diff --git a/test/test_configuration.cpp b/test/test_configuration.cpp index 0e23725da37c2d874c6fa56d905cc96226bf493c..b4ffc90ccb3686981f2f23c35422c8e3e12b4f65 100644 --- a/test/test_configuration.cpp +++ b/test/test_configuration.cpp @@ -21,7 +21,7 @@ */ #include "linkahead/configuration.h" // for ConfigurationError, Configuration... #include "linkahead/exceptions.h" // for ConfigurationError -#include "linkahead/log_level.h" // for CAOSDB_DEFAULT_LOG_LEVEL, CAOSDB_... +#include "linkahead/log_level.h" // for LINKAHEAD_DEFAULT_LOG_LEVEL, LINKAHEAD_... #include "linkahead/logging.h" // for ConsoleSinkConfiguration, Logging... #include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE, TEST_DATA_DIR #include <gtest/gtest.h> @@ -74,9 +74,9 @@ TEST_F(test_configuration, get_default_connection_configuration_error) { } TEST_F(test_configuration, initialize_logging) { - auto logging_configuration = linkahead::logging::LoggingConfiguration(CAOSDB_LOG_LEVEL_ALL); + auto logging_configuration = linkahead::logging::LoggingConfiguration(LINKAHEAD_LOG_LEVEL_ALL); auto console_sink = std::make_shared<linkahead::logging::ConsoleSinkConfiguration>( - "console", CAOSDB_DEFAULT_LOG_LEVEL); + "console", LINKAHEAD_DEFAULT_LOG_LEVEL); logging_configuration.AddSink(console_sink); initialize_logging(logging_configuration); diff --git a/test/test_data_type.cpp b/test/test_data_type.cpp index aab03adeaafb101b748e20354c124c20ff7032e4..aa90cb32e9eb03f6be6e4d22ebf337ab3270432d 100644 --- a/test/test_data_type.cpp +++ b/test/test_data_type.cpp @@ -23,8 +23,8 @@ #include "linkahead/data_type.h" // for DataType, AtomicDataType #include "linkahead/entity.h" // for Entity #include "caosdb/entity/v1/main.pb.h" // for DataType, Ato... -#include "linkahead/logging.h" // for CAOSDB_LOG_DEBUG -#include "linkahead/protobuf_helper.h" // for CAOSDB_DEBUG_... +#include "linkahead/logging.h" // for LINKAHEAD_LOG_DEBUG +#include "linkahead/protobuf_helper.h" // for LINKAHEAD_DEBUG_... #include <gtest/gtest.h> #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApi... @@ -108,8 +108,8 @@ TEST(test_data_type, test_list_of_reference) { EXPECT_TRUE(list_data_type.IsListOfReference()); EXPECT_FALSE(list_data_type.IsListOfAtomic()); const auto *wrapped = list_data_type.GetReferenceDataType().GetWrapped(); - CAOSDB_DEBUG_MESSAGE_STRING(*wrapped, out) - CAOSDB_LOG_DEBUG("linkahead::entity") << "wrapped " + out; + LINKAHEAD_DEBUG_MESSAGE_STRING(*wrapped, out) + LINKAHEAD_LOG_DEBUG("linkahead::entity") << "wrapped " + out; EXPECT_EQ(list_data_type.GetReferenceDataType().GetName(), "person"); }