Compare commits
3 Commits
master
...
add-gcc-11
Author | SHA1 | Date | |
---|---|---|---|
|
d2f85d9a42 | ||
|
a6e51639f9 | ||
|
0b716f2a8f |
@ -26,14 +26,14 @@ endif(CCACHE_FOUND AND USE_CCACHE)
|
||||
|
||||
# choose a compiler
|
||||
# NOTE: must be choosen before use of project() or enable_language()
|
||||
find_program(CLANG_FOUND clang)
|
||||
find_program(CLANGXX_FOUND clang++)
|
||||
if (CLANG_FOUND AND CLANGXX_FOUND)
|
||||
set(CMAKE_C_COMPILER ${CLANG_FOUND})
|
||||
set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND})
|
||||
else()
|
||||
message(FATAL_ERROR "Couldn't find clang and/or clang++!")
|
||||
endif()
|
||||
# find_program(CLANG_FOUND clang)
|
||||
# find_program(CLANGXX_FOUND clang++)
|
||||
# if (CLANG_FOUND AND CLANGXX_FOUND)
|
||||
# set(CMAKE_C_COMPILER ${CLANG_FOUND})
|
||||
# set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND})
|
||||
# else()
|
||||
# message(FATAL_ERROR "Couldn't find clang and/or clang++!")
|
||||
# endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@ -179,12 +179,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# c99-designator is disabled because of required mixture of designated and
|
||||
# non-designated initializers in Python Query Module code (`py_module.cpp`).
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
|
||||
-Werror=switch -Werror=switch-bool -Werror=return-type \
|
||||
-Werror=return-stack-address \
|
||||
-Wno-c99-designator \
|
||||
# TODO(gitbuda): Add support for both clang and GCC with the valid flags.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
||||
-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT")
|
||||
|
||||
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.
|
||||
|
@ -79,6 +79,7 @@ inline nlohmann::json PropertyValueToJson(const storage::PropertyValue &pv) {
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
};
|
||||
ret = to_string(temporal_data);
|
||||
break;
|
||||
|
@ -88,6 +88,7 @@ std::string PermissionToString(Permission permission) {
|
||||
case Permission::WEBSOCKET:
|
||||
return "WEBSOCKET";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string PermissionLevelToString(PermissionLevel level) {
|
||||
@ -99,6 +100,7 @@ std::string PermissionLevelToString(PermissionLevel level) {
|
||||
case PermissionLevel::DENY:
|
||||
return "DENY";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef MG_ENTERPRISE
|
||||
@ -129,6 +131,7 @@ std::string FineGrainedPermissionToString(const FineGrainedPermission level) {
|
||||
case FineGrainedPermission::NOTHING:
|
||||
return "NOTHING";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
FineGrainedAccessPermissions Merge(const FineGrainedAccessPermissions &first,
|
||||
|
@ -122,7 +122,7 @@ class Client final {
|
||||
const std::optional<std::string> &db);
|
||||
|
||||
private:
|
||||
using ClientEncoder = ClientEncoder<ChunkedEncoderBuffer<communication::ClientOutputStream>>;
|
||||
using ClientEncoderX = ClientEncoder<ChunkedEncoderBuffer<communication::ClientOutputStream>>;
|
||||
|
||||
template <typename TException = FailureResponseException>
|
||||
[[noreturn]] void HandleFailure(const std::map<std::string, Value> &response_map) {
|
||||
@ -153,6 +153,6 @@ class Client final {
|
||||
|
||||
// encoder objects
|
||||
ChunkedEncoderBuffer<communication::ClientOutputStream> encoder_buffer_{output_stream_};
|
||||
ClientEncoder encoder_{encoder_buffer_};
|
||||
ClientEncoderX encoder_{encoder_buffer_};
|
||||
};
|
||||
} // namespace memgraph::communication::bolt
|
||||
|
@ -425,6 +425,7 @@ std::ostream &operator<<(std::ostream &os, const Value &value) {
|
||||
case Value::Type::Duration:
|
||||
return os << value.ValueDuration();
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
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:
|
||||
return os << "duration";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
} // namespace memgraph::communication::bolt
|
||||
|
@ -207,8 +207,9 @@ class Listener final {
|
||||
CloseSession(session);
|
||||
} else {
|
||||
// Unhandled epoll event.
|
||||
spdlog::error("Unhandled event occured in {} session associated with {} events: {}", service_name_,
|
||||
session.socket().endpoint(), event.events);
|
||||
// TODO: GCC can't compile
|
||||
// spdlog::error("Unhandled event occured in {} session associated with {} events: {}", service_name_,
|
||||
// session.socket().endpoint(), event.events);
|
||||
CloseSession(session);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2022 Memgraph Ltd.
|
||||
// Copyright 2023 Memgraph Ltd.
|
||||
//
|
||||
// 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
|
||||
@ -65,8 +65,9 @@ Listener::Listener(boost::asio::io_context &ioc, ServerContext *context, tcp::en
|
||||
}
|
||||
|
||||
void Listener::DoAccept() {
|
||||
acceptor_.async_accept(
|
||||
ioc_, [shared_this = shared_from_this()](auto ec, auto socket) { shared_this->OnAccept(ec, std::move(socket)); });
|
||||
acceptor_.async_accept(ioc_, [shared_this = shared_from_this()](boost::beast::error_code ec, tcp::socket socket) {
|
||||
shared_this->OnAccept(ec, std::move(socket));
|
||||
});
|
||||
}
|
||||
|
||||
void Listener::OnAccept(boost::beast::error_code ec, tcp::socket socket) {
|
||||
|
@ -66,6 +66,7 @@ bool TypedValueCompare(const TypedValue &a, const TypedValue &b) {
|
||||
case TypedValue::Type::Null:
|
||||
LOG_FATAL("Invalid type");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
} // namespace impl
|
||||
|
@ -1438,6 +1438,7 @@ cpp<#
|
||||
case Type::SINGLE:
|
||||
return false;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
cpp<#)
|
||||
(:protected
|
||||
|
@ -539,6 +539,7 @@ std::string_view ToString(const CommonStreamConfigKey key) {
|
||||
case CommonStreamConfigKey::END:
|
||||
LOG_FATAL("Invalid config key used");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
@ -563,6 +564,7 @@ std::string_view ToString(const KafkaConfigKey key) {
|
||||
case KafkaConfigKey::CREDENTIALS:
|
||||
return "CREDENTIALS";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
void MapCommonStreamConfigs(auto &memory, StreamQuery &stream_query) {
|
||||
@ -689,6 +691,7 @@ std::string_view ToString(const PulsarConfigKey key) {
|
||||
case PulsarConfigKey::SERVICE_URL:
|
||||
return "SERVICE_URL";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -590,6 +590,7 @@ TypedValue ValueType(const TypedValue *args, int64_t nargs, const FunctionContex
|
||||
case TypedValue::Type::Graph:
|
||||
throw QueryRuntimeException("Cannot fetch graph as it is not standardized openCypher type name");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
// TODO: How is Keys different from Properties function?
|
||||
|
@ -476,6 +476,7 @@ Callback HandleAuthQuery(AuthQuery *auth_query, AuthQueryHandler *auth, const Pa
|
||||
default:
|
||||
break;
|
||||
}
|
||||
throw 1;
|
||||
} // namespace
|
||||
|
||||
Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters ¶meters,
|
||||
@ -525,6 +526,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &
|
||||
return std::vector<std::vector<TypedValue>>{{TypedValue("replica")}};
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
};
|
||||
return callback;
|
||||
}
|
||||
@ -605,6 +607,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters &
|
||||
return callback;
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
std::optional<std::string> StringPointerToOptional(const std::string *str) {
|
||||
@ -836,6 +839,7 @@ Callback HandleStreamQuery(StreamQuery *stream_query, const Parameters ¶mete
|
||||
return callback;
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
Callback HandleConfigQuery() {
|
||||
@ -948,6 +952,7 @@ Callback HandleSettingQuery(SettingQuery *setting_query, const Parameters ¶m
|
||||
return callback;
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
// Struct for lazy pulling from a vector
|
||||
@ -1686,6 +1691,7 @@ TriggerEventType ToTriggerEventType(const TriggerQuery::EventType event_type) {
|
||||
case TriggerQuery::EventType::EDGE_UPDATE:
|
||||
return TriggerEventType::EDGE_UPDATE;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
Callback CreateTrigger(TriggerQuery *trigger_query,
|
||||
@ -1763,6 +1769,7 @@ PreparedQuery PrepareTriggerQuery(ParsedQuery parsed_query, const bool in_explic
|
||||
case TriggerQuery::Action::SHOW_TRIGGERS:
|
||||
return ShowTriggers(interpreter_context);
|
||||
}
|
||||
throw 1;
|
||||
});
|
||||
|
||||
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:
|
||||
return storage::IsolationLevel::READ_UNCOMMITTED;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
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:
|
||||
return [interpreter, isolation_level] { interpreter->SetNextTransactionIsolationLevel(isolation_level); };
|
||||
}
|
||||
throw 1;
|
||||
}();
|
||||
|
||||
return PreparedQuery{
|
||||
@ -2590,7 +2599,7 @@ void Interpreter::Commit() {
|
||||
|
||||
SPDLOG_DEBUG("Finished committing the transaction");
|
||||
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."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ constexpr std::string_view GetSeverityLevelString(const SeverityLevel level) {
|
||||
case SeverityLevel::WARNING:
|
||||
return "WARNING"sv;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
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:
|
||||
return "StopAllStreams"sv;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -112,6 +114,7 @@ std::string ExecutionStatsKeyToString(const ExecutionStats::Key key) {
|
||||
case ExecutionStats::Key::UPDATED_PROPERTIES:
|
||||
return std::string("properties-set");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
} // namespace memgraph::query
|
||||
|
@ -377,6 +377,7 @@ bool CreateExpand::CreateExpandCursor::Pull(Frame &frame, ExecutionContext &cont
|
||||
case EdgeAtom::Direction::BOTH:
|
||||
return CreateEdge(self_.edge_info_, dba, &v1, &v2, &frame, &evaluator);
|
||||
}
|
||||
throw 1;
|
||||
}();
|
||||
|
||||
context.execution_stats[ExecutionStats::Key::CREATED_EDGES] += 1;
|
||||
@ -565,6 +566,7 @@ UniqueCursorPtr ScanAllByLabelPropertyRange::MakeCursor(utils::MemoryResource *m
|
||||
} catch (const TypedValueException &) {
|
||||
throw QueryRuntimeException("'{}' cannot be used as a property value.", value.type());
|
||||
}
|
||||
throw 1;
|
||||
};
|
||||
auto maybe_lower = convert(lower_bound_);
|
||||
auto maybe_upper = convert(upper_bound_);
|
||||
@ -723,6 +725,7 @@ bool Expand::ExpandCursor::Pull(Frame &frame, ExecutionContext &context) {
|
||||
case EdgeAtom::Direction::BOTH:
|
||||
LOG_FATAL("Must indicate exact expansion direction here");
|
||||
}
|
||||
throw 1;
|
||||
};
|
||||
|
||||
while (true) {
|
||||
@ -2152,6 +2155,7 @@ UniqueCursorPtr ExpandVariable::MakeCursor(utils::MemoryResource *mem) const {
|
||||
case EdgeAtom::Type::SINGLE:
|
||||
LOG_FATAL("ExpandVariable should not be planned for a single expansion!");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
class ConstructNamedPathCursor : public Cursor {
|
||||
@ -3147,6 +3151,7 @@ TypedValue DefaultAggregationOpValue(const Aggregate::Element &element, utils::M
|
||||
case Aggregation::Op::PROJECT:
|
||||
return TypedValue(query::Graph(memory));
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -301,6 +301,7 @@ std::string ToString(EdgeAtom::Direction dir) {
|
||||
case EdgeAtom::Direction::OUT:
|
||||
return "out";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
std::string ToString(EdgeAtom::Type type) {
|
||||
@ -316,6 +317,7 @@ std::string ToString(EdgeAtom::Type type) {
|
||||
case EdgeAtom::Type::SINGLE:
|
||||
return "single";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
std::string ToString(Ordering ord) {
|
||||
@ -325,6 +327,7 @@ std::string ToString(Ordering ord) {
|
||||
case Ordering::DESC:
|
||||
return "desc";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
json ToJson(Expression *expression) {
|
||||
|
@ -123,6 +123,7 @@ std::string ReadWriteTypeChecker::TypeToString(const RWType type) {
|
||||
case RWType::RW:
|
||||
return "rw";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
} // namespace memgraph::query::plan
|
||||
|
@ -305,6 +305,7 @@ mgp_value_type FromTypedValueType(memgraph::query::TypedValue::Type type) {
|
||||
case memgraph::query::TypedValue::Type::Graph:
|
||||
throw std::logic_error{"mgp_value for TypedValue::Type::Graph doesn't exist."};
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -361,6 +362,7 @@ memgraph::query::TypedValue ToTypedValue(const mgp_value &val, memgraph::utils::
|
||||
case MGP_VALUE_TYPE_DURATION:
|
||||
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) {}
|
||||
@ -1645,6 +1647,7 @@ memgraph::storage::PropertyValue ToPropertyValue(const mgp_value &value) {
|
||||
case MGP_VALUE_TYPE_PATH:
|
||||
throw ValueConversionException{"A path is not a valid property value!"};
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -2934,6 +2937,7 @@ std::ostream &PrintValue(const TypedValue &value, std::ostream *stream) {
|
||||
case TypedValue::Type::Graph:
|
||||
LOG_FATAL("value must not be a graph element");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -3006,6 +3010,7 @@ mgp_source_type StreamSourceTypeToMgpSourceType(const StreamSourceType type) {
|
||||
case StreamSourceType::PULSAR:
|
||||
return mgp_source_type::PULSAR;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -147,7 +147,9 @@ class ModuleRegistry final {
|
||||
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
|
||||
// ASAN: https://github.com/google/sanitizers/issues/89
|
||||
SharedLibraryHandle libstd_handle{"libstdc++.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE};
|
||||
|
@ -216,16 +216,58 @@ static PyMethodDef PyVerticesIteratorMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// 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,
|
||||
struct PyTypeBuilder {
|
||||
PyTypeObject object{PyVarObject_HEAD_INIT(nullptr, 0)};
|
||||
constexpr PyTypeBuilder &&Name(const char *name) && {
|
||||
object.tp_name = name;
|
||||
return std::move(*this);
|
||||
}
|
||||
constexpr PyTypeBuilder &&BasicSize(const size_t size) && {
|
||||
object.tp_basicsize = size;
|
||||
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 off
|
||||
@ -288,17 +330,26 @@ static PyMethodDef PyEdgesIteratorMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyEdgesIteratorType = PyTypeBuilder{}
|
||||
.Name("_mgp.EdgesIterator")
|
||||
.BasicSize(sizeof(PyEdgesIterator))
|
||||
.Dealloc(reinterpret_cast<destructor>(PyEdgesIteratorDealloc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_edges_iterator.")
|
||||
.Methods(PyEdgesIteratorMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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)) {
|
||||
self->graph = nullptr;
|
||||
@ -404,16 +455,24 @@ static PyMethodDef PyGraphMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyGraphType = PyTypeBuilder{}
|
||||
.Name("_mgp.Graph")
|
||||
.BasicSize(sizeof(PyGraph))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_graph.")
|
||||
.Methods(PyGraphMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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) {
|
||||
MG_ASSERT(!graph || (graph && memory));
|
||||
@ -431,15 +490,22 @@ struct PyCypherType {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyCypherTypeType = PyTypeBuilder{}
|
||||
.Name("_mgp.Type")
|
||||
.BasicSize(sizeof(PyCypherType))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_type.")
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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) {
|
||||
MG_ASSERT(type);
|
||||
@ -558,16 +624,24 @@ static PyMethodDef PyQueryProcMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyQueryProcType = PyTypeBuilder{}
|
||||
.Name("_mgp.Proc")
|
||||
.BasicSize(sizeof(PyQueryProc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_proc.")
|
||||
.Methods(PyQueryProcMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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); }
|
||||
|
||||
@ -583,18 +657,26 @@ static PyMethodDef PyMagicFuncMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
static PyTypeObject PyMagicFuncType = {
|
||||
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
|
||||
static PyTypeObject PyMagicFuncType = PyTypeBuilder{}
|
||||
.Name("_mgp.Func")
|
||||
.BasicSize(sizeof(PyMagicFunc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_func.")
|
||||
.Methods(PyMagicFuncMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
// static PyTypeObject PyMagicFuncType = {
|
||||
// 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
|
||||
struct PyQueryModule {
|
||||
@ -745,17 +827,26 @@ void PyMessageDealloc(PyMessage *self) {
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
// 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,
|
||||
};
|
||||
static PyTypeObject PyMessageType = PyTypeBuilder{}
|
||||
.Name("_mgp.Message")
|
||||
.BasicSize(sizeof(PyMessage))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Dealloc(reinterpret_cast<destructor>(PyMessageDealloc))
|
||||
.Doc("Wraps struct mgp_message.")
|
||||
.Methods(PyMessageMethods)
|
||||
.Build();
|
||||
|
||||
// // 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)) {
|
||||
self->messages = nullptr;
|
||||
@ -814,16 +905,24 @@ static PyMethodDef PyMessagesMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// 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,
|
||||
};
|
||||
static PyTypeObject PyMessagesType = PyTypeBuilder{}
|
||||
.Name("_mgp.Messages")
|
||||
.BasicSize(sizeof(PyMessages))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_messages.")
|
||||
.Methods(PyMessageMethods)
|
||||
.Build();
|
||||
|
||||
// // 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) {
|
||||
MG_ASSERT(!msgs || (msgs && memory));
|
||||
@ -1232,16 +1331,24 @@ static PyMethodDef PyQueryModuleMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyQueryModuleType = PyTypeBuilder{}
|
||||
.Name("_mgp.Module")
|
||||
.BasicSize(sizeof(PyQueryModule))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_module.")
|
||||
.Methods(PyQueryModuleMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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) {
|
||||
MG_ASSERT(module);
|
||||
@ -1326,15 +1433,44 @@ static PyMethodDef PyMgpModuleMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// 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,
|
||||
struct PyModuleBuilder {
|
||||
PyModuleDef object{PyModuleDef_HEAD_INIT};
|
||||
;
|
||||
constexpr PyModuleBuilder &&Name(const char *name) && {
|
||||
object.m_name = name;
|
||||
return std::move(*this);
|
||||
}
|
||||
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
|
||||
struct PyPropertiesIterator {
|
||||
@ -1401,17 +1537,26 @@ static PyMethodDef PyPropertiesIteratorMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyPropertiesIteratorType = PyTypeBuilder{}
|
||||
.Name("_mgp.PropertiesIterator")
|
||||
.BasicSize(sizeof(PyPropertiesIterator))
|
||||
.Dealloc(reinterpret_cast<destructor>(PyPropertiesIteratorDealloc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_properties_iterator.")
|
||||
.Methods(PyPropertiesIteratorMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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
|
||||
struct PyEdge {
|
||||
@ -1561,18 +1706,28 @@ static PyMethodDef PyEdgeMethods[] = {
|
||||
|
||||
PyObject *PyEdgeRichCompare(PyObject *self, PyObject *other, int op);
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyEdgeType = PyTypeBuilder{}
|
||||
.Name("_mgp.Edge")
|
||||
.BasicSize(sizeof(PyEdge))
|
||||
.Dealloc(reinterpret_cast<destructor>(PyEdgeDealloc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_edge.")
|
||||
.RichCompare(PyEdgeRichCompare)
|
||||
.Methods(PyEdgeMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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) {
|
||||
MG_ASSERT(py_graph);
|
||||
@ -1849,18 +2004,28 @@ static PyMethodDef PyVertexMethods[] = {
|
||||
|
||||
PyObject *PyVertexRichCompare(PyObject *self, PyObject *other, int op);
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyVertexType = PyTypeBuilder{}
|
||||
.Name("_mgp.Vertex")
|
||||
.BasicSize(sizeof(PyVertex))
|
||||
.Dealloc(reinterpret_cast<destructor>(PyVertexDealloc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_vertex.")
|
||||
.RichCompare(PyVertexRichCompare)
|
||||
.Methods(PyVertexMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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) {
|
||||
MG_ASSERT(py_graph);
|
||||
@ -2001,17 +2166,26 @@ static PyMethodDef PyPathMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
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
|
||||
static PyTypeObject PyPathType = PyTypeBuilder{}
|
||||
.Name("_mgp.Path")
|
||||
.BasicSize(sizeof(PyPath))
|
||||
.Dealloc(reinterpret_cast<destructor>(PyPathDealloc))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Wraps struct mgp_path.")
|
||||
.Methods(PyPathMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// 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) {
|
||||
MG_ASSERT(path);
|
||||
@ -2119,18 +2293,26 @@ static PyMethodDef PyLoggerMethods[] = {
|
||||
{nullptr},
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
static PyTypeObject PyLoggerType = {
|
||||
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
|
||||
static PyTypeObject PyLoggerType = PyTypeBuilder{}
|
||||
.Name("_mgp.Logger")
|
||||
.BasicSize(sizeof(PyLogger))
|
||||
.Flags(Py_TPFLAGS_DEFAULT)
|
||||
.Doc("Logging API.")
|
||||
.Methods(PyLoggerMethods)
|
||||
.Build();
|
||||
|
||||
// // clang-format off
|
||||
// // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
// static PyTypeObject PyLoggerType = {
|
||||
// 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 {
|
||||
const char *name;
|
||||
@ -2363,6 +2545,7 @@ py::Object MgpValueToPyObject(const mgp_value &value, PyGraph *py_graph) {
|
||||
return py_duration;
|
||||
}
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
mgp_value *PyObjectToMgpValue(PyObject *o, mgp_memory *memory) {
|
||||
|
@ -75,6 +75,7 @@ constexpr std::string_view StreamSourceTypeToString(StreamSourceType type) {
|
||||
case StreamSourceType::PULSAR:
|
||||
return "pulsar";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
template <Stream T>
|
||||
|
@ -33,9 +33,9 @@ KafkaStream::KafkaStream(std::string stream_name, StreamInfo stream_info,
|
||||
|
||||
KafkaStream::StreamInfo KafkaStream::Info(std::string transformation_name) const {
|
||||
const auto &info = consumer_->Info();
|
||||
return {{.batch_interval = info.batch_interval,
|
||||
.batch_size = info.batch_size,
|
||||
.transformation_name = std::move(transformation_name)},
|
||||
return {.common_info = {.batch_interval = info.batch_interval,
|
||||
.batch_size = info.batch_size,
|
||||
.transformation_name = std::move(transformation_name)},
|
||||
.topics = info.topics,
|
||||
.consumer_group = info.consumer_group,
|
||||
.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 {
|
||||
const auto &info = consumer_->Info();
|
||||
return {{.batch_interval = info.batch_interval,
|
||||
.batch_size = info.batch_size,
|
||||
.transformation_name = std::move(transformation_name)},
|
||||
return {.common_info = {.batch_interval = info.batch_interval,
|
||||
.batch_size = info.batch_size,
|
||||
.transformation_name = std::move(transformation_name)},
|
||||
.topics = info.topics,
|
||||
.service_url = info.service_url};
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ inline bool operator==(const PreviousPtr::Pointer &a, const PreviousPtr::Pointer
|
||||
case 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); }
|
||||
|
@ -354,6 +354,7 @@ std::optional<PropertyValue> Decoder::ReadPropertyValue() {
|
||||
case Marker::VALUE_TRUE:
|
||||
return std::nullopt;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool Decoder::SkipString() {
|
||||
@ -453,6 +454,7 @@ bool Decoder::SkipPropertyValue() {
|
||||
case Marker::VALUE_TRUE:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<uint64_t> Decoder::GetSize() { return file_.GetSize(); }
|
||||
|
@ -94,6 +94,7 @@ Marker OperationToMarker(StorageGlobalOperation operation) {
|
||||
case StorageGlobalOperation::UNIQUE_CONSTRAINT_DROP:
|
||||
return Marker::DELTA_UNIQUE_CONSTRAINT_DROP;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
Marker VertexActionToMarker(Delta::Action action) {
|
||||
@ -120,6 +121,7 @@ Marker VertexActionToMarker(Delta::Action action) {
|
||||
case Delta::Action::REMOVE_OUT_EDGE:
|
||||
return Marker::DELTA_EDGE_CREATE;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
// 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:
|
||||
throw RecoveryFailure("Invalid WAL data!");
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
// 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 &&
|
||||
a.operation_label_properties.properties == b.operation_label_properties.properties;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool operator!=(const WalDeltaData &a, const WalDeltaData &b) { return !(a == b); }
|
||||
|
||||
|
@ -150,6 +150,7 @@ constexpr bool IsWalDeltaDataTypeTransactionEnd(const WalDeltaData::Type type) {
|
||||
case WalDeltaData::Type::UNIQUE_CONSTRAINT_DROP:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Function used to read information about the WAL file.
|
||||
|
@ -68,7 +68,7 @@ class EdgeAccessor final {
|
||||
/// @throw std::bad_alloc
|
||||
Result<std::map<PropertyId, PropertyValue>> Properties(View view) const;
|
||||
|
||||
Gid Gid() const noexcept {
|
||||
storage::Gid Gid() const noexcept {
|
||||
if (config_.properties_on_edges) {
|
||||
return edge_.ptr->gid;
|
||||
} else {
|
||||
|
@ -467,6 +467,7 @@ std::optional<std::pair<Type, Size>> EncodePropertyValue(Writer *writer, const P
|
||||
return {{Type::TEMPORAL_DATA, Size::INT8}};
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -604,6 +605,7 @@ std::optional<TemporalData> DecodeTemporalData(Reader &reader) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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 false;
|
||||
}
|
||||
|
||||
// Function used to encode a property (PropertyId, PropertyValue) into a byte
|
||||
|
@ -265,6 +265,7 @@ inline std::ostream &operator<<(std::ostream &os, const PropertyValue &value) {
|
||||
return os << fmt::format("type: {}, microseconds: {}", TemporalTypeTostring(value.ValueTemporalData().type),
|
||||
value.ValueTemporalData().microseconds);
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
// 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:
|
||||
return first.ValueTemporalData() == second.ValueTemporalData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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:
|
||||
return first.ValueTemporalData() < second.ValueTemporalData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline PropertyValue::PropertyValue(const PropertyValue &other) : type_(other.type_) {
|
||||
|
@ -66,6 +66,7 @@ std::string RegisterReplicaErrorToString(Storage::RegisterReplicaError error) {
|
||||
case Storage::RegisterReplicaError::COULD_NOT_BE_PERSISTED:
|
||||
return "COULD_NOT_BE_PERSISTED";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -173,6 +174,7 @@ VerticesIterable::Iterator VerticesIterable::begin() {
|
||||
case Type::BY_LABEL_PROPERTY:
|
||||
return Iterator(vertices_by_label_property_.begin());
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
VerticesIterable::Iterator VerticesIterable::end() {
|
||||
@ -184,6 +186,7 @@ VerticesIterable::Iterator VerticesIterable::end() {
|
||||
case Type::BY_LABEL_PROPERTY:
|
||||
return Iterator(vertices_by_label_property_.end());
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
VerticesIterable::Iterator::Iterator(AllVerticesIterable::Iterator it) : type_(Type::ALL) {
|
||||
@ -285,6 +288,7 @@ VertexAccessor VerticesIterable::Iterator::operator*() const {
|
||||
case Type::BY_LABEL_PROPERTY:
|
||||
return *by_label_property_it_;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
VerticesIterable::Iterator &VerticesIterable::Iterator::operator++() {
|
||||
@ -311,6 +315,7 @@ bool VerticesIterable::Iterator::operator==(const Iterator &other) const {
|
||||
case Type::BY_LABEL_PROPERTY:
|
||||
return by_label_property_it_ == other.by_label_property_it_;
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
|
||||
Storage::Storage(Config config)
|
||||
@ -1760,6 +1765,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
|
||||
case Delta::Action::REMOVE_OUT_EDGE:
|
||||
return false;
|
||||
}
|
||||
throw 1;
|
||||
});
|
||||
}
|
||||
// 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:
|
||||
return false;
|
||||
}
|
||||
throw 1;
|
||||
});
|
||||
}
|
||||
// 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:
|
||||
return false;
|
||||
}
|
||||
throw 1;
|
||||
});
|
||||
}
|
||||
// 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:
|
||||
return false;
|
||||
}
|
||||
throw 1;
|
||||
});
|
||||
}
|
||||
// 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:
|
||||
return false;
|
||||
}
|
||||
throw 1;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ constexpr std::string_view TemporalTypeTostring(const TemporalType type) {
|
||||
case TemporalType::Duration:
|
||||
return "Duration";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
struct TemporalData {
|
||||
@ -48,6 +49,7 @@ struct TemporalData {
|
||||
case TemporalType::Duration:
|
||||
return os << "DURATION(\"" << utils::Duration(t.microseconds) << "\")";
|
||||
}
|
||||
throw 1;
|
||||
}
|
||||
TemporalType type;
|
||||
int64_t microseconds;
|
||||
|
@ -94,7 +94,7 @@ class VertexAccessor final {
|
||||
|
||||
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 {
|
||||
return vertex_ == other.vertex_ && transaction_ == other.transaction_;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <exception>
|
||||
#include <string_view>
|
||||
|
||||
#include <fmt/core.h> // https://github.com/fmtlib/fmt/issues/2419
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
|
@ -217,6 +217,7 @@ std::string LicenseCheckErrorToString(LicenseCheckError error, const std::string
|
||||
"SET DATABASE SETTING \"enterprise.license\" TO \"your-license-key\"",
|
||||
feature);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
LicenseCheckResult LicenseChecker::IsValidLicense(const utils::Settings &settings) const {
|
||||
|
@ -74,6 +74,7 @@ class Synchronized {
|
||||
template <class... Args>
|
||||
explicit Synchronized(Args &&...args) : object_(std::forward<Args>(args)...) {}
|
||||
|
||||
Synchronized() = default;
|
||||
Synchronized(const Synchronized &) = delete;
|
||||
Synchronized(Synchronized &&) = delete;
|
||||
Synchronized &operator=(const Synchronized &) = delete;
|
||||
|
Loading…
Reference in New Issue
Block a user