Compare commits

...

3 Commits

Author SHA1 Message Date
Marko Budiselic
d2f85d9a42 The ASIO fix 2023-04-19 14:51:08 +00:00
Marko Budiselic
a6e51639f9 Add more 2022-09-20 14:53:26 +02:00
Marko Budiselic
0b716f2a8f Add part of dummy fixes 2022-09-18 09:05:29 +02:00
34 changed files with 440 additions and 189 deletions

View File

@ -26,14 +26,14 @@ endif(CCACHE_FOUND AND USE_CCACHE)
# choose a compiler # choose a compiler
# NOTE: must be choosen before use of project() or enable_language() # NOTE: must be choosen before use of project() or enable_language()
find_program(CLANG_FOUND clang) # find_program(CLANG_FOUND clang)
find_program(CLANGXX_FOUND clang++) # find_program(CLANGXX_FOUND clang++)
if (CLANG_FOUND AND CLANGXX_FOUND) # if (CLANG_FOUND AND CLANGXX_FOUND)
set(CMAKE_C_COMPILER ${CLANG_FOUND}) # set(CMAKE_C_COMPILER ${CLANG_FOUND})
set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND}) # set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND})
else() # else()
message(FATAL_ERROR "Couldn't find clang and/or clang++!") # message(FATAL_ERROR "Couldn't find clang and/or clang++!")
endif() # endif()
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -179,12 +179,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# c99-designator is disabled because of required mixture of designated and # TODO(gitbuda): Add support for both clang and GCC with the valid flags.
# non-designated initializers in Python Query Module code (`py_module.cpp`). set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
-Werror=switch -Werror=switch-bool -Werror=return-type \
-Werror=return-stack-address \
-Wno-c99-designator \
-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT") -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT")
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug. # Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.

View File

@ -79,6 +79,7 @@ inline nlohmann::json PropertyValueToJson(const storage::PropertyValue &pv) {
return ss.str(); return ss.str();
} }
} }
throw 1;
}; };
ret = to_string(temporal_data); ret = to_string(temporal_data);
break; break;

View File

@ -88,6 +88,7 @@ std::string PermissionToString(Permission permission) {
case Permission::WEBSOCKET: case Permission::WEBSOCKET:
return "WEBSOCKET"; return "WEBSOCKET";
} }
return "";
} }
std::string PermissionLevelToString(PermissionLevel level) { std::string PermissionLevelToString(PermissionLevel level) {
@ -99,6 +100,7 @@ std::string PermissionLevelToString(PermissionLevel level) {
case PermissionLevel::DENY: case PermissionLevel::DENY:
return "DENY"; return "DENY";
} }
return "";
} }
#ifdef MG_ENTERPRISE #ifdef MG_ENTERPRISE
@ -129,6 +131,7 @@ std::string FineGrainedPermissionToString(const FineGrainedPermission level) {
case FineGrainedPermission::NOTHING: case FineGrainedPermission::NOTHING:
return "NOTHING"; return "NOTHING";
} }
return "";
} }
FineGrainedAccessPermissions Merge(const FineGrainedAccessPermissions &first, FineGrainedAccessPermissions Merge(const FineGrainedAccessPermissions &first,

View File

@ -122,7 +122,7 @@ class Client final {
const std::optional<std::string> &db); const std::optional<std::string> &db);
private: private:
using ClientEncoder = ClientEncoder<ChunkedEncoderBuffer<communication::ClientOutputStream>>; using ClientEncoderX = ClientEncoder<ChunkedEncoderBuffer<communication::ClientOutputStream>>;
template <typename TException = FailureResponseException> template <typename TException = FailureResponseException>
[[noreturn]] void HandleFailure(const std::map<std::string, Value> &response_map) { [[noreturn]] void HandleFailure(const std::map<std::string, Value> &response_map) {
@ -153,6 +153,6 @@ class Client final {
// encoder objects // encoder objects
ChunkedEncoderBuffer<communication::ClientOutputStream> encoder_buffer_{output_stream_}; ChunkedEncoderBuffer<communication::ClientOutputStream> encoder_buffer_{output_stream_};
ClientEncoder encoder_{encoder_buffer_}; ClientEncoderX encoder_{encoder_buffer_};
}; };
} // namespace memgraph::communication::bolt } // namespace memgraph::communication::bolt

View File

@ -425,6 +425,7 @@ std::ostream &operator<<(std::ostream &os, const Value &value) {
case Value::Type::Duration: case Value::Type::Duration:
return os << value.ValueDuration(); return os << value.ValueDuration();
} }
return os;
} }
std::ostream &operator<<(std::ostream &os, const Value::Type type) { std::ostream &operator<<(std::ostream &os, const Value::Type type) {
@ -460,5 +461,6 @@ std::ostream &operator<<(std::ostream &os, const Value::Type type) {
case Value::Type::Duration: case Value::Type::Duration:
return os << "duration"; return os << "duration";
} }
return os;
} }
} // namespace memgraph::communication::bolt } // namespace memgraph::communication::bolt

View File

@ -207,8 +207,9 @@ class Listener final {
CloseSession(session); CloseSession(session);
} else { } else {
// Unhandled epoll event. // Unhandled epoll event.
spdlog::error("Unhandled event occured in {} session associated with {} events: {}", service_name_, // TODO: GCC can't compile
session.socket().endpoint(), event.events); // spdlog::error("Unhandled event occured in {} session associated with {} events: {}", service_name_,
// session.socket().endpoint(), event.events);
CloseSession(session); CloseSession(session);
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright 2022 Memgraph Ltd. // Copyright 2023 Memgraph Ltd.
// //
// Use of this software is governed by the Business Source License // Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -65,8 +65,9 @@ Listener::Listener(boost::asio::io_context &ioc, ServerContext *context, tcp::en
} }
void Listener::DoAccept() { void Listener::DoAccept() {
acceptor_.async_accept( acceptor_.async_accept(ioc_, [shared_this = shared_from_this()](boost::beast::error_code ec, tcp::socket socket) {
ioc_, [shared_this = shared_from_this()](auto ec, auto socket) { shared_this->OnAccept(ec, std::move(socket)); }); shared_this->OnAccept(ec, std::move(socket));
});
} }
void Listener::OnAccept(boost::beast::error_code ec, tcp::socket socket) { void Listener::OnAccept(boost::beast::error_code ec, tcp::socket socket) {

View File

@ -66,6 +66,7 @@ bool TypedValueCompare(const TypedValue &a, const TypedValue &b) {
case TypedValue::Type::Null: case TypedValue::Type::Null:
LOG_FATAL("Invalid type"); LOG_FATAL("Invalid type");
} }
throw 1;
} }
} // namespace impl } // namespace impl

View File

@ -1438,6 +1438,7 @@ cpp<#
case Type::SINGLE: case Type::SINGLE:
return false; return false;
} }
throw 1;
} }
cpp<#) cpp<#)
(:protected (:protected

View File

@ -539,6 +539,7 @@ std::string_view ToString(const CommonStreamConfigKey key) {
case CommonStreamConfigKey::END: case CommonStreamConfigKey::END:
LOG_FATAL("Invalid config key used"); LOG_FATAL("Invalid config key used");
} }
throw 1;
} }
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
@ -563,6 +564,7 @@ std::string_view ToString(const KafkaConfigKey key) {
case KafkaConfigKey::CREDENTIALS: case KafkaConfigKey::CREDENTIALS:
return "CREDENTIALS"; return "CREDENTIALS";
} }
throw 1;
} }
void MapCommonStreamConfigs(auto &memory, StreamQuery &stream_query) { void MapCommonStreamConfigs(auto &memory, StreamQuery &stream_query) {
@ -689,6 +691,7 @@ std::string_view ToString(const PulsarConfigKey key) {
case PulsarConfigKey::SERVICE_URL: case PulsarConfigKey::SERVICE_URL:
return "SERVICE_URL"; return "SERVICE_URL";
} }
throw 1;
} }
} // namespace } // namespace

View File

@ -590,6 +590,7 @@ TypedValue ValueType(const TypedValue *args, int64_t nargs, const FunctionContex
case TypedValue::Type::Graph: case TypedValue::Type::Graph:
throw QueryRuntimeException("Cannot fetch graph as it is not standardized openCypher type name"); throw QueryRuntimeException("Cannot fetch graph as it is not standardized openCypher type name");
} }
throw 1;
} }
// TODO: How is Keys different from Properties function? // TODO: How is Keys different from Properties function?

View File

@ -476,6 +476,7 @@ Callback HandleAuthQuery(AuthQuery *auth_query, AuthQueryHandler *auth, const Pa
default: default:
break; break;
} }
throw 1;
} // namespace } // namespace
Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &parameters, Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &parameters,
@ -525,6 +526,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &
return std::vector<std::vector<TypedValue>>{{TypedValue("replica")}}; return std::vector<std::vector<TypedValue>>{{TypedValue("replica")}};
} }
} }
throw 1;
}; };
return callback; return callback;
} }
@ -605,6 +607,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &
return callback; return callback;
} }
} }
throw 1;
} }
std::optional<std::string> StringPointerToOptional(const std::string *str) { std::optional<std::string> StringPointerToOptional(const std::string *str) {
@ -836,6 +839,7 @@ Callback HandleStreamQuery(StreamQuery *stream_query, const Parameters &paramete
return callback; return callback;
} }
} }
throw 1;
} }
Callback HandleConfigQuery() { Callback HandleConfigQuery() {
@ -948,6 +952,7 @@ Callback HandleSettingQuery(SettingQuery *setting_query, const Parameters &param
return callback; return callback;
} }
} }
throw 1;
} }
// Struct for lazy pulling from a vector // Struct for lazy pulling from a vector
@ -1686,6 +1691,7 @@ TriggerEventType ToTriggerEventType(const TriggerQuery::EventType event_type) {
case TriggerQuery::EventType::EDGE_UPDATE: case TriggerQuery::EventType::EDGE_UPDATE:
return TriggerEventType::EDGE_UPDATE; return TriggerEventType::EDGE_UPDATE;
} }
throw 1;
} }
Callback CreateTrigger(TriggerQuery *trigger_query, Callback CreateTrigger(TriggerQuery *trigger_query,
@ -1763,6 +1769,7 @@ PreparedQuery PrepareTriggerQuery(ParsedQuery parsed_query, const bool in_explic
case TriggerQuery::Action::SHOW_TRIGGERS: case TriggerQuery::Action::SHOW_TRIGGERS:
return ShowTriggers(interpreter_context); return ShowTriggers(interpreter_context);
} }
throw 1;
}); });
return PreparedQuery{std::move(callback.header), std::move(parsed_query.required_privileges), return PreparedQuery{std::move(callback.header), std::move(parsed_query.required_privileges),
@ -1826,6 +1833,7 @@ constexpr auto ToStorageIsolationLevel(const IsolationLevelQuery::IsolationLevel
case IsolationLevelQuery::IsolationLevel::READ_UNCOMMITTED: case IsolationLevelQuery::IsolationLevel::READ_UNCOMMITTED:
return storage::IsolationLevel::READ_UNCOMMITTED; return storage::IsolationLevel::READ_UNCOMMITTED;
} }
throw 1;
} }
PreparedQuery PrepareIsolationLevelQuery(ParsedQuery parsed_query, const bool in_explicit_transaction, PreparedQuery PrepareIsolationLevelQuery(ParsedQuery parsed_query, const bool in_explicit_transaction,
@ -1849,6 +1857,7 @@ PreparedQuery PrepareIsolationLevelQuery(ParsedQuery parsed_query, const bool in
case IsolationLevelQuery::IsolationLevelScope::NEXT: case IsolationLevelQuery::IsolationLevelScope::NEXT:
return [interpreter, isolation_level] { interpreter->SetNextTransactionIsolationLevel(isolation_level); }; return [interpreter, isolation_level] { interpreter->SetNextTransactionIsolationLevel(isolation_level); };
} }
throw 1;
}(); }();
return PreparedQuery{ return PreparedQuery{
@ -2590,7 +2599,7 @@ void Interpreter::Commit() {
SPDLOG_DEBUG("Finished committing the transaction"); SPDLOG_DEBUG("Finished committing the transaction");
if (!commit_confirmed_by_all_sync_repplicas) { if (!commit_confirmed_by_all_sync_repplicas) {
throw ReplicationException("At least one SYNC replica has not confirmed committing last transaction."); throw ReplicationException(std::string("At least one SYNC replica has not confirmed committing last transaction."));
} }
} }

View File

@ -28,6 +28,7 @@ constexpr std::string_view GetSeverityLevelString(const SeverityLevel level) {
case SeverityLevel::WARNING: case SeverityLevel::WARNING:
return "WARNING"sv; return "WARNING"sv;
} }
throw 1;
} }
constexpr std::string_view GetCodeString(const NotificationCode code) { constexpr std::string_view GetCodeString(const NotificationCode code) {
@ -77,6 +78,7 @@ constexpr std::string_view GetCodeString(const NotificationCode code) {
case NotificationCode::STOP_ALL_STREAMS: case NotificationCode::STOP_ALL_STREAMS:
return "StopAllStreams"sv; return "StopAllStreams"sv;
} }
throw 1;
} }
} // namespace } // namespace
@ -112,6 +114,7 @@ std::string ExecutionStatsKeyToString(const ExecutionStats::Key key) {
case ExecutionStats::Key::UPDATED_PROPERTIES: case ExecutionStats::Key::UPDATED_PROPERTIES:
return std::string("properties-set"); return std::string("properties-set");
} }
throw 1;
} }
} // namespace memgraph::query } // namespace memgraph::query

View File

@ -377,6 +377,7 @@ bool CreateExpand::CreateExpandCursor::Pull(Frame &frame, ExecutionContext &cont
case EdgeAtom::Direction::BOTH: case EdgeAtom::Direction::BOTH:
return CreateEdge(self_.edge_info_, dba, &v1, &v2, &frame, &evaluator); return CreateEdge(self_.edge_info_, dba, &v1, &v2, &frame, &evaluator);
} }
throw 1;
}(); }();
context.execution_stats[ExecutionStats::Key::CREATED_EDGES] += 1; context.execution_stats[ExecutionStats::Key::CREATED_EDGES] += 1;
@ -565,6 +566,7 @@ UniqueCursorPtr ScanAllByLabelPropertyRange::MakeCursor(utils::MemoryResource *m
} catch (const TypedValueException &) { } catch (const TypedValueException &) {
throw QueryRuntimeException("'{}' cannot be used as a property value.", value.type()); throw QueryRuntimeException("'{}' cannot be used as a property value.", value.type());
} }
throw 1;
}; };
auto maybe_lower = convert(lower_bound_); auto maybe_lower = convert(lower_bound_);
auto maybe_upper = convert(upper_bound_); auto maybe_upper = convert(upper_bound_);
@ -723,6 +725,7 @@ bool Expand::ExpandCursor::Pull(Frame &frame, ExecutionContext &context) {
case EdgeAtom::Direction::BOTH: case EdgeAtom::Direction::BOTH:
LOG_FATAL("Must indicate exact expansion direction here"); LOG_FATAL("Must indicate exact expansion direction here");
} }
throw 1;
}; };
while (true) { while (true) {
@ -2152,6 +2155,7 @@ UniqueCursorPtr ExpandVariable::MakeCursor(utils::MemoryResource *mem) const {
case EdgeAtom::Type::SINGLE: case EdgeAtom::Type::SINGLE:
LOG_FATAL("ExpandVariable should not be planned for a single expansion!"); LOG_FATAL("ExpandVariable should not be planned for a single expansion!");
} }
throw 1;
} }
class ConstructNamedPathCursor : public Cursor { class ConstructNamedPathCursor : public Cursor {
@ -3147,6 +3151,7 @@ TypedValue DefaultAggregationOpValue(const Aggregate::Element &element, utils::M
case Aggregation::Op::PROJECT: case Aggregation::Op::PROJECT:
return TypedValue(query::Graph(memory)); return TypedValue(query::Graph(memory));
} }
throw 1;
} }
} // namespace } // namespace

View File

@ -301,6 +301,7 @@ std::string ToString(EdgeAtom::Direction dir) {
case EdgeAtom::Direction::OUT: case EdgeAtom::Direction::OUT:
return "out"; return "out";
} }
throw 1;
} }
std::string ToString(EdgeAtom::Type type) { std::string ToString(EdgeAtom::Type type) {
@ -316,6 +317,7 @@ std::string ToString(EdgeAtom::Type type) {
case EdgeAtom::Type::SINGLE: case EdgeAtom::Type::SINGLE:
return "single"; return "single";
} }
throw 1;
} }
std::string ToString(Ordering ord) { std::string ToString(Ordering ord) {
@ -325,6 +327,7 @@ std::string ToString(Ordering ord) {
case Ordering::DESC: case Ordering::DESC:
return "desc"; return "desc";
} }
throw 1;
} }
json ToJson(Expression *expression) { json ToJson(Expression *expression) {

View File

@ -123,6 +123,7 @@ std::string ReadWriteTypeChecker::TypeToString(const RWType type) {
case RWType::RW: case RWType::RW:
return "rw"; return "rw";
} }
throw 1;
} }
} // namespace memgraph::query::plan } // namespace memgraph::query::plan

View File

@ -305,6 +305,7 @@ mgp_value_type FromTypedValueType(memgraph::query::TypedValue::Type type) {
case memgraph::query::TypedValue::Type::Graph: case memgraph::query::TypedValue::Type::Graph:
throw std::logic_error{"mgp_value for TypedValue::Type::Graph doesn't exist."}; throw std::logic_error{"mgp_value for TypedValue::Type::Graph doesn't exist."};
} }
throw 1;
} }
} // namespace } // namespace
@ -361,6 +362,7 @@ memgraph::query::TypedValue ToTypedValue(const mgp_value &val, memgraph::utils::
case MGP_VALUE_TYPE_DURATION: case MGP_VALUE_TYPE_DURATION:
return memgraph::query::TypedValue(val.duration_v->duration, memory); return memgraph::query::TypedValue(val.duration_v->duration, memory);
} }
throw 1;
} }
mgp_value::mgp_value(memgraph::utils::MemoryResource *m) noexcept : type(MGP_VALUE_TYPE_NULL), memory(m) {} mgp_value::mgp_value(memgraph::utils::MemoryResource *m) noexcept : type(MGP_VALUE_TYPE_NULL), memory(m) {}
@ -1645,6 +1647,7 @@ memgraph::storage::PropertyValue ToPropertyValue(const mgp_value &value) {
case MGP_VALUE_TYPE_PATH: case MGP_VALUE_TYPE_PATH:
throw ValueConversionException{"A path is not a valid property value!"}; throw ValueConversionException{"A path is not a valid property value!"};
} }
throw 1;
} }
} // namespace } // namespace
@ -2934,6 +2937,7 @@ std::ostream &PrintValue(const TypedValue &value, std::ostream *stream) {
case TypedValue::Type::Graph: case TypedValue::Type::Graph:
LOG_FATAL("value must not be a graph element"); LOG_FATAL("value must not be a graph element");
} }
throw 1;
} }
} // namespace } // namespace
@ -3006,6 +3010,7 @@ mgp_source_type StreamSourceTypeToMgpSourceType(const StreamSourceType type) {
case StreamSourceType::PULSAR: case StreamSourceType::PULSAR:
return mgp_source_type::PULSAR; return mgp_source_type::PULSAR;
} }
throw 1;
} }
} // namespace } // namespace

View File

@ -147,7 +147,9 @@ class ModuleRegistry final {
void *handle_; void *handle_;
}; };
#if __has_feature(address_sanitizer) // TODO: Figure out for both clang and GCC
// #if __has_feature(address_sanitizer)
#if defined(__SANITIZE_ADDRESS__)
// This is why we need RTLD_NODELETE and we must not use RTLD_DEEPBIND with // This is why we need RTLD_NODELETE and we must not use RTLD_DEEPBIND with
// ASAN: https://github.com/google/sanitizers/issues/89 // ASAN: https://github.com/google/sanitizers/issues/89
SharedLibraryHandle libstd_handle{"libstdc++.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE}; SharedLibraryHandle libstd_handle{"libstdc++.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE};

View File

@ -216,16 +216,58 @@ static PyMethodDef PyVerticesIteratorMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off struct PyTypeBuilder {
static PyTypeObject PyVerticesIteratorType = { PyTypeObject object{PyVarObject_HEAD_INIT(nullptr, 0)};
PyVarObject_HEAD_INIT(nullptr, 0) constexpr PyTypeBuilder &&Name(const char *name) && {
.tp_name = "_mgp.VerticesIterator", object.tp_name = name;
.tp_basicsize = sizeof(PyVerticesIterator), return std::move(*this);
.tp_dealloc = reinterpret_cast<destructor>(PyVerticesIteratorDealloc), }
.tp_flags = Py_TPFLAGS_DEFAULT, constexpr PyTypeBuilder &&BasicSize(const size_t size) && {
.tp_doc = "Wraps struct mgp_vertices_iterator.", object.tp_basicsize = size;
.tp_methods = PyVerticesIteratorMethods, return std::move(*this);
}
constexpr PyTypeBuilder &&Dealloc(const destructor dealloc) && {
object.tp_dealloc = dealloc;
return std::move(*this);
}
constexpr PyTypeBuilder &&Flags(const unsigned long flags) && {
object.tp_flags = flags;
return std::move(*this);
}
constexpr PyTypeBuilder &&Doc(const char *doc) && {
object.tp_doc = doc;
return std::move(*this);
}
constexpr PyTypeBuilder &&Methods(struct PyMethodDef *methods) && {
object.tp_methods = methods;
return std::move(*this);
}
constexpr PyTypeBuilder &&RichCompare(const richcmpfunc richcmp) && {
object.tp_richcompare = richcmp;
return std::move(*this);
}
constexpr PyTypeObject Build() const && { return object; }
}; };
static PyTypeObject PyVerticesIteratorType = PyTypeBuilder{}
.Name("_mgp.VerticesIterator")
.BasicSize(sizeof(PyVerticesIterator))
.Dealloc(reinterpret_cast<destructor>(PyVerticesIteratorDealloc))
.Flags(Py_TPFLAGS_DEFAULT)
.Doc("Wraps struct mgp_vertices_iterator.")
.Methods(PyVerticesIteratorMethods)
.Build();
// clang-format off
// static PyTypeObject PyVerticesIteratorType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.VerticesIterator",
// .tp_basicsize = sizeof(PyVerticesIterator),
// .tp_dealloc = reinterpret_cast<destructor>(PyVerticesIteratorDealloc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_vertices_iterator.",
// .tp_methods = PyVerticesIteratorMethods,
// };
// clang-format on // clang-format on
// clang-format off // clang-format off
@ -288,17 +330,26 @@ static PyMethodDef PyEdgesIteratorMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyEdgesIteratorType = PyTypeBuilder{}
static PyTypeObject PyEdgesIteratorType = { .Name("_mgp.EdgesIterator")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyEdgesIterator))
.tp_name = "_mgp.EdgesIterator", .Dealloc(reinterpret_cast<destructor>(PyEdgesIteratorDealloc))
.tp_basicsize = sizeof(PyEdgesIterator), .Flags(Py_TPFLAGS_DEFAULT)
.tp_dealloc = reinterpret_cast<destructor>(PyEdgesIteratorDealloc), .Doc("Wraps struct mgp_edges_iterator.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyEdgesIteratorMethods)
.tp_doc = "Wraps struct mgp_edges_iterator.", .Build();
.tp_methods = PyEdgesIteratorMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyEdgesIteratorType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.EdgesIterator",
// .tp_basicsize = sizeof(PyEdgesIterator),
// .tp_dealloc = reinterpret_cast<destructor>(PyEdgesIteratorDealloc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_edges_iterator.",
// .tp_methods = PyEdgesIteratorMethods,
// };
// // clang-format on
PyObject *PyGraphInvalidate(PyGraph *self, PyObject *Py_UNUSED(ignored)) { PyObject *PyGraphInvalidate(PyGraph *self, PyObject *Py_UNUSED(ignored)) {
self->graph = nullptr; self->graph = nullptr;
@ -404,16 +455,24 @@ static PyMethodDef PyGraphMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyGraphType = PyTypeBuilder{}
static PyTypeObject PyGraphType = { .Name("_mgp.Graph")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyGraph))
.tp_name = "_mgp.Graph", .Flags(Py_TPFLAGS_DEFAULT)
.tp_basicsize = sizeof(PyGraph), .Doc("Wraps struct mgp_graph.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyGraphMethods)
.tp_doc = "Wraps struct mgp_graph.", .Build();
.tp_methods = PyGraphMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyGraphType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Graph",
// .tp_basicsize = sizeof(PyGraph),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_graph.",
// .tp_methods = PyGraphMethods,
// };
// // clang-format on
PyObject *MakePyGraph(mgp_graph *graph, mgp_memory *memory) { PyObject *MakePyGraph(mgp_graph *graph, mgp_memory *memory) {
MG_ASSERT(!graph || (graph && memory)); MG_ASSERT(!graph || (graph && memory));
@ -431,15 +490,22 @@ struct PyCypherType {
}; };
// clang-format on // clang-format on
// clang-format off static PyTypeObject PyCypherTypeType = PyTypeBuilder{}
static PyTypeObject PyCypherTypeType = { .Name("_mgp.Type")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyCypherType))
.tp_name = "_mgp.Type", .Flags(Py_TPFLAGS_DEFAULT)
.tp_basicsize = sizeof(PyCypherType), .Doc("Wraps struct mgp_type.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Build();
.tp_doc = "Wraps struct mgp_type.",
}; // // clang-format off
// clang-format on // static PyTypeObject PyCypherTypeType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Type",
// .tp_basicsize = sizeof(PyCypherType),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_type.",
// };
// // clang-format on
PyObject *MakePyCypherType(mgp_type *type) { PyObject *MakePyCypherType(mgp_type *type) {
MG_ASSERT(type); MG_ASSERT(type);
@ -558,16 +624,24 @@ static PyMethodDef PyQueryProcMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyQueryProcType = PyTypeBuilder{}
static PyTypeObject PyQueryProcType = { .Name("_mgp.Proc")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyQueryProc))
.tp_name = "_mgp.Proc", .Flags(Py_TPFLAGS_DEFAULT)
.tp_basicsize = sizeof(PyQueryProc), .Doc("Wraps struct mgp_proc.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyQueryProcMethods)
.tp_doc = "Wraps struct mgp_proc.", .Build();
.tp_methods = PyQueryProcMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyQueryProcType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Proc",
// .tp_basicsize = sizeof(PyQueryProc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_proc.",
// .tp_methods = PyQueryProcMethods,
// };
// // clang-format on
PyObject *PyMagicFuncAddArg(PyMagicFunc *self, PyObject *args) { return PyCallableAddArg(self, args); } PyObject *PyMagicFuncAddArg(PyMagicFunc *self, PyObject *args) { return PyCallableAddArg(self, args); }
@ -583,18 +657,26 @@ static PyMethodDef PyMagicFuncMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyMagicFuncType = PyTypeBuilder{}
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) .Name("_mgp.Func")
static PyTypeObject PyMagicFuncType = { .BasicSize(sizeof(PyMagicFunc))
PyVarObject_HEAD_INIT(nullptr, 0) .Flags(Py_TPFLAGS_DEFAULT)
.tp_name = "_mgp.Func", .Doc("Wraps struct mgp_func.")
.tp_basicsize = sizeof(PyMagicFunc), .Methods(PyMagicFuncMethods)
// NOLINTNEXTLINE(hicpp-signed-bitwise) .Build();
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "Wraps struct mgp_func.", // // clang-format off
.tp_methods = PyMagicFuncMethods, // // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
}; // static PyTypeObject PyMagicFuncType = {
// clang-format on // PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Func",
// .tp_basicsize = sizeof(PyMagicFunc),
// // NOLINTNEXTLINE(hicpp-signed-bitwise)
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_func.",
// .tp_methods = PyMagicFuncMethods,
// };
// // clang-format on
// clang-format off // clang-format off
struct PyQueryModule { struct PyQueryModule {
@ -745,17 +827,26 @@ void PyMessageDealloc(PyMessage *self) {
Py_TYPE(self)->tp_free(self); Py_TYPE(self)->tp_free(self);
} }
// NOLINTNEXTLINE static PyTypeObject PyMessageType = PyTypeBuilder{}
static PyTypeObject PyMessageType = { .Name("_mgp.Message")
PyVarObject_HEAD_INIT(nullptr, 0).tp_name = "_mgp.Message", .BasicSize(sizeof(PyMessage))
.tp_basicsize = sizeof(PyMessage), .Flags(Py_TPFLAGS_DEFAULT)
.tp_dealloc = reinterpret_cast<destructor>(PyMessageDealloc), .Dealloc(reinterpret_cast<destructor>(PyMessageDealloc))
// NOLINTNEXTLINE .Doc("Wraps struct mgp_message.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyMessageMethods)
.tp_doc = "Wraps struct mgp_message.", .Build();
// NOLINTNEXTLINE
.tp_methods = PyMessageMethods, // // NOLINTNEXTLINE
}; // static PyTypeObject PyMessageType = {
// PyVarObject_HEAD_INIT(nullptr, 0).tp_name = "_mgp.Message",
// .tp_basicsize = sizeof(PyMessage),
// .tp_dealloc = reinterpret_cast<destructor>(PyMessageDealloc),
// // NOLINTNEXTLINE
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_message.",
// // NOLINTNEXTLINE
// .tp_methods = PyMessageMethods,
// };
PyObject *PyMessagesInvalidate(PyMessages *self, PyObject *Py_UNUSED(ignored)) { PyObject *PyMessagesInvalidate(PyMessages *self, PyObject *Py_UNUSED(ignored)) {
self->messages = nullptr; self->messages = nullptr;
@ -814,16 +905,24 @@ static PyMethodDef PyMessagesMethods[] = {
{nullptr}, {nullptr},
}; };
// NOLINTNEXTLINE static PyTypeObject PyMessagesType = PyTypeBuilder{}
static PyTypeObject PyMessagesType = { .Name("_mgp.Messages")
PyVarObject_HEAD_INIT(nullptr, 0).tp_name = "_mgp.Messages", .BasicSize(sizeof(PyMessages))
.tp_basicsize = sizeof(PyMessages), .Flags(Py_TPFLAGS_DEFAULT)
// NOLINTNEXTLINE .Doc("Wraps struct mgp_messages.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyMessageMethods)
.tp_doc = "Wraps struct mgp_messages.", .Build();
// NOLINTNEXTLINE
.tp_methods = PyMessagesMethods, // // NOLINTNEXTLINE
}; // static PyTypeObject PyMessagesType = {
// PyVarObject_HEAD_INIT(nullptr, 0).tp_name = "_mgp.Messages",
// .tp_basicsize = sizeof(PyMessages),
// // NOLINTNEXTLINE
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_messages.",
// // NOLINTNEXTLINE
// .tp_methods = PyMessagesMethods,
// };
PyObject *MakePyMessages(mgp_messages *msgs, mgp_memory *memory) { PyObject *MakePyMessages(mgp_messages *msgs, mgp_memory *memory) {
MG_ASSERT(!msgs || (msgs && memory)); MG_ASSERT(!msgs || (msgs && memory));
@ -1232,16 +1331,24 @@ static PyMethodDef PyQueryModuleMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyQueryModuleType = PyTypeBuilder{}
static PyTypeObject PyQueryModuleType = { .Name("_mgp.Module")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyQueryModule))
.tp_name = "_mgp.Module", .Flags(Py_TPFLAGS_DEFAULT)
.tp_basicsize = sizeof(PyQueryModule), .Doc("Wraps struct mgp_module.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyQueryModuleMethods)
.tp_doc = "Wraps struct mgp_module.", .Build();
.tp_methods = PyQueryModuleMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyQueryModuleType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Module",
// .tp_basicsize = sizeof(PyQueryModule),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_module.",
// .tp_methods = PyQueryModuleMethods,
// };
// // clang-format on
PyObject *MakePyQueryModule(mgp_module *module) { PyObject *MakePyQueryModule(mgp_module *module) {
MG_ASSERT(module); MG_ASSERT(module);
@ -1326,15 +1433,44 @@ static PyMethodDef PyMgpModuleMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off struct PyModuleBuilder {
static PyModuleDef PyMgpModule = { PyModuleDef object{PyModuleDef_HEAD_INIT};
PyModuleDef_HEAD_INIT, ;
.m_name = "_mgp", constexpr PyModuleBuilder &&Name(const char *name) && {
.m_doc = "Contains raw bindings to mg_procedure.h C API.", object.m_name = name;
.m_size = -1, return std::move(*this);
.m_methods = PyMgpModuleMethods, }
constexpr PyModuleBuilder &&Size(const size_t size) && {
object.m_size = size;
return std::move(*this);
}
constexpr PyModuleBuilder &&Doc(const char *doc) && {
object.m_doc = doc;
return std::move(*this);
}
constexpr PyModuleBuilder &&Methods(struct PyMethodDef *methods) && {
object.m_methods = methods;
return std::move(*this);
}
constexpr PyModuleDef Build() const && { return object; }
}; };
// clang-format on
static PyModuleDef PyMgpModule = PyModuleBuilder{}
.Name("_mgp")
.Doc("Contains raw bindings to mg_procedure.h C API")
.Size(-1)
.Methods(PyMgpModuleMethods)
.Build();
// // clang-format off
// static PyModuleDef PyMgpModule = {
// PyModuleDef_HEAD_INIT,
// .m_name = "_mgp",
// .m_doc = "Contains raw bindings to mg_procedure.h C API.",
// .m_size = -1,
// .m_methods = PyMgpModuleMethods,
// };
// // clang-format on
// clang-format off // clang-format off
struct PyPropertiesIterator { struct PyPropertiesIterator {
@ -1401,17 +1537,26 @@ static PyMethodDef PyPropertiesIteratorMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyPropertiesIteratorType = PyTypeBuilder{}
static PyTypeObject PyPropertiesIteratorType = { .Name("_mgp.PropertiesIterator")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyPropertiesIterator))
.tp_name = "_mgp.PropertiesIterator", .Dealloc(reinterpret_cast<destructor>(PyPropertiesIteratorDealloc))
.tp_basicsize = sizeof(PyPropertiesIterator), .Flags(Py_TPFLAGS_DEFAULT)
.tp_dealloc = reinterpret_cast<destructor>(PyPropertiesIteratorDealloc), .Doc("Wraps struct mgp_properties_iterator.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyPropertiesIteratorMethods)
.tp_doc = "Wraps struct mgp_properties_iterator.", .Build();
.tp_methods = PyPropertiesIteratorMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyPropertiesIteratorType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.PropertiesIterator",
// .tp_basicsize = sizeof(PyPropertiesIterator),
// .tp_dealloc = reinterpret_cast<destructor>(PyPropertiesIteratorDealloc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_properties_iterator.",
// .tp_methods = PyPropertiesIteratorMethods,
// };
// // clang-format on
// clang-format off // clang-format off
struct PyEdge { struct PyEdge {
@ -1561,18 +1706,28 @@ static PyMethodDef PyEdgeMethods[] = {
PyObject *PyEdgeRichCompare(PyObject *self, PyObject *other, int op); PyObject *PyEdgeRichCompare(PyObject *self, PyObject *other, int op);
// clang-format off static PyTypeObject PyEdgeType = PyTypeBuilder{}
static PyTypeObject PyEdgeType = { .Name("_mgp.Edge")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyEdge))
.tp_name = "_mgp.Edge", .Dealloc(reinterpret_cast<destructor>(PyEdgeDealloc))
.tp_basicsize = sizeof(PyEdge), .Flags(Py_TPFLAGS_DEFAULT)
.tp_dealloc = reinterpret_cast<destructor>(PyEdgeDealloc), .Doc("Wraps struct mgp_edge.")
.tp_flags = Py_TPFLAGS_DEFAULT, .RichCompare(PyEdgeRichCompare)
.tp_doc = "Wraps struct mgp_edge.", .Methods(PyEdgeMethods)
.tp_richcompare = PyEdgeRichCompare, .Build();
.tp_methods = PyEdgeMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyEdgeType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Edge",
// .tp_basicsize = sizeof(PyEdge),
// .tp_dealloc = reinterpret_cast<destructor>(PyEdgeDealloc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_edge.",
// .tp_richcompare = PyEdgeRichCompare,
// .tp_methods = PyEdgeMethods,
// };
// // clang-format on
PyObject *MakePyEdgeWithoutCopy(mgp_edge &edge, PyGraph *py_graph) { PyObject *MakePyEdgeWithoutCopy(mgp_edge &edge, PyGraph *py_graph) {
MG_ASSERT(py_graph); MG_ASSERT(py_graph);
@ -1849,18 +2004,28 @@ static PyMethodDef PyVertexMethods[] = {
PyObject *PyVertexRichCompare(PyObject *self, PyObject *other, int op); PyObject *PyVertexRichCompare(PyObject *self, PyObject *other, int op);
// clang-format off static PyTypeObject PyVertexType = PyTypeBuilder{}
static PyTypeObject PyVertexType = { .Name("_mgp.Vertex")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyVertex))
.tp_name = "_mgp.Vertex", .Dealloc(reinterpret_cast<destructor>(PyVertexDealloc))
.tp_basicsize = sizeof(PyVertex), .Flags(Py_TPFLAGS_DEFAULT)
.tp_dealloc = reinterpret_cast<destructor>(PyVertexDealloc), .Doc("Wraps struct mgp_vertex.")
.tp_flags = Py_TPFLAGS_DEFAULT, .RichCompare(PyVertexRichCompare)
.tp_doc = "Wraps struct mgp_vertex.", .Methods(PyVertexMethods)
.tp_richcompare = PyVertexRichCompare, .Build();
.tp_methods = PyVertexMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyVertexType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Vertex",
// .tp_basicsize = sizeof(PyVertex),
// .tp_dealloc = reinterpret_cast<destructor>(PyVertexDealloc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_vertex.",
// .tp_richcompare = PyVertexRichCompare,
// .tp_methods = PyVertexMethods,
// };
// // clang-format on
PyObject *MakePyVertexWithoutCopy(mgp_vertex &vertex, PyGraph *py_graph) { PyObject *MakePyVertexWithoutCopy(mgp_vertex &vertex, PyGraph *py_graph) {
MG_ASSERT(py_graph); MG_ASSERT(py_graph);
@ -2001,17 +2166,26 @@ static PyMethodDef PyPathMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyPathType = PyTypeBuilder{}
static PyTypeObject PyPathType = { .Name("_mgp.Path")
PyVarObject_HEAD_INIT(nullptr, 0) .BasicSize(sizeof(PyPath))
.tp_name = "_mgp.Path", .Dealloc(reinterpret_cast<destructor>(PyPathDealloc))
.tp_basicsize = sizeof(PyPath), .Flags(Py_TPFLAGS_DEFAULT)
.tp_dealloc = reinterpret_cast<destructor>(PyPathDealloc), .Doc("Wraps struct mgp_path.")
.tp_flags = Py_TPFLAGS_DEFAULT, .Methods(PyPathMethods)
.tp_doc = "Wraps struct mgp_path.", .Build();
.tp_methods = PyPathMethods,
}; // // clang-format off
// clang-format on // static PyTypeObject PyPathType = {
// PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Path",
// .tp_basicsize = sizeof(PyPath),
// .tp_dealloc = reinterpret_cast<destructor>(PyPathDealloc),
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Wraps struct mgp_path.",
// .tp_methods = PyPathMethods,
// };
// // clang-format on
PyObject *MakePyPath(mgp_path *path, PyGraph *py_graph) { PyObject *MakePyPath(mgp_path *path, PyGraph *py_graph) {
MG_ASSERT(path); MG_ASSERT(path);
@ -2119,18 +2293,26 @@ static PyMethodDef PyLoggerMethods[] = {
{nullptr}, {nullptr},
}; };
// clang-format off static PyTypeObject PyLoggerType = PyTypeBuilder{}
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) .Name("_mgp.Logger")
static PyTypeObject PyLoggerType = { .BasicSize(sizeof(PyLogger))
PyVarObject_HEAD_INIT(nullptr, 0) .Flags(Py_TPFLAGS_DEFAULT)
.tp_name = "_mgp.Logger", .Doc("Logging API.")
.tp_basicsize = sizeof(PyLogger), .Methods(PyLoggerMethods)
// NOLINTNEXTLINE(hicpp-signed-bitwise) .Build();
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "Logging API.", // // clang-format off
.tp_methods = PyLoggerMethods, // // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
}; // static PyTypeObject PyLoggerType = {
// clang-format on // PyVarObject_HEAD_INIT(nullptr, 0)
// .tp_name = "_mgp.Logger",
// .tp_basicsize = sizeof(PyLogger),
// // NOLINTNEXTLINE(hicpp-signed-bitwise)
// .tp_flags = Py_TPFLAGS_DEFAULT,
// .tp_doc = "Logging API.",
// .tp_methods = PyLoggerMethods,
// };
// // clang-format on
struct PyMgpError { struct PyMgpError {
const char *name; const char *name;
@ -2363,6 +2545,7 @@ py::Object MgpValueToPyObject(const mgp_value &value, PyGraph *py_graph) {
return py_duration; return py_duration;
} }
} }
throw 1;
} }
mgp_value *PyObjectToMgpValue(PyObject *o, mgp_memory *memory) { mgp_value *PyObjectToMgpValue(PyObject *o, mgp_memory *memory) {

View File

@ -75,6 +75,7 @@ constexpr std::string_view StreamSourceTypeToString(StreamSourceType type) {
case StreamSourceType::PULSAR: case StreamSourceType::PULSAR:
return "pulsar"; return "pulsar";
} }
throw 1;
} }
template <Stream T> template <Stream T>

View File

@ -33,9 +33,9 @@ KafkaStream::KafkaStream(std::string stream_name, StreamInfo stream_info,
KafkaStream::StreamInfo KafkaStream::Info(std::string transformation_name) const { KafkaStream::StreamInfo KafkaStream::Info(std::string transformation_name) const {
const auto &info = consumer_->Info(); const auto &info = consumer_->Info();
return {{.batch_interval = info.batch_interval, return {.common_info = {.batch_interval = info.batch_interval,
.batch_size = info.batch_size, .batch_size = info.batch_size,
.transformation_name = std::move(transformation_name)}, .transformation_name = std::move(transformation_name)},
.topics = info.topics, .topics = info.topics,
.consumer_group = info.consumer_group, .consumer_group = info.consumer_group,
.bootstrap_servers = info.bootstrap_servers, .bootstrap_servers = info.bootstrap_servers,
@ -101,9 +101,9 @@ PulsarStream::PulsarStream(std::string stream_name, StreamInfo stream_info,
PulsarStream::StreamInfo PulsarStream::Info(std::string transformation_name) const { PulsarStream::StreamInfo PulsarStream::Info(std::string transformation_name) const {
const auto &info = consumer_->Info(); const auto &info = consumer_->Info();
return {{.batch_interval = info.batch_interval, return {.common_info = {.batch_interval = info.batch_interval,
.batch_size = info.batch_size, .batch_size = info.batch_size,
.transformation_name = std::move(transformation_name)}, .transformation_name = std::move(transformation_name)},
.topics = info.topics, .topics = info.topics,
.service_url = info.service_url}; .service_url = info.service_url};
} }

View File

@ -116,6 +116,7 @@ inline bool operator==(const PreviousPtr::Pointer &a, const PreviousPtr::Pointer
case PreviousPtr::Type::NULLPTR: case PreviousPtr::Type::NULLPTR:
return b.type == PreviousPtr::Type::NULLPTR; return b.type == PreviousPtr::Type::NULLPTR;
} }
throw 1;
} }
inline bool operator!=(const PreviousPtr::Pointer &a, const PreviousPtr::Pointer &b) { return !(a == b); } inline bool operator!=(const PreviousPtr::Pointer &a, const PreviousPtr::Pointer &b) { return !(a == b); }

View File

@ -354,6 +354,7 @@ std::optional<PropertyValue> Decoder::ReadPropertyValue() {
case Marker::VALUE_TRUE: case Marker::VALUE_TRUE:
return std::nullopt; return std::nullopt;
} }
return std::nullopt;
} }
bool Decoder::SkipString() { bool Decoder::SkipString() {
@ -453,6 +454,7 @@ bool Decoder::SkipPropertyValue() {
case Marker::VALUE_TRUE: case Marker::VALUE_TRUE:
return false; return false;
} }
return false;
} }
std::optional<uint64_t> Decoder::GetSize() { return file_.GetSize(); } std::optional<uint64_t> Decoder::GetSize() { return file_.GetSize(); }

View File

@ -94,6 +94,7 @@ Marker OperationToMarker(StorageGlobalOperation operation) {
case StorageGlobalOperation::UNIQUE_CONSTRAINT_DROP: case StorageGlobalOperation::UNIQUE_CONSTRAINT_DROP:
return Marker::DELTA_UNIQUE_CONSTRAINT_DROP; return Marker::DELTA_UNIQUE_CONSTRAINT_DROP;
} }
throw 1;
} }
Marker VertexActionToMarker(Delta::Action action) { Marker VertexActionToMarker(Delta::Action action) {
@ -120,6 +121,7 @@ Marker VertexActionToMarker(Delta::Action action) {
case Delta::Action::REMOVE_OUT_EDGE: case Delta::Action::REMOVE_OUT_EDGE:
return Marker::DELTA_EDGE_CREATE; return Marker::DELTA_EDGE_CREATE;
} }
throw 1;
} }
// This function convertes a Marker to a WalDeltaData::Type. It checks for the // This function convertes a Marker to a WalDeltaData::Type. It checks for the
@ -184,6 +186,7 @@ WalDeltaData::Type MarkerToWalDeltaDataType(Marker marker) {
case Marker::VALUE_TRUE: case Marker::VALUE_TRUE:
throw RecoveryFailure("Invalid WAL data!"); throw RecoveryFailure("Invalid WAL data!");
} }
throw 1;
} }
// Function used to either read or skip the current WAL delta data. The WAL // Function used to either read or skip the current WAL delta data. The WAL
@ -457,6 +460,7 @@ bool operator==(const WalDeltaData &a, const WalDeltaData &b) {
return a.operation_label_properties.label == b.operation_label_properties.label && return a.operation_label_properties.label == b.operation_label_properties.label &&
a.operation_label_properties.properties == b.operation_label_properties.properties; a.operation_label_properties.properties == b.operation_label_properties.properties;
} }
return false;
} }
bool operator!=(const WalDeltaData &a, const WalDeltaData &b) { return !(a == b); } bool operator!=(const WalDeltaData &a, const WalDeltaData &b) { return !(a == b); }

View File

@ -150,6 +150,7 @@ constexpr bool IsWalDeltaDataTypeTransactionEnd(const WalDeltaData::Type type) {
case WalDeltaData::Type::UNIQUE_CONSTRAINT_DROP: case WalDeltaData::Type::UNIQUE_CONSTRAINT_DROP:
return true; return true;
} }
return false;
} }
/// Function used to read information about the WAL file. /// Function used to read information about the WAL file.

View File

@ -68,7 +68,7 @@ class EdgeAccessor final {
/// @throw std::bad_alloc /// @throw std::bad_alloc
Result<std::map<PropertyId, PropertyValue>> Properties(View view) const; Result<std::map<PropertyId, PropertyValue>> Properties(View view) const;
Gid Gid() const noexcept { storage::Gid Gid() const noexcept {
if (config_.properties_on_edges) { if (config_.properties_on_edges) {
return edge_.ptr->gid; return edge_.ptr->gid;
} else { } else {

View File

@ -467,6 +467,7 @@ std::optional<std::pair<Type, Size>> EncodePropertyValue(Writer *writer, const P
return {{Type::TEMPORAL_DATA, Size::INT8}}; return {{Type::TEMPORAL_DATA, Size::INT8}};
} }
} }
return std::nullopt;
} }
namespace { namespace {
@ -604,6 +605,7 @@ std::optional<TemporalData> DecodeTemporalData(Reader &reader) {
return true; return true;
} }
} }
return false;
} }
// Function used to compare a PropertyValue to the one stored in the byte // Function used to compare a PropertyValue to the one stored in the byte
@ -704,6 +706,7 @@ std::optional<TemporalData> DecodeTemporalData(Reader &reader) {
return *maybe_temporal_data == value.ValueTemporalData(); return *maybe_temporal_data == value.ValueTemporalData();
} }
} }
return false;
} }
// Function used to encode a property (PropertyId, PropertyValue) into a byte // Function used to encode a property (PropertyId, PropertyValue) into a byte

View File

@ -265,6 +265,7 @@ inline std::ostream &operator<<(std::ostream &os, const PropertyValue &value) {
return os << fmt::format("type: {}, microseconds: {}", TemporalTypeTostring(value.ValueTemporalData().type), return os << fmt::format("type: {}, microseconds: {}", TemporalTypeTostring(value.ValueTemporalData().type),
value.ValueTemporalData().microseconds); value.ValueTemporalData().microseconds);
} }
return os;
} }
// NOTE: The logic in this function *MUST* be equal to the logic in // NOTE: The logic in this function *MUST* be equal to the logic in
@ -298,6 +299,7 @@ inline bool operator==(const PropertyValue &first, const PropertyValue &second)
case PropertyValue::Type::TemporalData: case PropertyValue::Type::TemporalData:
return first.ValueTemporalData() == second.ValueTemporalData(); return first.ValueTemporalData() == second.ValueTemporalData();
} }
return false;
} }
inline bool operator<(const PropertyValue &first, const PropertyValue &second) noexcept { inline bool operator<(const PropertyValue &first, const PropertyValue &second) noexcept {
@ -328,6 +330,7 @@ inline bool operator<(const PropertyValue &first, const PropertyValue &second) n
case PropertyValue::Type::TemporalData: case PropertyValue::Type::TemporalData:
return first.ValueTemporalData() < second.ValueTemporalData(); return first.ValueTemporalData() < second.ValueTemporalData();
} }
return false;
} }
inline PropertyValue::PropertyValue(const PropertyValue &other) : type_(other.type_) { inline PropertyValue::PropertyValue(const PropertyValue &other) : type_(other.type_) {

View File

@ -66,6 +66,7 @@ std::string RegisterReplicaErrorToString(Storage::RegisterReplicaError error) {
case Storage::RegisterReplicaError::COULD_NOT_BE_PERSISTED: case Storage::RegisterReplicaError::COULD_NOT_BE_PERSISTED:
return "COULD_NOT_BE_PERSISTED"; return "COULD_NOT_BE_PERSISTED";
} }
throw 1;
} }
} // namespace } // namespace
@ -173,6 +174,7 @@ VerticesIterable::Iterator VerticesIterable::begin() {
case Type::BY_LABEL_PROPERTY: case Type::BY_LABEL_PROPERTY:
return Iterator(vertices_by_label_property_.begin()); return Iterator(vertices_by_label_property_.begin());
} }
throw 1;
} }
VerticesIterable::Iterator VerticesIterable::end() { VerticesIterable::Iterator VerticesIterable::end() {
@ -184,6 +186,7 @@ VerticesIterable::Iterator VerticesIterable::end() {
case Type::BY_LABEL_PROPERTY: case Type::BY_LABEL_PROPERTY:
return Iterator(vertices_by_label_property_.end()); return Iterator(vertices_by_label_property_.end());
} }
throw 1;
} }
VerticesIterable::Iterator::Iterator(AllVerticesIterable::Iterator it) : type_(Type::ALL) { VerticesIterable::Iterator::Iterator(AllVerticesIterable::Iterator it) : type_(Type::ALL) {
@ -285,6 +288,7 @@ VertexAccessor VerticesIterable::Iterator::operator*() const {
case Type::BY_LABEL_PROPERTY: case Type::BY_LABEL_PROPERTY:
return *by_label_property_it_; return *by_label_property_it_;
} }
throw 1;
} }
VerticesIterable::Iterator &VerticesIterable::Iterator::operator++() { VerticesIterable::Iterator &VerticesIterable::Iterator::operator++() {
@ -311,6 +315,7 @@ bool VerticesIterable::Iterator::operator==(const Iterator &other) const {
case Type::BY_LABEL_PROPERTY: case Type::BY_LABEL_PROPERTY:
return by_label_property_it_ == other.by_label_property_it_; return by_label_property_it_ == other.by_label_property_it_;
} }
throw 1;
} }
Storage::Storage(Config config) Storage::Storage(Config config)
@ -1760,6 +1765,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE: case Delta::Action::REMOVE_OUT_EDGE:
return false; return false;
} }
throw 1;
}); });
} }
// 2. Process all Vertex deltas and store all operations that create edges. // 2. Process all Vertex deltas and store all operations that create edges.
@ -1782,6 +1788,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_IN_EDGE: case Delta::Action::REMOVE_IN_EDGE:
return false; return false;
} }
throw 1;
}); });
} }
// 3. Process all Edge deltas and store all operations that modify edge data. // 3. Process all Edge deltas and store all operations that modify edge data.
@ -1804,6 +1811,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE: case Delta::Action::REMOVE_OUT_EDGE:
return false; return false;
} }
throw 1;
}); });
} }
// 4. Process all Vertex deltas and store all operations that delete edges. // 4. Process all Vertex deltas and store all operations that delete edges.
@ -1826,6 +1834,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE: case Delta::Action::REMOVE_OUT_EDGE:
return false; return false;
} }
throw 1;
}); });
} }
// 5. Process all Vertex deltas and store all operations that delete vertices. // 5. Process all Vertex deltas and store all operations that delete vertices.
@ -1848,6 +1857,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE: case Delta::Action::REMOVE_OUT_EDGE:
return false; return false;
} }
throw 1;
}); });
} }

View File

@ -31,6 +31,7 @@ constexpr std::string_view TemporalTypeTostring(const TemporalType type) {
case TemporalType::Duration: case TemporalType::Duration:
return "Duration"; return "Duration";
} }
return "";
} }
struct TemporalData { struct TemporalData {
@ -48,6 +49,7 @@ struct TemporalData {
case TemporalType::Duration: case TemporalType::Duration:
return os << "DURATION(\"" << utils::Duration(t.microseconds) << "\")"; return os << "DURATION(\"" << utils::Duration(t.microseconds) << "\")";
} }
throw 1;
} }
TemporalType type; TemporalType type;
int64_t microseconds; int64_t microseconds;

View File

@ -94,7 +94,7 @@ class VertexAccessor final {
Result<size_t> OutDegree(View view) const; Result<size_t> OutDegree(View view) const;
Gid Gid() const noexcept { return vertex_->gid; } storage::Gid Gid() const noexcept { return vertex_->gid; }
bool operator==(const VertexAccessor &other) const noexcept { bool operator==(const VertexAccessor &other) const noexcept {
return vertex_ == other.vertex_ && transaction_ == other.transaction_; return vertex_ == other.vertex_ && transaction_ == other.transaction_;

View File

@ -18,6 +18,7 @@
#include <exception> #include <exception>
#include <string_view> #include <string_view>
#include <fmt/core.h> // https://github.com/fmtlib/fmt/issues/2419
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ostream.h> #include <fmt/ostream.h>

View File

@ -217,6 +217,7 @@ std::string LicenseCheckErrorToString(LicenseCheckError error, const std::string
"SET DATABASE SETTING \"enterprise.license\" TO \"your-license-key\"", "SET DATABASE SETTING \"enterprise.license\" TO \"your-license-key\"",
feature); feature);
} }
return "";
} }
LicenseCheckResult LicenseChecker::IsValidLicense(const utils::Settings &settings) const { LicenseCheckResult LicenseChecker::IsValidLicense(const utils::Settings &settings) const {

View File

@ -74,6 +74,7 @@ class Synchronized {
template <class... Args> template <class... Args>
explicit Synchronized(Args &&...args) : object_(std::forward<Args>(args)...) {} explicit Synchronized(Args &&...args) : object_(std::forward<Args>(args)...) {}
Synchronized() = default;
Synchronized(const Synchronized &) = delete; Synchronized(const Synchronized &) = delete;
Synchronized(Synchronized &&) = delete; Synchronized(Synchronized &&) = delete;
Synchronized &operator=(const Synchronized &) = delete; Synchronized &operator=(const Synchronized &) = delete;