server api

This commit is contained in:
John Smith
2023-06-07 17:39:10 -04:00
parent 88db69c28f
commit 317f036598
14 changed files with 423 additions and 259 deletions

View File

@@ -3,7 +3,6 @@ name = "veilid-cli"
version = "0.1.0"
authors = ["John Smith <jsmith@example.com>"]
edition = "2021"
build = "build.rs"
license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)"
[[bin]]
@@ -36,8 +35,6 @@ serde = "^1"
serde_derive = "^1"
parking_lot = "^0"
cfg-if = "^1"
capnp = "^0"
capnp-rpc = "^0"
config = { version = "^0", features = ["yaml"] }
bugsalot = { git = "https://github.com/crioux/bugsalot.git" }
flexi_logger = { version = "^0", features = ["use_chrono_for_offset"] }
@@ -49,6 +46,3 @@ json = "^0"
[dev-dependencies]
serial_test = "^0"
[build-dependencies]
capnpc = "^0"

View File

@@ -1,7 +0,0 @@
fn main() {
::capnpc::CompilerCommand::new()
.file("../veilid-server/proto/veilid-client.capnp")
.src_prefix("../veilid-server/")
.run()
.expect("compiling schema");
}

View File

@@ -1,8 +1,5 @@
use crate::command_processor::*;
use crate::tools::*;
use crate::veilid_client_capnp::*;
use capnp::capability::Promise;
use capnp_rpc::{pry, rpc_twoparty_capnp, twoparty, Disconnector, RpcSystem};
use futures::future::FutureExt;
use serde::de::DeserializeOwned;
use std::cell::RefCell;
@@ -11,25 +8,6 @@ use std::rc::Rc;
use veilid_core::tools::*;
use veilid_core::*;
macro_rules! capnp_failed {
($ex:expr) => {{
let msg = format!("Capnp Error: {}", $ex);
error!("{}", msg);
Promise::err(capnp::Error::failed(msg))
}};
}
macro_rules! pry_result {
($ex:expr) => {
match $ex {
Ok(v) => v,
Err(e) => {
return capnp_failed!(e);
}
}
};
}
fn map_to_internal_error<T: ToString>(e: T) -> VeilidAPIError {
VeilidAPIError::Internal {
message: e.to_string(),

View File

@@ -18,11 +18,6 @@ mod settings;
mod tools;
mod ui;
#[allow(clippy::all)]
pub mod veilid_client_capnp {
include!(concat!(env!("OUT_DIR"), "/proto/veilid_client_capnp.rs"));
}
fn parse_command_line(default_config_path: &OsStr) -> Result<clap::ArgMatches, String> {
let matches = Command::new("veilid-cli")
.version("0.1")