Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #151

Merged
merged 2 commits into from
Nov 5, 2024
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
25 changes: 13 additions & 12 deletions vmicore/rust_src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ edition = "2021"
crate-type = ["lib", "staticlib"]

[dependencies]
tonic = "0.11.0"
prost = "0.12.3"
prost-types = "0.12.3"
tokio = { version = "1.22", features = ["macros", "rt-multi-thread", "net"] }
tonic = "0.12.3"
prost = "0.13.3"
prost-types = "0.13.3"
tokio = { version = "1.41", features = ["macros", "rt-multi-thread", "net"] }
tokio-stream = "0.1.16"
hyper-util = "0.1.10"
cxx = "1.0"
triggered = "0.1.2"
async-std = "1.12"
async-stream = "0.3.3"
futures-core = "0.3.25"
chrono = "0.4.23"
async-std = "1.13"
async-stream = "0.3.6"
futures-core = "0.3.31"
chrono = "0.4.38"
thiserror = "1"
futures = { version = "0.3", default-features = false, features = ["alloc"] }

[dev-dependencies]
tower = "0.4.13"
ctrlc = "3.4.0"
tower = "0.5.1"
ctrlc = "3.4.5"

[build-dependencies]
tonic-build = "0.11.0"
tonic-build = "0.12.3"
2 changes: 1 addition & 1 deletion vmicore/rust_src/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure().build_client(true).compile(
tonic_build::configure().build_client(true).compile_protos(
&[
"./protos/pkg/logging/service/v1/log_svc.proto",
"./protos/pkg/vmi/v1/vmi_svc.proto",
Expand Down
9 changes: 5 additions & 4 deletions vmicore/rust_src/examples/grpc_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::error::Error;

use hyper_util::rt::TokioIo;
use tokio::{net::UnixStream, try_join};
use tonic::{
transport::{Channel, Endpoint, Uri},
Expand All @@ -14,6 +15,8 @@ use rust_grpc_server::pkg::logging::{
};
use rust_grpc_server::pkg::vmi::v1::{vmi_service_client::VmiServiceClient, ListenForEventsRequest};

const UNIX_SOCKET_ADDR: &str = "/tmp/vmi.sock";

async fn log_client(channel: Channel, trigger: Trigger, listener: Listener) -> Result<(), Box<dyn Error>> {
let mut client = LogServiceClient::new(channel);

Expand Down Expand Up @@ -59,13 +62,11 @@ async fn vmi_client(channel: Channel, trigger: Trigger, listener: Listener) -> R

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let addr = "/tmp/vmi.sock";

// Url not used
let channel = Endpoint::try_from("http://[::]:50051")?
.connect_with_connector(service_fn(move |_: Uri| {
.connect_with_connector(service_fn(|_: Uri| async {
// Connect to a Uds socket
UnixStream::connect(addr)
Ok::<_, std::io::Error>(TokioIo::new(UnixStream::connect(UNIX_SOCKET_ADDR).await?))
}))
.await?;

Expand Down
8 changes: 2 additions & 6 deletions vmicore/rust_src/src/grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ use crate::pkg::vmi::v1::{
use async_std::channel::{unbounded, Receiver, Sender};
use async_std::task;
use cxx::CxxVector;
use futures::TryFutureExt;
use std::error::Error;
use std::fmt::Debug;
use std::pin::Pin;
use std::result;
use std::time::SystemTime;
use tokio::net::UnixListener;
use tokio_stream::wrappers::UnixListenerStream;
use tonic::transport::Server;
use tonic::{Status, Streaming};

Expand Down Expand Up @@ -78,11 +78,7 @@ impl GRPCServer {
}
let uds = UnixListener::bind(addr_ref)?;

async_stream::stream! {
loop {
yield uds.accept().map_ok(|(st, _)| crate::unix_socket::UnixStream(st)).await;
}
}
UnixListenerStream::new(uds)
};

Server::builder()
Expand Down
1 change: 0 additions & 1 deletion vmicore/rust_src/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod grpc_logger;
pub mod grpc_server;
mod grpc_vmi_service;
mod logging;
mod unix_socket;

pub mod pkg {
#![allow(clippy::derive_partial_eq_without_eq)]
Expand Down
48 changes: 0 additions & 48 deletions vmicore/rust_src/src/unix_socket.rs

This file was deleted.

1 change: 1 addition & 0 deletions vmicore/src/Cmdline.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Cmdline.h"
#include <fmt/core.h>
#include <iterator>

std::istream& operator>>(std::istream& is, std::pair<std::string, std::string>& p)
{
Expand Down
2 changes: 1 addition & 1 deletion vmicore/src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ target_link_libraries(vmicore-lib PUBLIC GSL)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 8.1.1
GIT_TAG 11.0.2
)
FetchContent_MakeAvailable(fmt)
target_link_libraries(vmicore-lib PUBLIC fmt-header-only)
Loading