Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rd_party_slots/rust_metta_bus_client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions 3rd_party_slots/rust_metta_bus_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "metta-bus-client"
version = "0.4.0"
version = "0.4.1"
edition = "2021"

[dependencies]
Expand All @@ -11,9 +11,9 @@ regex = "1.11.0"
log = "0.4.0"
env_logger = "0.8.4"

hyperon-common = { git = "https://github.com/trueagi-io/hyperon-experimental.git", version = "0.2.8" }
hyperon-atom = { git = "https://github.com/trueagi-io/hyperon-experimental.git", version = "0.2.8" }
hyperon-space = { git = "https://github.com/trueagi-io/hyperon-experimental.git", version = "0.2.8" }
hyperon-common = { git = "https://github.com/trueagi-io/hyperon-experimental.git" }
hyperon-atom = { git = "https://github.com/trueagi-io/hyperon-experimental.git" }
hyperon-space = { git = "https://github.com/trueagi-io/hyperon-experimental.git" }
md5 = "0.8.0"

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion 3rd_party_slots/rust_metta_bus_client/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/atom_space_node.proto")?;
tonic_build::compile_protos("proto/distributed_algorithm_node.proto")?;
Ok(())
}
4 changes: 2 additions & 2 deletions 3rd_party_slots/rust_metta_bus_client/src/bus_node.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use tokio::runtime::Builder;
use tonic::{Request, Status};

use das_proto::{atom_space_node_client::AtomSpaceNodeClient, MessageData};
use das_proto::{distributed_algorithm_node_client::DistributedAlgorithmNodeClient, MessageData};

mod das_proto {
tonic::include_proto!("dasproto");
Expand Down Expand Up @@ -60,7 +60,7 @@ impl BusNode {
runtime.block_on(async move {
let target_addr = format!("http://{target_id}");
log::trace!(target: "das", "BusNode::query(target_addr): {target_addr}");
match AtomSpaceNodeClient::connect(target_addr).await {
match DistributedAlgorithmNodeClient::connect(target_addr).await {
Ok(mut client) => client.execute_message(request).await,
Err(err) => Err(Status::internal(format!("Client failed to connect: {err}"))),
}
Expand Down
14 changes: 9 additions & 5 deletions 3rd_party_slots/rust_metta_bus_client/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use tokio::runtime::Runtime;
use tonic::{transport::Server, Request, Response, Status};

use das_proto::{
atom_space_node_client::AtomSpaceNodeClient,
atom_space_node_server::{AtomSpaceNode, AtomSpaceNodeServer},
distributed_algorithm_node_client::DistributedAlgorithmNodeClient,
distributed_algorithm_node_server::{DistributedAlgorithmNode, DistributedAlgorithmNodeServer},
Ack, Empty, MessageData,
};

Expand Down Expand Up @@ -73,7 +73,7 @@ impl ProxyNode {
let peer_id = self.peer_id.clone();
runtime.spawn(async move {
let target_addr = format!("http://{peer_id}");
match AtomSpaceNodeClient::connect(target_addr).await {
match DistributedAlgorithmNodeClient::connect(target_addr).await {
Ok(mut client) => client.execute_message(request).await,
Err(err) => {
log::error!(target: "das", "ProxyNode::to_remote_peer(ERROR): {err:?}");
Expand Down Expand Up @@ -201,7 +201,7 @@ impl StarNode {
}

#[tonic::async_trait]
impl AtomSpaceNode for StarNode {
impl DistributedAlgorithmNode for StarNode {
async fn execute_message(
&self, request: Request<MessageData>,
) -> Result<Response<Empty>, Status> {
Expand All @@ -225,7 +225,11 @@ impl GrpcServer for StarNode {
async fn start_server(self) -> Result<(), BoxError> {
let addr = self.address;
log::debug!(target: "das", "StarNode::start_server(): Inside gRPC server thread at {:?}", addr);
Server::builder().add_service(AtomSpaceNodeServer::new(self)).serve(addr).await.unwrap();
Server::builder()
.add_service(DistributedAlgorithmNodeServer::new(self))
.serve(addr)
.await
.unwrap();
Ok(())
}
}