diff --git a/include/clinkahead.h b/include/clinkahead.h index 72ceb8bae82970358fe3169a9b8c96413a338781..61947ff3dfeafc3d9c84ab77928f0b2120e61067 100644 --- a/include/clinkahead.h +++ b/include/clinkahead.h @@ -136,8 +136,8 @@ const char *dget_status_description(int code); * EXPERT USE ONLY. Memory management with this function is a bit tricky. * Only use it when you know what you are doing. */ -int dconnection_create_pem_file_certificate_provider( - dconnection_certificate_provider *out, const char *path); +int dconnection_create_pem_file_certificate_provider(dconnection_certificate_provider *out, + const char *path); /** * Destructor function for a certificate provider. @@ -158,10 +158,10 @@ int dconnection_delete_certificate_provider(dconnection_certificate_provider *pr * EXPERT USE ONLY. Memory management with this function is a bit tricky. * Only use it when you know what you are doing. */ -int dconnection_create_tls_connection_configuration( - dconnection_connection_configuration *out, const char *host, const int port, - dauthentication_authenticator *authenticator, - dconnection_certificate_provider *provider); +int dconnection_create_tls_connection_configuration(dconnection_connection_configuration *out, + const char *host, const int port, + dauthentication_authenticator *authenticator, + dconnection_certificate_provider *provider); /** * Create a tls-secured connection configuration. @@ -178,8 +178,8 @@ int dconnection_create_tls_connection_configuration( * EXPERT USE ONLY. Memory management with this function is a bit tricky. * Only use it when you know what you are doing. */ -int dconnection_create_insecure_connection_configuration( - dconnection_connection_configuration *out, const char *host, const int port); +int dconnection_create_insecure_connection_configuration(dconnection_connection_configuration *out, + const char *host, const int port); /** * Destructor function for the dconnection_connection_configuration @@ -196,8 +196,8 @@ int dconnection_delete_connection_configuration( * * @param cacert path to a pem-file. */ -int dconnection_configuration_add_cacert( - dconnection_connection_configuration *configuration, const char *cacert); +int dconnection_configuration_add_cacert(dconnection_connection_configuration *configuration, + const char *cacert); /** * Create a plain password authenticator. @@ -209,8 +209,8 @@ int dconnection_configuration_add_cacert( * EXPERT USE ONLY. Memory management with this function is a bit tricky. * Only use it when you know what you are doing. */ -int dauthentication_create_plain_password_authenticator( - dauthentication_authenticator *out, const char *username, const char *password); +int dauthentication_create_plain_password_authenticator(dauthentication_authenticator *out, + const char *username, const char *password); /** * Destructor function for the dauthentication_authenticator struct. @@ -232,9 +232,8 @@ int dauthentication_delete_authenticator(dauthentication_authenticator *authenti * EXPERT USE ONLY. Memory management with this function is a bit tricky. * Only use it when you know what you are doing. */ -int dconnection_create_connection( - dconnection_connection *out, - const dconnection_connection_configuration *configuration); +int dconnection_create_connection(dconnection_connection *out, + const dconnection_connection_configuration *configuration); /** * Destructor function for the dconnection_connection struct. @@ -246,8 +245,7 @@ int dconnection_delete_connection(dconnection_connection *connection); /** * Request the version of the server. */ -int dconnection_get_version_info(dinfo_version_info *out, - const dconnection_connection *connection); +int dconnection_get_version_info(dinfo_version_info *out, const dconnection_connection *connection); /** * Get the default connection from the ConnectionManager. @@ -261,8 +259,7 @@ int dconnection_connection_manager_get_default_connection(dconnection_connection * * The named connection is to be specified in a configuration file. */ -int dconnection_connection_manager_get_connection(dconnection_connection *out, - const char *name); +int dconnection_connection_manager_get_connection(dconnection_connection *out, const char *name); /**************************************************************************** * ENTITY STUFF AND TRANSACTIONS @@ -280,16 +277,14 @@ typedef struct dtransaction_transaction { * dtransaction_delete_transaction() later on. */ int dconnection_connection_create_transaction(dconnection_connection *connection, - dtransaction_transaction *out); + dtransaction_transaction *out); int dtransaction_delete_transaction(dtransaction_transaction *transaction); -int dtransaction_transaction_retrieve_by_id(dtransaction_transaction *transaction, - const char *id); -int dtransaction_transaction_retrieve_and_download_file_by_id( - dtransaction_transaction *transaction, const char *id, const char *path); +int dtransaction_transaction_retrieve_by_id(dtransaction_transaction *transaction, const char *id); +int dtransaction_transaction_retrieve_and_download_file_by_id(dtransaction_transaction *transaction, + const char *id, const char *path); int dtransaction_transaction_retrieve_by_ids(dtransaction_transaction *transaction, - const char *ids[], int length); -int dtransaction_transaction_query(dtransaction_transaction *transaction, - const char *query); + const char *ids[], int length); +int dtransaction_transaction_query(dtransaction_transaction *transaction, const char *query); int dtransaction_transaction_execute(dtransaction_transaction *transaction); // TODO(fspreck) execute_asynchronously may be added as a separate // function once we actually support asynchronous execution. @@ -305,7 +300,7 @@ typedef struct dentity_entity { } dentity_entity; int dtransaction_transaction_get_result_set(dtransaction_transaction *transaction, - dtransaction_result_set *out); + dtransaction_result_set *out); /** * Release the result set from the transaction. * @@ -316,7 +311,7 @@ int dtransaction_transaction_get_result_set(dtransaction_transaction *transactio * EXPERT USE ONLY. Only use it when you know what you are doing. */ int dtransaction_transaction_release_result_set(dtransaction_transaction *transaction, - dtransaction_result_set *out); + dtransaction_result_set *out); /** * Release the entity from the result set. * @@ -327,8 +322,8 @@ int dtransaction_transaction_release_result_set(dtransaction_transaction *transa * * EXPERT USE ONLY. Only use it when you know what you are doing. */ -int dtransaction_result_set_release_at(dtransaction_result_set *result_set, - dentity_entity *entity, int index); +int dtransaction_result_set_release_at(dtransaction_result_set *result_set, dentity_entity *entity, + int index); /** * Destructor for dtransaction_result_set. * @@ -336,19 +331,18 @@ int dtransaction_result_set_release_at(dtransaction_result_set *result_set, */ int dtransaction_delete_result_set(dtransaction_result_set *result_set); -int dtransaction_transaction_get_count_result(dtransaction_transaction *transaction, - long *out); +int dtransaction_transaction_get_count_result(dtransaction_transaction *transaction, long *out); int linkahead_transaction_result_set_at(linkahead_transaction_result_set *result_set, - linkahead_entity_entity *entity, int index); + linkahead_entity_entity *entity, int index); int linkahead_transaction_result_set_size(linkahead_transaction_result_set *result_set, int *out); int linkahead_transaction_transaction_insert_entity(linkahead_transaction_transaction *transaction, - linkahead_entity_entity *entity); + linkahead_entity_entity *entity); int linkahead_transaction_transaction_update_entity(linkahead_transaction_transaction *transaction, - linkahead_entity_entity *entity); + linkahead_entity_entity *entity); int linkahead_transaction_transaction_delete_by_id(linkahead_transaction_transaction *transaction, - const char *id); + const char *id); typedef struct linkahead_entity_property { void *wrapped_property; @@ -381,34 +375,36 @@ int linkahead_entity_entity_get_role(linkahead_entity_entity *entity, char **out int linkahead_entity_entity_get_name(linkahead_entity_entity *entity, char **out); int linkahead_entity_entity_get_description(linkahead_entity_entity *entity, char **out); int linkahead_entity_entity_get_local_path(linkahead_entity_entity *entity, char **out); -int linkahead_entity_entity_get_datatype(linkahead_entity_entity *entity, linkahead_entity_datatype *out); +int linkahead_entity_entity_get_datatype(linkahead_entity_entity *entity, + linkahead_entity_datatype *out); int linkahead_entity_entity_get_unit(linkahead_entity_entity *entity, char **out); int linkahead_entity_entity_get_value(linkahead_entity_entity *entity, linkahead_entity_value *out); int linkahead_entity_entity_get_version_id(linkahead_entity_entity *entity, char **out); int linkahead_entity_entity_get_errors_size(linkahead_entity_entity *entity, int *out); -int linkahead_entity_entity_get_error(linkahead_entity_entity *entity, linkahead_entity_message *out, - int index); +int linkahead_entity_entity_get_error(linkahead_entity_entity *entity, + linkahead_entity_message *out, int index); int linkahead_entity_entity_get_warnings_size(linkahead_entity_entity *entity, int *out); -int linkahead_entity_entity_get_warning(linkahead_entity_entity *entity, linkahead_entity_message *out, - int index); +int linkahead_entity_entity_get_warning(linkahead_entity_entity *entity, + linkahead_entity_message *out, int index); int linkahead_entity_entity_get_infos_size(linkahead_entity_entity *entity, int *out); int linkahead_entity_entity_get_info(linkahead_entity_entity *entity, linkahead_entity_message *out, - int index); + int index); int linkahead_entity_entity_get_properties_size(linkahead_entity_entity *entity, int *out); -int linkahead_entity_entity_get_property(linkahead_entity_entity *entity, linkahead_entity_property *out, - int index); +int linkahead_entity_entity_get_property(linkahead_entity_entity *entity, + linkahead_entity_property *out, int index); int linkahead_entity_entity_get_parents_size(linkahead_entity_entity *entity, int *out); -int linkahead_entity_entity_get_parent(linkahead_entity_entity *entity, linkahead_entity_parent *out, - int index); +int linkahead_entity_entity_get_parent(linkahead_entity_entity *entity, + linkahead_entity_parent *out, int index); int linkahead_entity_property_get_id(linkahead_entity_property *property, char **out); int linkahead_entity_property_get_name(linkahead_entity_property *property, char **out); int linkahead_entity_property_get_description(linkahead_entity_property *property, char **out); int linkahead_entity_property_get_importance(linkahead_entity_property *property, char **out); int linkahead_entity_property_get_datatype(linkahead_entity_property *property, - linkahead_entity_datatype *out); + linkahead_entity_datatype *out); int linkahead_entity_property_get_unit(linkahead_entity_property *property, char **out); -int linkahead_entity_property_get_value(linkahead_entity_property *property, linkahead_entity_value *out); +int linkahead_entity_property_get_value(linkahead_entity_property *property, + linkahead_entity_value *out); int linkahead_entity_parent_get_id(linkahead_entity_parent *parent, char **out); int linkahead_entity_parent_get_name(linkahead_entity_parent *parent, char **out); int linkahead_entity_parent_get_description(linkahead_entity_parent *parent, char **out); @@ -434,8 +430,8 @@ int linkahead_entity_value_get_as_double(linkahead_entity_value *value, double * int linkahead_entity_value_get_as_integer(linkahead_entity_value *value, int64_t *out); int linkahead_entity_value_get_as_bool(linkahead_entity_value *value, bool *out); int linkahead_entity_value_get_as_vector_size(linkahead_entity_value *value, int *out); -int linkahead_entity_value_get_as_vector_at(linkahead_entity_value *value, linkahead_entity_value *out, - const int index); +int linkahead_entity_value_get_as_vector_at(linkahead_entity_value *value, + linkahead_entity_value *out, const int index); // CONSTRUCTORS AND DESTRUCTORS int linkahead_entity_create_entity(linkahead_entity_entity *out); @@ -449,7 +445,8 @@ int linkahead_entity_delete_parent(linkahead_entity_parent *out); int linkahead_entity_create_atomic_datatype(linkahead_entity_datatype *out, const char *name); int linkahead_entity_create_reference_datatype(linkahead_entity_datatype *out, const char *name); int linkahead_entity_create_atomic_list_datatype(linkahead_entity_datatype *out, const char *name); -int linkahead_entity_create_reference_list_datatype(linkahead_entity_datatype *out, const char *name); +int linkahead_entity_create_reference_list_datatype(linkahead_entity_datatype *out, + const char *name); int linkahead_entity_delete_datatype(linkahead_entity_datatype *out); // VALUE CONSTRUCTORS (resolve overloaded constructors) @@ -458,39 +455,44 @@ int linkahead_entity_create_string_value(linkahead_entity_value *out, const char int linkahead_entity_create_double_value(linkahead_entity_value *out, const double value); int linkahead_entity_create_bool_value(linkahead_entity_value *out, const bool value); int linkahead_entity_create_int_vector_value(linkahead_entity_value *out, const int64_t *value, - const int length); -int linkahead_entity_create_string_vector_value(linkahead_entity_value *out, const char **value, const int length); +int linkahead_entity_create_string_vector_value(linkahead_entity_value *out, const char **value, + const int length); int linkahead_entity_create_double_vector_value(linkahead_entity_value *out, const double *value, - const int length); + const int length); int linkahead_entity_create_bool_vector_value(linkahead_entity_value *out, const bool *value, - const int length); + const int length); int linkahead_entity_delete_value(linkahead_entity_value *out); // SETTERS FOR EVERYTHING THAT MAY BE SET int linkahead_entity_entity_set_role(linkahead_entity_entity *entity, const char *role); int linkahead_entity_entity_set_name(linkahead_entity_entity *entity, const char *name); -int linkahead_entity_entity_set_description(linkahead_entity_entity *entity, const char *description); +int linkahead_entity_entity_set_description(linkahead_entity_entity *entity, + const char *description); int linkahead_entity_entity_set_local_path(linkahead_entity_entity *entity, const char *name); int linkahead_entity_entity_set_file_path(linkahead_entity_entity *entity, const char *name); int linkahead_entity_entity_set_datatype(linkahead_entity_entity *entity, - linkahead_entity_datatype *datatype); + linkahead_entity_datatype *datatype); int linkahead_entity_entity_set_unit(linkahead_entity_entity *entity, const char *unit); -int linkahead_entity_entity_set_value(linkahead_entity_entity *entity, linkahead_entity_value *value); +int linkahead_entity_entity_set_value(linkahead_entity_entity *entity, + linkahead_entity_value *value); -int linkahead_entity_entity_append_parent(linkahead_entity_entity *entity, linkahead_entity_parent *parent); +int linkahead_entity_entity_append_parent(linkahead_entity_entity *entity, + linkahead_entity_parent *parent); int linkahead_entity_entity_remove_parent(linkahead_entity_entity *entity, int index); int linkahead_entity_entity_append_property(linkahead_entity_entity *entity, - linkahead_entity_property *property); + linkahead_entity_property *property); int linkahead_entity_entity_remove_property(linkahead_entity_entity *entity, int index); int linkahead_entity_property_set_id(linkahead_entity_property *property, const char *id); int linkahead_entity_property_set_name(linkahead_entity_property *property, const char *name); int linkahead_entity_property_set_datatype(linkahead_entity_property *property, - linkahead_entity_datatype *datatype); -int linkahead_entity_property_set_importance(linkahead_entity_property *property, const char *importance); + linkahead_entity_datatype *datatype); +int linkahead_entity_property_set_importance(linkahead_entity_property *property, + const char *importance); int linkahead_entity_property_set_unit(linkahead_entity_property *property, const char *unit); -int linkahead_entity_property_set_value(linkahead_entity_property *property, linkahead_entity_value *value); +int linkahead_entity_property_set_value(linkahead_entity_property *property, + linkahead_entity_value *value); int linkahead_entity_parent_set_id(linkahead_entity_parent *parent, const char *id); int linkahead_entity_parent_set_name(linkahead_entity_parent *parent, const char *name); diff --git a/include/linkahead/entity.h b/include/linkahead/entity.h index 74fa210771f2cea9a15ac942088513c391d445a9..b80df206f9e9fcb3cdeae02d035707cabc08d584 100644 --- a/include/linkahead/entity.h +++ b/include/linkahead/entity.h @@ -497,7 +497,7 @@ public: inline Property(const Property &other) : Property(ProtoMessageWrapper<ProtoProperty>::CopyProtoMessage(other.wrapped)) { LINKAHEAD_LOG_TRACE(logger_name) << "Property::Property(const Property &) " - << "- Copy constructor"; + << "- Copy constructor"; }; /** @@ -505,7 +505,7 @@ public: */ inline Property(Property &&other) : Property(other.wrapped) { LINKAHEAD_LOG_TRACE(logger_name) << "Property::Property(Property &&) " - << "- Move constructor"; + << "- Move constructor"; other.wrapped = nullptr; other.data_type.wrapped = nullptr; other.value.wrapped = nullptr; @@ -607,7 +607,7 @@ public: */ auto operator=(const Property &other) -> Property & { LINKAHEAD_LOG_TRACE(logger_name) << "Property::operator=(const Property &) " - << "- Copy assignment operator"; + << "- Copy assignment operator"; this->wrapped->CopyFrom(*other.wrapped); this->value.wrapped = (this->wrapped->has_value() ? this->wrapped->mutable_value() @@ -623,7 +623,7 @@ public: */ auto operator=(Property &&other) -> Property & { LINKAHEAD_LOG_TRACE(logger_name) << "Property::operator=(Property &&) " - << "- Move assignment operator"; + << "- Move assignment operator"; this->wrapped = other.wrapped; other.wrapped = nullptr; this->value = std::move(other.value); diff --git a/include/linkahead/logging.h b/include/linkahead/logging.h index 2df38dfbc6831073e317ba93ea7934b9b578bd89..3b70c1a203178e383d8ba286749427c8fb811158 100644 --- a/include/linkahead/logging.h +++ b/include/linkahead/logging.h @@ -227,25 +227,26 @@ void linkahead_log_trace(const char *channel, const char *msg); } // namespace linkahead::logging -#define LINKAHEAD_LOG_FATAL(Channel) \ +#define LINKAHEAD_LOG_FATAL(Channel) \ linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_FATAL) -#define LINKAHEAD_LOG_ERROR(Channel) \ +#define LINKAHEAD_LOG_ERROR(Channel) \ linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_ERROR) -#define LINKAHEAD_LOG_WARN(Channel) \ +#define LINKAHEAD_LOG_WARN(Channel) \ linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_WARN) -#define LINKAHEAD_LOG_INFO(Channel) \ +#define LINKAHEAD_LOG_INFO(Channel) \ linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_INFO) -#define LINKAHEAD_LOG_DEBUG(Channel) \ +#define LINKAHEAD_LOG_DEBUG(Channel) \ linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_DEBUG) -#define LINKAHEAD_LOG_TRACE(Channel) \ +#define LINKAHEAD_LOG_TRACE(Channel) \ linkahead::logging::LoggerOutputStream::get(Channel, LINKAHEAD_LOG_LEVEL_TRACE) -#define LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(Channel, FunctionName) \ +#define LINKAHEAD_LOG_TRACE_ENTER_AND_LEAVE(Channel, FunctionName) \ const linkahead::logging::TraceEnterLeaveLogger trace_enter_leave_logger(Channel, FunctionName); -#define LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS(Channel, StatusCode, Message) \ - LINKAHEAD_LOG_ERROR(Channel) << "StatusCode (" << StatusCode << ") " \ - << linkahead::get_status_description(StatusCode) << ": " << Message; \ +#define LINKAHEAD_LOG_ERROR_AND_RETURN_STATUS(Channel, StatusCode, Message) \ + LINKAHEAD_LOG_ERROR(Channel) << "StatusCode (" << StatusCode << ") " \ + << linkahead::get_status_description(StatusCode) << ": " \ + << Message; \ return StatusCode; #endif diff --git a/include/linkahead/protobuf_helper.h b/include/linkahead/protobuf_helper.h index 646ed6e89ee302946b2cd59aea077f7b5814589d..3df96fd3eb9157aa1049e862670c6343d6c1b560 100644 --- a/include/linkahead/protobuf_helper.h +++ b/include/linkahead/protobuf_helper.h @@ -27,7 +27,7 @@ #include <google/protobuf/util/json_util.h> // for JsonOptions, MessageToJs... #include <string> // for string -#define LINKAHEAD_DEBUG_MESSAGE_STRING(message, out) \ +#define LINKAHEAD_DEBUG_MESSAGE_STRING(message, out) \ std::string out; \ { \ google::protobuf::util::JsonOptions options; \ diff --git a/include/linkahead/transaction.h b/include/linkahead/transaction.h index 9c7baa380d2f3d18d09daaf05d48e94a3432c2c8..6394c222ca608a98f766dc29471466be6a0e1dfe 100644 --- a/include/linkahead/transaction.h +++ b/include/linkahead/transaction.h @@ -63,7 +63,7 @@ case TransactionType::MIXED_READ_AND_WRITE: \ break; \ default: \ - LINKAHEAD_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) { \ - LINKAHEAD_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: \ - LINKAHEAD_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: \ - LINKAHEAD_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: \ - LINKAHEAD_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()) { \ - LINKAHEAD_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 " \ diff --git a/include/linkahead/transaction_status.h b/include/linkahead/transaction_status.h index 230ad05758c28da8eab5f140dc36cb8ca5124d26..4653b2a6d5ddc8b88b85b6de8e8641ca44b3a4ed 100644 --- a/include/linkahead/transaction_status.h +++ b/include/linkahead/transaction_status.h @@ -39,7 +39,7 @@ using linkahead::exceptions::TransactionTypeError; /** * Define static factory method in the TransactionStatus class. */ -#define LINKAHEAD_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)); \ @@ -112,7 +112,8 @@ public: * * This status means that the RPC layer reported an authentication error. */ - LINKAHEAD_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. @@ -135,7 +136,8 @@ public: * This status means that the transaction failed during the download of the * file blobs of file entities. */ - LINKAHEAD_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. * @@ -143,7 +145,7 @@ public: * server. */ LINKAHEAD_TRANSACTION_STATUS_DEFAULT_FACTORY(TRANSACTION_ERROR, - StatusCode::GENERIC_TRANSACTION_ERROR) + StatusCode::GENERIC_TRANSACTION_ERROR) /** * Factory for a SPOILED status. * diff --git a/src/clinkahead.cpp b/src/clinkahead.cpp index 8331bc5998436bab00452bdcbd249f05d26e5992..624fbf567d0a514b95e3a689e3e4c679cb69f2f7 100644 --- a/src/clinkahead.cpp +++ b/src/clinkahead.cpp @@ -67,11 +67,11 @@ extern "C" { */ #define ERROR_RETURN_CODE(code, fun, body) \ fun { \ - LINKAHEAD_LOG_TRACE(CLINKAHEAD_LOGGER_NAME) << "Enter " << #fun; \ + LINKAHEAD_LOG_TRACE(CLINKAHEAD_LOGGER_NAME) << "Enter " << #fun; \ try { \ body \ } catch (const std::exception &exc) { \ - linkahead::logging::linkahead_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); \ + linkahead::logging::linkahead_log_fatal(CLINKAHEAD_LOGGER_NAME, exc.what()); \ return linkahead::StatusCode::code; \ } \ } @@ -79,10 +79,10 @@ extern "C" { /** * Macro for entity getters */ -#define LINKAHEAD_ENTITY_GET(element, GetFunction) \ +#define LINKAHEAD_ENTITY_GET(element, GetFunction) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ - int linkahead_entity_entity_get_##element(linkahead_entity_entity *entity, char **out), { \ + int linkahead_entity_entity_get_##element(linkahead_entity_entity *entity, char **out), { \ auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); \ auto *tmp = (char *)malloc(sizeof(char) * wrapped_entity->GetFunction.length() + 1); \ strcpy(tmp, wrapped_entity->GetFunction.c_str()); \ @@ -94,10 +94,11 @@ extern "C" { /** * Macro for entity setters */ -#define LINKAHEAD_ENTITY_SET(element, value, body_part) \ +#define LINKAHEAD_ENTITY_SET(element, value, body_part) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ - int linkahead_entity_entity_set_##element(linkahead_entity_entity *entity, const char *value), { \ + int linkahead_entity_entity_set_##element(linkahead_entity_entity *entity, const char *value), \ + { \ auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); \ body_part return 0; \ }) @@ -105,10 +106,11 @@ extern "C" { /** * Macro for property getters */ -#define LINKAHEAD_PROPERTY_GET(element, GetFunction) \ +#define LINKAHEAD_PROPERTY_GET(element, GetFunction) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ - int linkahead_entity_property_get_##element(linkahead_entity_property *property, char **out), { \ + int linkahead_entity_property_get_##element(linkahead_entity_property *property, char **out), \ + { \ auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); \ auto *tmp = (char *)malloc(sizeof(char) * wrapped_property->GetFunction.length() + 1); \ strcpy(tmp, wrapped_property->GetFunction.c_str()); \ @@ -120,22 +122,22 @@ extern "C" { /** * Macro for property setters */ -#define LINKAHEAD_PROPERTY_SET(element, value, body_part) \ - ERROR_RETURN_CODE( \ - GENERIC_ERROR, \ - int linkahead_entity_property_set_##element(linkahead_entity_property *property, const char *value), \ - { \ - auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); \ - body_part return 0; \ - }) +#define LINKAHEAD_PROPERTY_SET(element, value, body_part) \ + ERROR_RETURN_CODE(GENERIC_ERROR, \ + int linkahead_entity_property_set_##element( \ + linkahead_entity_property *property, const char *value), \ + { \ + auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); \ + body_part return 0; \ + }) /** * Macro for parent getters */ -#define LINKAHEAD_PARENT_GET(element, GetFunction) \ +#define LINKAHEAD_PARENT_GET(element, GetFunction) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ - int linkahead_entity_parent_get_##element(linkahead_entity_parent *parent, char **out), { \ + int linkahead_entity_parent_get_##element(linkahead_entity_parent *parent, char **out), { \ auto *wrapped_parent = WRAPPED_PARENT_CAST(parent); \ auto *tmp = (char *)malloc(sizeof(char) * wrapped_parent->GetFunction.length() + 1); \ strcpy(tmp, wrapped_parent->GetFunction.c_str()); \ @@ -147,10 +149,11 @@ extern "C" { /** * Macro for parent setters */ -#define LINKAHEAD_PARENT_SET(element, value, body_part) \ +#define LINKAHEAD_PARENT_SET(element, value, body_part) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ - int linkahead_entity_parent_set_##element(linkahead_entity_parent *parent, const char *value), { \ + int linkahead_entity_parent_set_##element(linkahead_entity_parent *parent, const char *value), \ + { \ auto *wrapped_parent = WRAPPED_PARENT_CAST(parent); \ body_part return 0; \ }) @@ -160,7 +163,7 @@ extern "C" { */ #define CREATE_VALUE(fname, arg) \ ERROR_RETURN_CODE(GENERIC_ERROR, \ - int linkahead_entity_create_##fname(linkahead_entity_value *out, arg), { \ + int linkahead_entity_create_##fname(linkahead_entity_value *out, arg), { \ out->wrapped_value = new linkahead::entity::Value(value); \ out->_deletable = true; \ return 0; \ @@ -171,7 +174,7 @@ extern "C" { #define CREATE_VECTOR_VALUE(fname, type, arg, assign) \ ERROR_RETURN_CODE( \ GENERIC_ERROR, \ - int linkahead_entity_create_##fname(linkahead_entity_value *out, arg, const int length), { \ + int linkahead_entity_create_##fname(linkahead_entity_value *out, arg, const int length), { \ std::vector<type> value_vec; \ for (int i = 0; i < length; i++) { \ value_vec.push_back(assign); \ @@ -185,29 +188,37 @@ extern "C" { * Macro for value is-a functions */ #define VALUE_IS(fname, isfunction) \ - ERROR_RETURN_CODE(GENERIC_ERROR, \ - int linkahead_entity_value_is_##fname(linkahead_entity_value *value, bool *out), { \ - auto *wrapped_value = WRAPPED_VALUE_CAST(value); \ - *out = wrapped_value->isfunction(); \ - return 0; \ - }) + ERROR_RETURN_CODE( \ + GENERIC_ERROR, \ + int linkahead_entity_value_is_##fname(linkahead_entity_value *value, bool *out), { \ + auto *wrapped_value = WRAPPED_VALUE_CAST(value); \ + *out = wrapped_value->isfunction(); \ + return 0; \ + }) /** * Macro for some value getters */ #define VALUE_GET_AS(fname, getfunction, arg) \ ERROR_RETURN_CODE(GENERIC_ERROR, \ - int linkahead_entity_value_get_as_##fname(linkahead_entity_value *value, arg), { \ + int linkahead_entity_value_get_as_##fname(linkahead_entity_value *value, arg), \ + { \ auto *wrapped_value = WRAPPED_VALUE_CAST(value); \ *out = wrapped_value->getfunction(); \ return 0; \ }) -int linkahead_constants_LIBLINKAHEAD_VERSION_MAJOR() { return linkahead::LIBLINKAHEAD_VERSION_MAJOR; } +int linkahead_constants_LIBLINKAHEAD_VERSION_MAJOR() { + return linkahead::LIBLINKAHEAD_VERSION_MAJOR; +} -int linkahead_constants_LIBLINKAHEAD_VERSION_MINOR() { return linkahead::LIBLINKAHEAD_VERSION_MINOR; } +int linkahead_constants_LIBLINKAHEAD_VERSION_MINOR() { + return linkahead::LIBLINKAHEAD_VERSION_MINOR; +} -int linkahead_constants_LIBLINKAHEAD_VERSION_PATCH() { return linkahead::LIBLINKAHEAD_VERSION_PATCH; } +int linkahead_constants_LIBLINKAHEAD_VERSION_PATCH() { + return linkahead::LIBLINKAHEAD_VERSION_PATCH; +} int linkahead_constants_COMPATIBLE_SERVER_VERSION_MAJOR() { return linkahead::COMPATIBLE_SERVER_VERSION_MAJOR; @@ -356,22 +367,21 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) -ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_connection_delete_connection(linkahead_connection_connection *connection), - { - if (connection->_deletable && connection->wrapped_connection) { - delete static_cast<linkahead::connection::Connection *>( - connection->wrapped_connection); - } - connection->wrapped_connection = nullptr; - connection->_deletable = false; - return 0; - }) +ERROR_RETURN_CODE( + GENERIC_ERROR, + int linkahead_connection_delete_connection(linkahead_connection_connection *connection), { + if (connection->_deletable && connection->wrapped_connection) { + delete static_cast<linkahead::connection::Connection *>(connection->wrapped_connection); + } + connection->wrapped_connection = nullptr; + connection->_deletable = false; + return 0; + }) ERROR_RETURN_CODE( GENERIC_ERROR, int linkahead_connection_get_version_info(linkahead_info_version_info *out, - const linkahead_connection_connection *connection), + const linkahead_connection_connection *connection), { auto *wrapped_connection = static_cast<linkahead::connection::Connection *>(connection->wrapped_connection); @@ -412,7 +422,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE( GENERIC_ERROR, int linkahead_connection_connection_manager_get_connection(linkahead_connection_connection *out, - const char *name), + const char *name), { out->wrapped_connection = linkahead::connection::ConnectionManager::GetConnection(std::string(name)).get(); @@ -427,7 +437,8 @@ ERROR_RETURN_CODE( ****************************************************************************/ ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_connection_connection_create_transaction( - linkahead_connection_connection *connection, linkahead_transaction_transaction *out), + linkahead_connection_connection *connection, + linkahead_transaction_transaction *out), { auto *wrapped_connection = static_cast<linkahead::connection::Connection *>( connection->wrapped_connection); @@ -456,15 +467,15 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return wrapped_transaction->RetrieveById(std::string(id)); }) -ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_transaction_transaction_retrieve_and_download_file_by_id( - linkahead_transaction_transaction *transaction, const char *id, const char *path), - { - auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( - transaction->wrapped_transaction); - return wrapped_transaction->RetrieveAndDownloadFileById(std::string(id), - std::string(path)); - }) +ERROR_RETURN_CODE( + GENERIC_ERROR, + int linkahead_transaction_transaction_retrieve_and_download_file_by_id( + linkahead_transaction_transaction *transaction, const char *id, const char *path), + { + auto *wrapped_transaction = + static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); + return wrapped_transaction->RetrieveAndDownloadFileById(std::string(id), std::string(path)); + }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_transaction_transaction_retrieve_by_ids( @@ -484,29 +495,31 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return wrapped_transaction->Query(std::string(query)); }) -ERROR_RETURN_CODE( - GENERIC_ERROR, - int linkahead_transaction_transaction_insert_entity(linkahead_transaction_transaction *transaction, - linkahead_entity_entity *entity), - { - auto *wrapped_transaction = - static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); - auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_transaction_transaction_insert_entity( + linkahead_transaction_transaction *transaction, + linkahead_entity_entity *entity), + { + auto *wrapped_transaction = 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); - }) + return wrapped_transaction->InsertEntity(wrapped_entity); + }) -ERROR_RETURN_CODE( - GENERIC_ERROR, - int linkahead_transaction_transaction_update_entity(linkahead_transaction_transaction *transaction, - linkahead_entity_entity *entity), - { - auto *wrapped_transaction = - static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); - auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_transaction_transaction_update_entity( + linkahead_transaction_transaction *transaction, + linkahead_entity_entity *entity), + { + auto *wrapped_transaction = 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); - }) + return wrapped_transaction->UpdateEntity(wrapped_entity); + }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_transaction_transaction_delete_by_id( @@ -528,30 +541,30 @@ ERROR_RETURN_CODE( return status.GetCode(); }) -ERROR_RETURN_CODE( - GENERIC_ERROR, - int linkahead_transaction_transaction_get_result_set(linkahead_transaction_transaction *transaction, - linkahead_transaction_result_set *out), - { - auto *wrapped_transaction = - static_cast<linkahead::transaction::Transaction *>(transaction->wrapped_transaction); - out->wrapped_result_set = (void *)(&(wrapped_transaction->GetResultSet())); - out->_deletable = false; - return 0; - }) +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_transaction_transaction_get_result_set( + linkahead_transaction_transaction *transaction, + linkahead_transaction_result_set *out), + { + auto *wrapped_transaction = static_cast<linkahead::transaction::Transaction *>( + transaction->wrapped_transaction); + out->wrapped_result_set = (void *)(&(wrapped_transaction->GetResultSet())); + out->_deletable = false; + return 0; + }) -ERROR_RETURN_CODE( - GENERIC_ERROR, - int linkahead_transaction_transaction_release_result_set(linkahead_transaction_transaction *transaction, - linkahead_transaction_result_set *out), - { - auto *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; - return 0; - }) +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_transaction_transaction_release_result_set( + linkahead_transaction_transaction *transaction, + linkahead_transaction_result_set *out), + { + auto *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; + return 0; + }) ERROR_RETURN_CODE( GENERIC_ERROR, @@ -575,21 +588,21 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) -ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_transaction_result_set_at(linkahead_transaction_result_set *result_set, - linkahead_entity_entity *entity, int index), - { - 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; - }) +ERROR_RETURN_CODE( + GENERIC_ERROR, + int linkahead_transaction_result_set_at(linkahead_transaction_result_set *result_set, + linkahead_entity_entity *entity, int index), + { + 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; + }) ERROR_RETURN_CODE( GENERIC_ERROR, int linkahead_transaction_result_set_release_at(linkahead_transaction_result_set *result_set, - linkahead_entity_entity *entity, int index), + linkahead_entity_entity *entity, int index), { auto *wrapped_result_set = static_cast<linkahead::transaction::MultiResultSet *>(result_set->wrapped_result_set); @@ -601,7 +614,8 @@ ERROR_RETURN_CODE( ERROR_RETURN_CODE( GENERIC_ERROR, - int linkahead_transaction_result_set_size(linkahead_transaction_result_set *result_set, int *out), { + int linkahead_transaction_result_set_size(linkahead_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()); @@ -624,20 +638,22 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_delete_entity(linkahead_en return 0; }) -ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_create_property(linkahead_entity_property *out), { - out->wrapped_property = new linkahead::entity::Property(); - out->_deletable = true; - return 0; -}) +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_entity_create_property(linkahead_entity_property *out), { + out->wrapped_property = new linkahead::entity::Property(); + out->_deletable = true; + return 0; + }) -ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_delete_property(linkahead_entity_property *out), { - if (out->_deletable && out->wrapped_property) { - delete static_cast<linkahead::entity::Property *>(out->wrapped_property); - } - out->wrapped_property = nullptr; - out->_deletable = false; - return 0; -}) +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_entity_delete_property(linkahead_entity_property *out), { + if (out->_deletable && out->wrapped_property) { + delete static_cast<linkahead::entity::Property *>(out->wrapped_property); + } + out->wrapped_property = nullptr; + out->_deletable = false; + return 0; + }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_create_parent(linkahead_entity_parent *out), { out->wrapped_parent = new linkahead::entity::Parent(); @@ -656,7 +672,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_delete_parent(linkahead_en ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_create_atomic_datatype(linkahead_entity_datatype *out, - const char *name), + const char *name), { try { auto enum_value = ENUM_VALUE_FROM_NAME(std::string(name), AtomicDataType); @@ -670,7 +686,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_create_reference_datatype(linkahead_entity_datatype *out, - const char *name), + const char *name), { out->wrapped_datatype = new linkahead::entity::DataType(std::string(name)); out->_deletable = true; @@ -678,7 +694,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_create_atomic_list_datatype(linkahead_entity_datatype *out, - const char *name), + const char *name), { try { auto enum_value = ENUM_VALUE_FROM_NAME(std::string(name), AtomicDataType); @@ -692,8 +708,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, } }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_create_reference_list_datatype(linkahead_entity_datatype *out, - const char *name), + int linkahead_entity_create_reference_list_datatype( + linkahead_entity_datatype *out, const char *name), { out->wrapped_datatype = new linkahead::entity::DataType( linkahead::entity::DataType::ListOf(std::string(name))); @@ -701,14 +717,15 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) -ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_delete_datatype(linkahead_entity_datatype *out), { - if (out->_deletable && out->wrapped_datatype) { - delete WRAPPED_DATATYPE_CAST(out); - } - out->wrapped_datatype = nullptr; - out->_deletable = false; - return 0; -}) +ERROR_RETURN_CODE(GENERIC_ERROR, + int linkahead_entity_delete_datatype(linkahead_entity_datatype *out), { + if (out->_deletable && out->wrapped_datatype) { + delete WRAPPED_DATATYPE_CAST(out); + } + out->wrapped_datatype = nullptr; + out->_deletable = false; + return 0; + }) CREATE_VALUE(int_value, const int64_t value) CREATE_VALUE(string_value, const char *value) @@ -730,7 +747,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_delete_value(linkahead_ent LINKAHEAD_ENTITY_GET(id, GetId()) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_get_role(linkahead_entity_entity *entity, char **out), { + int linkahead_entity_entity_get_role(linkahead_entity_entity *entity, char **out), + { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); std::string role_str = ENUM_NAME_FROM_VALUE(wrapped_entity->GetRole(), Role); auto *tmp = (char *)malloc(sizeof(char) * role_str.length() + 1); @@ -741,7 +759,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) LINKAHEAD_ENTITY_GET(name, GetName()) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_get_local_path(linkahead_entity_entity *entity, char **out), + int linkahead_entity_entity_get_local_path(linkahead_entity_entity *entity, + char **out), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); auto path = wrapped_entity->GetLocalPath().string(); @@ -755,7 +774,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, LINKAHEAD_ENTITY_GET(description, GetDescription()) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_datatype(linkahead_entity_entity *entity, - linkahead_entity_datatype *out), + linkahead_entity_datatype *out), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); out->wrapped_datatype = (void *)(&(wrapped_entity->GetDataType())); @@ -764,7 +783,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_value(linkahead_entity_entity *entity, - linkahead_entity_value *out), + linkahead_entity_value *out), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); out->wrapped_value = (void *)(&(wrapped_entity->GetValue())); @@ -776,7 +795,8 @@ LINKAHEAD_ENTITY_GET(unit, GetUnit()) LINKAHEAD_ENTITY_GET(version_id, GetVersionId()) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_get_errors_size(linkahead_entity_entity *entity, int *out), + int linkahead_entity_entity_get_errors_size(linkahead_entity_entity *entity, + int *out), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -786,7 +806,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_error(linkahead_entity_entity *entity, - linkahead_entity_message *out, int index), + linkahead_entity_message *out, int index), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -797,7 +817,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_warnings_size(linkahead_entity_entity *entity, - int *out), + int *out), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -807,7 +827,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_warning(linkahead_entity_entity *entity, - linkahead_entity_message *out, int index), + linkahead_entity_message *out, int index), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -817,7 +837,9 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_get_infos_size(linkahead_entity_entity *entity, int *out), { + int linkahead_entity_entity_get_infos_size(linkahead_entity_entity *entity, + int *out), + { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); *out = wrapped_entity->GetInfos().size(); @@ -826,7 +848,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_info(linkahead_entity_entity *entity, - linkahead_entity_message *out, int index), + linkahead_entity_message *out, int index), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -837,7 +859,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_properties_size(linkahead_entity_entity *entity, - int *out), + int *out), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -847,7 +869,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_property(linkahead_entity_entity *entity, - linkahead_entity_property *out, int index), + linkahead_entity_property *out, + int index), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -857,7 +880,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_get_parents_size(linkahead_entity_entity *entity, int *out), + int linkahead_entity_entity_get_parents_size(linkahead_entity_entity *entity, + int *out), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -867,7 +891,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_get_parent(linkahead_entity_entity *entity, - linkahead_entity_parent *out, int index), + linkahead_entity_parent *out, int index), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -886,7 +910,7 @@ LINKAHEAD_PROPERTY_GET(description, GetDescription()) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_property_get_importance(linkahead_entity_property *property, - char **out), + char **out), { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); std::string importance_str = @@ -899,7 +923,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_property_get_datatype(linkahead_entity_property *property, - linkahead_entity_datatype *out), + linkahead_entity_datatype *out), { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); out->wrapped_datatype = (void *)(&(wrapped_property->GetDataType())); @@ -908,7 +932,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_property_get_value(linkahead_entity_property *property, - linkahead_entity_value *out), + linkahead_entity_value *out), { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); out->wrapped_value = (void *)(&(wrapped_property->GetValue())); @@ -918,7 +942,9 @@ ERROR_RETURN_CODE(GENERIC_ERROR, LINKAHEAD_PROPERTY_GET(unit, GetUnit()) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_message_get_code(linkahead_entity_message *message, int *out), { + int linkahead_entity_message_get_code(linkahead_entity_message *message, + int *out), + { auto *wrapped_message = static_cast<linkahead::entity::Message *>(message->wrapped_message); *out = wrapped_message->GetCode(); @@ -938,14 +964,15 @@ ERROR_RETURN_CODE( ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_datatype_is_undefined(linkahead_entity_datatype *datatype, - bool *out), + bool *out), { auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); *out = wrapped_datatype->IsUndefined(); return 0; }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_datatype_is_atomic(linkahead_entity_datatype *datatype, bool *out), + int linkahead_entity_datatype_is_atomic(linkahead_entity_datatype *datatype, + bool *out), { auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); *out = wrapped_datatype->IsAtomic(); @@ -953,28 +980,27 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_datatype_is_reference(linkahead_entity_datatype *datatype, - bool *out), + bool *out), { auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); *out = wrapped_datatype->IsReference(); return 0; }) +ERROR_RETURN_CODE( + GENERIC_ERROR, + int linkahead_entity_datatype_is_list_of_atomic(linkahead_entity_datatype *datatype, bool *out), { + auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); + if (wrapped_datatype->IsList()) { + const auto &list_datatype = wrapped_datatype->GetAsList(); + *out = list_datatype.IsListOfAtomic(); + } else { + *out = false; + } + return 0; + }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_datatype_is_list_of_atomic(linkahead_entity_datatype *datatype, - bool *out), - { - auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); - if (wrapped_datatype->IsList()) { - const auto &list_datatype = wrapped_datatype->GetAsList(); - *out = list_datatype.IsListOfAtomic(); - } else { - *out = false; - } - return 0; - }) -ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_datatype_is_list_of_reference(linkahead_entity_datatype *datatype, - bool *out), + int linkahead_entity_datatype_is_list_of_reference( + linkahead_entity_datatype *datatype, bool *out), { auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); if (wrapped_datatype->IsList()) { @@ -987,7 +1013,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE( GENERIC_ERROR, - int linkahead_entity_datatype_get_datatype_name(linkahead_entity_datatype *datatype, char **out), { + int linkahead_entity_datatype_get_datatype_name(linkahead_entity_datatype *datatype, char **out), + { auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); std::string datatype_name; if (wrapped_datatype->IsList()) { @@ -1019,7 +1046,9 @@ VALUE_IS(bool, IsBool) VALUE_IS(vector, IsVector) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_value_get_as_string(linkahead_entity_value *value, char **out), { + int linkahead_entity_value_get_as_string(linkahead_entity_value *value, + char **out), + { auto *wrapped_value = WRAPPED_VALUE_CAST(value); auto *tmp = (char *)malloc(sizeof(char) * wrapped_value->GetAsString().length() + 1); @@ -1034,8 +1063,8 @@ VALUE_GET_AS(bool, GetAsBool, bool *out) VALUE_GET_AS(vector_size, GetAsVector().size, int *out) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_value_get_as_vector_at(linkahead_entity_value *value, - linkahead_entity_value *out, - const int index), + linkahead_entity_value *out, + const int index), { auto *wrapped_value = WRAPPED_VALUE_CAST(value); out->wrapped_value = (void *)(&(wrapped_value->GetAsVector().at(index))); @@ -1043,7 +1072,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_set_role(linkahead_entity_entity *entity, const char *role), + int linkahead_entity_entity_set_role(linkahead_entity_entity *entity, + const char *role), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); try { @@ -1057,14 +1087,14 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) 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));) + return wrapped_entity->SetLocalPath(std::filesystem::path(local_path));) 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));) + wrapped_entity->SetDescription(std::string(description));) LINKAHEAD_ENTITY_SET(unit, unit, wrapped_entity->SetUnit(std::string(unit));) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_set_datatype(linkahead_entity_entity *entity, - linkahead_entity_datatype *datatype), + linkahead_entity_datatype *datatype), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); @@ -1073,7 +1103,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_set_value(linkahead_entity_entity *entity, - linkahead_entity_value *value), + linkahead_entity_value *value), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); auto *wrapped_value = WRAPPED_VALUE_CAST(value); @@ -1083,7 +1113,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_append_parent(linkahead_entity_entity *entity, - linkahead_entity_parent *parent), + linkahead_entity_parent *parent), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -1094,7 +1124,9 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_remove_parent(linkahead_entity_entity *entity, int index), { + int linkahead_entity_entity_remove_parent(linkahead_entity_entity *entity, + int index), + { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); wrapped_entity->RemoveParent(index); @@ -1103,7 +1135,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_entity_append_property(linkahead_entity_entity *entity, - linkahead_entity_property *property), + linkahead_entity_property *property), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -1113,7 +1145,8 @@ ERROR_RETURN_CODE(GENERIC_ERROR, return 0; }) ERROR_RETURN_CODE(GENERIC_ERROR, - int linkahead_entity_entity_remove_property(linkahead_entity_entity *entity, int index), + int linkahead_entity_entity_remove_property(linkahead_entity_entity *entity, + int index), { auto *wrapped_entity = static_cast<linkahead::entity::Entity *>(entity->wrapped_entity); @@ -1128,7 +1161,7 @@ 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 linkahead_entity_property_set_datatype(linkahead_entity_property *property, - linkahead_entity_datatype *datatype), + linkahead_entity_datatype *datatype), { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); auto *wrapped_datatype = WRAPPED_DATATYPE_CAST(datatype); @@ -1137,7 +1170,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, }) ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_property_set_value(linkahead_entity_property *property, - linkahead_entity_value *value), + linkahead_entity_value *value), { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); auto *wrapped_value = WRAPPED_VALUE_CAST(value); @@ -1147,7 +1180,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR, int linkahead_entity_property_set_importance(linkahead_entity_property *property, - const char *importance), + const char *importance), { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); try { diff --git a/src/clinkaheadcli.c b/src/clinkaheadcli.c index 1232a41f9f371162e6734887b0b2d8205cb3fb4b..34ea16c4add6f030a49d9a177cbd4becb0eacd3e 100644 --- a/src/clinkaheadcli.c +++ b/src/clinkaheadcli.c @@ -4,8 +4,8 @@ int main(void) { int status = 0; // last function return value - printf("LinkAhead C client (liblinkahead %d.%d.%d)\n\n", - LIBLINKAHEAD_VERSION_MAJOR, LIBLINKAHEAD_VERSION_MINOR, LIBLINKAHEAD_VERSION_PATCH); + printf("LinkAhead C client (liblinkahead %d.%d.%d)\n\n", LIBLINKAHEAD_VERSION_MAJOR, + LIBLINKAHEAD_VERSION_MINOR, LIBLINKAHEAD_VERSION_PATCH); linkahead_connection_connection connection; status = linkahead_connection_connection_manager_get_default_connection(&connection); diff --git a/src/cxxlinkaheadcli.cpp b/src/cxxlinkaheadcli.cpp index d7d6c6c6d6bf5505c44bd8384e76242aa5786ef8..8b3b7f918505fa1c4613614eb1dd26f7dcb491b4 100644 --- a/src/cxxlinkaheadcli.cpp +++ b/src/cxxlinkaheadcli.cpp @@ -45,7 +45,7 @@ auto main() -> int { std::cout << "LinkAhead C++ client (liblinkahead " << linkahead::LIBLINKAHEAD_VERSION_MINOR << "." << linkahead::LIBLINKAHEAD_VERSION_MINOR << "." << linkahead::LIBLINKAHEAD_VERSION_PATCH - << ")\n" + << ")\n" << std::endl; try { @@ -63,8 +63,8 @@ auto main() -> int { transaction->RetrieveById("21"); transaction->ExecuteAsynchronously(); auto t_stat = transaction->WaitForIt(); - LINKAHEAD_LOG_INFO(logger_name) << "status: " << t_stat.GetCode() << " // " - << t_stat.GetDescription(); + LINKAHEAD_LOG_INFO(logger_name) + << "status: " << t_stat.GetCode() << " // " << t_stat.GetDescription(); const auto &result_set = transaction->GetResultSet(); for (const auto &entity : result_set) { std::cout << entity.ToString() << std::endl; @@ -77,8 +77,8 @@ auto main() -> int { q_transaction->Query(query); q_transaction->ExecuteAsynchronously(); t_stat = q_transaction->WaitForIt(); - LINKAHEAD_LOG_INFO(logger_name) << "status: " << t_stat.GetCode() << " // " - << t_stat.GetDescription(); + 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) { std::cout << entity.ToString() << std::endl; diff --git a/src/linkahead/configuration.cpp b/src/linkahead/configuration.cpp index f68cea40eb2253ccbe73903e3080f3fb588c0bc9..481fb09224b542f8aed01b5a71b89cd3f0537a69 100644 --- a/src/linkahead/configuration.cpp +++ b/src/linkahead/configuration.cpp @@ -361,8 +361,8 @@ auto ConfigurationManager::mReset() noexcept -> int { } catch (const linkahead::exceptions::Exception &exc) { return exc.GetCode(); } catch (const std::exception &exc) { - LINKAHEAD_LOG_ERROR(logger_name) << "Unknown error during the reset of the ConfigurationManager: " - << exc.what(); + LINKAHEAD_LOG_ERROR(logger_name) + << "Unknown error during the reset of the ConfigurationManager: " << exc.what(); return StatusCode::CONFIGURATION_ERROR; } } @@ -375,8 +375,8 @@ auto ConfigurationManager::mClear() noexcept -> int { } catch (const linkahead::exceptions::Exception &exc) { return exc.GetCode(); } catch (const std::exception &exc) { - LINKAHEAD_LOG_ERROR(logger_name) << "Unknown error during the reset of the ConfigurationManager: " - << exc.what(); + LINKAHEAD_LOG_ERROR(logger_name) + << "Unknown error during the reset of the ConfigurationManager: " << exc.what(); return StatusCode::CONFIGURATION_ERROR; } } @@ -480,13 +480,13 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT } else { logging::initialize_logging_defaults(); LINKAHEAD_LOG_INFO(logger_name) << "No logging configuration has been found. " - "We are using the default configuration"; + "We are using the default configuration"; } if (configuration_file_path != nullptr && this->json_configuration.wrapped && WRAPPED_JSON_CONFIGURATION(this)->is_object()) { - LINKAHEAD_LOG_INFO(logger_name) << "Loaded configuration from " << *(configuration_file_path) - << "."; + LINKAHEAD_LOG_INFO(logger_name) + << "Loaded configuration from " << *(configuration_file_path) << "."; } return 0; diff --git a/src/linkahead/file_transmission/download_request_handler.cpp b/src/linkahead/file_transmission/download_request_handler.cpp index 142b3716a34ba0b168fbf9effc7edef6d06566ab..1d8d03b56cec5abeb2fbe40e38cc9d6c8f817102 100644 --- a/src/linkahead/file_transmission/download_request_handler.cpp +++ b/src/linkahead/file_transmission/download_request_handler.cpp @@ -121,9 +121,9 @@ void DownloadRequestHandler::Cancel() { } void DownloadRequestHandler::handleNewCallState() { - LINKAHEAD_LOG_TRACE(logger_name) << "Enter DownloadRequestHandler::handleNewCallState. local_path = " - << file_descriptor_.local_path - << ", download_id = " << file_descriptor_.file_transmission_id; + 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); auto *tid = request_->mutable_file_transmission_id(); @@ -169,18 +169,18 @@ void DownloadRequestHandler::handleCallCompleteState() { switch (status_.error_code()) { case grpc::OK: { - LINKAHEAD_LOG_INFO(logger_name) << "DownloadRequestHandler finished successfully (" - << file_descriptor_.local_path << "): Download complete, " - << bytesReceived_ << " bytes received."; + LINKAHEAD_LOG_INFO(logger_name) + << "DownloadRequestHandler finished successfully (" << file_descriptor_.local_path + << "): Download complete, " << bytesReceived_ << " bytes received."; } 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); - LINKAHEAD_LOG_ERROR(logger_name) << "DownloadRequestHandler finished with an error (" - << file_descriptor_.local_path << "): Download aborted with code " - << code << " - " << description; + LINKAHEAD_LOG_ERROR(logger_name) + << "DownloadRequestHandler finished with an error (" << file_descriptor_.local_path + << "): Download aborted with code " << code << " - " << description; } break; } diff --git a/src/linkahead/file_transmission/upload_request_handler.cpp b/src/linkahead/file_transmission/upload_request_handler.cpp index a1134a9204c0cb723ea7a37829ef9de82439f6be..4ed652782fa641ec8e4b0de882b579495cacc08d 100644 --- a/src/linkahead/file_transmission/upload_request_handler.cpp +++ b/src/linkahead/file_transmission/upload_request_handler.cpp @@ -179,18 +179,18 @@ void UploadRequestHandler::handleCallCompleteState() { switch (status_.error_code()) { case grpc::OK: { auto bytesSent = fileReader_ != nullptr ? fileReader_->fileSize() : 0; - LINKAHEAD_LOG_INFO(logger_name) << "UploadRequestHandler finished successfully (" - << file_descriptor_.local_path << "): upload complete, " - << bytesSent << " bytes sent"; + LINKAHEAD_LOG_INFO(logger_name) + << "UploadRequestHandler finished successfully (" << file_descriptor_.local_path + << "): upload complete, " << bytesSent << " bytes sent"; } 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); - LINKAHEAD_LOG_ERROR(logger_name) << "UploadRequestHandler finished with an error (" - << file_descriptor_.local_path << "): Upload aborted with code " - << code << " - " << description; + LINKAHEAD_LOG_ERROR(logger_name) + << "UploadRequestHandler finished with an error (" << file_descriptor_.local_path + << "): Upload aborted with code " << code << " - " << description; } break; } diff --git a/src/linkahead/unary_rpc_handler.cpp b/src/linkahead/unary_rpc_handler.cpp index e202c35ab588aa4d9569f0fc9fcaa6feee7c03da..86c3588a53240e7a914bf5ea2f23bc09da003183 100644 --- a/src/linkahead/unary_rpc_handler.cpp +++ b/src/linkahead/unary_rpc_handler.cpp @@ -66,7 +66,8 @@ bool UnaryRpcHandler::OnNext(bool ok) { return false; } } else { - LINKAHEAD_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 @@ -115,8 +116,8 @@ void UnaryRpcHandler::handleCallCompleteState() { std::string description(get_status_description(code) + " Original message: " + status_.error_message()); transaction_status = TransactionStatus(code, description); - LINKAHEAD_LOG_ERROR(logger_name) << "UnaryRpcHandler finished with an error (Code " << code - << "): " << description; + LINKAHEAD_LOG_ERROR(logger_name) + << "UnaryRpcHandler finished with an error (Code " << code << "): " << description; break; } }