diff --git a/src/MODULE.bazel b/src/MODULE.bazel index d1f66d1d..63ee39e1 100644 --- a/src/MODULE.bazel +++ b/src/MODULE.bazel @@ -94,8 +94,8 @@ http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "ht http_archive( name = "com_github_singnet_das_proto", - strip_prefix = "das-proto-0.1.18", - urls = ["https://github.com/singnet/das-proto/archive/refs/tags/0.1.18.tar.gz"], + strip_prefix = "das-proto-0.1.19", + urls = ["https://github.com/singnet/das-proto/archive/refs/tags/0.1.19.tar.gz"], ) # Deps for formatting and linting BUILD files diff --git a/src/distributed_algorithm_node/BUILD b/src/distributed_algorithm_node/BUILD index 64bab5ff..4363d71e 100644 --- a/src/distributed_algorithm_node/BUILD +++ b/src/distributed_algorithm_node/BUILD @@ -33,7 +33,7 @@ cc_library( "//commons:commons_lib", "@com_github_grpc_grpc//:grpc++", "@com_github_grpc_grpc//:grpc++_reflection", - "@com_github_singnet_das_proto//:atom_space_node_cc_grpc", + "@com_github_singnet_das_proto//:distributed_algorithm_node_cc_grpc", ], ) diff --git a/src/distributed_algorithm_node/MessageBroker.cc b/src/distributed_algorithm_node/MessageBroker.cc index 8bb578f6..ce570ed7 100644 --- a/src/distributed_algorithm_node/MessageBroker.cc +++ b/src/distributed_algorithm_node/MessageBroker.cc @@ -1,3 +1,5 @@ +#include "MessageBroker.h" + #include #include #include @@ -6,16 +8,10 @@ #include #include -#include "common.pb.h" - -// TODO: Once das-proto is updated, update atom_space_node to distributed_algorithm_node - -// #include "distributed_algorithm_node.grpc.pb.h" -// #include "distributed_algorithm_node.pb.h" -#include "MessageBroker.h" #include "Utils.h" -#include "atom_space_node.grpc.pb.h" -#include "atom_space_node.pb.h" +#include "common.pb.h" +#include "distributed_algorithm_node.grpc.pb.h" +#include "distributed_algorithm_node.pb.h" #define LOG_LEVEL INFO_LEVEL #include "Logger.h" @@ -214,11 +210,7 @@ void SynchronousGRPC::inbox_thread_method(shared_ptr monitor) { this->peers_mutex.lock(); for (auto target : this->peers) { if (visited.find(target) == visited.end()) { - // TODO: Once das-proto is updated, update atom_space_node to - // distributed_algorithm_node auto stub = - // dasproto::DistributedAlgorithmNode::NewStub(grpc::CreateChannel(target, - // grpc::InsecureChannelCredentials())); - auto stub = dasproto::AtomSpaceNode::NewStub( + auto stub = dasproto::DistributedAlgorithmNode::NewStub( grpc::CreateChannel(target, grpc::InsecureChannelCredentials())); stub->execute_message(&(context[cursor]), *message_data, &(reply[cursor])); cursor++; @@ -377,10 +369,7 @@ void SynchronousGRPC::send(const string& command, const vector& args, co message_data.set_is_broadcast(false); dasproto::Empty reply; grpc::ClientContext context; - // TODO: Once das-proto is updated, update atom_space_node to distributed_algorithm_node - // auto stub = dasproto::DistributedAlgorithmNode::NewStub(grpc::CreateChannel(recipient, - // grpc::InsecureChannelCredentials())); - auto stub = dasproto::AtomSpaceNode::NewStub( + auto stub = dasproto::DistributedAlgorithmNode::NewStub( grpc::CreateChannel(recipient, grpc::InsecureChannelCredentials())); stub->execute_message(&context, message_data, &reply); } @@ -404,10 +393,7 @@ void SynchronousGRPC::broadcast(const string& command, const vector& arg message_data.set_sender(this->node_id); message_data.set_is_broadcast(true); message_data.add_visited_recipients(this->node_id); - // TODO: Once das-proto is updated, update atom_space_node to distributed_algorithm_node - // auto stub = dasproto::DistributedAlgorithmNode::NewStub(grpc::CreateChannel(peer_id, - // grpc::InsecureChannelCredentials())); - auto stub = dasproto::AtomSpaceNode::NewStub( + auto stub = dasproto::DistributedAlgorithmNode::NewStub( grpc::CreateChannel(peer_id, grpc::InsecureChannelCredentials())); stub->execute_message(&(context[cursor]), message_data, &(reply[cursor])); cursor++; diff --git a/src/distributed_algorithm_node/MessageBroker.h b/src/distributed_algorithm_node/MessageBroker.h index 7dbc3d55..1bdf8c55 100644 --- a/src/distributed_algorithm_node/MessageBroker.h +++ b/src/distributed_algorithm_node/MessageBroker.h @@ -6,15 +6,11 @@ #include #include -// TODO: Once das-proto is updated, update atom_space_node to distributed_algorithm_node - -#include "atom_space_node.grpc.pb.h" -// #include "distributed_algorithm_node.grpc.pb.h" - #include "Message.h" #include "SharedQueue.h" #include "Stoppable.h" #include "StoppableThread.h" +#include "distributed_algorithm_node.grpc.pb.h" using namespace std; using namespace commons; @@ -246,9 +242,7 @@ class SynchronousSharedRAM : public MessageBroker { * answer is supposed to be implemented as a separate Message going back from the target node to * the node that originated the request. */ -// TODO: Once das-proto is updated, update atom_space_node to distributed_algorithm_node -// class SynchronousGRPC : public MessageBroker, public dasproto::DistributedAlgorithmNode::Service { -class SynchronousGRPC : public MessageBroker, public dasproto::AtomSpaceNode::Service { +class SynchronousGRPC : public MessageBroker, public dasproto::DistributedAlgorithmNode::Service { public: /** * Basic constructor diff --git a/src/tests/cpp/pattern_matching_query_test.cc b/src/tests/cpp/pattern_matching_query_test.cc index 936f9f4b..eb3f6070 100644 --- a/src/tests/cpp/pattern_matching_query_test.cc +++ b/src/tests/cpp/pattern_matching_query_test.cc @@ -102,7 +102,7 @@ void check_query(const string& query_tag, // giving time to the server to close the previous connection // otherwise the test fails with "Node ID already in the network" - Utils::sleep(3000); + Utils::sleep(); client_bus->issue_bus_command(proxy2); while (!proxy2->finished()) { @@ -113,7 +113,7 @@ void check_query(const string& query_tag, // giving time to the server to close the previous connection // otherwise the test fails with "Node ID already in the network" - Utils::sleep(3000); + Utils::sleep(); if (metta_expression != "") { client_bus->issue_bus_command(proxy3); @@ -147,11 +147,11 @@ TEST(PatternMatchingQuery, queries) { string peer2_id = "localhost:40042"; ServiceBus* server_bus = new ServiceBus(peer1_id); - Utils::sleep(500); + Utils::sleep(); server_bus->register_processor(make_shared()); - Utils::sleep(500); + Utils::sleep(); ServiceBus* client_bus = new ServiceBus(peer2_id, peer1_id); - Utils::sleep(500); + Utils::sleep(); // clang-format off vector q1 = { @@ -284,6 +284,5 @@ TEST(PatternMatchingQuery, queries) { } EXPECT_EQ(count, 1); - Utils::sleep(2000); // clang-format on }