json api work
This commit is contained in:
@@ -22,6 +22,7 @@ mod signed_relayed_node_info;
|
||||
mod signed_value_data;
|
||||
mod signed_value_descriptor;
|
||||
mod socket_address;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod tunnel;
|
||||
mod typed_key;
|
||||
mod typed_signature;
|
||||
@@ -50,6 +51,7 @@ pub use signed_relayed_node_info::*;
|
||||
pub use signed_value_data::*;
|
||||
pub use signed_value_descriptor::*;
|
||||
pub use socket_address::*;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
pub use tunnel::*;
|
||||
pub use typed_key::*;
|
||||
pub use typed_signature::*;
|
||||
|
@@ -39,8 +39,11 @@ pub enum RPCAnswerDetail {
|
||||
WatchValueA(RPCOperationWatchValueA),
|
||||
SupplyBlockA(RPCOperationSupplyBlockA),
|
||||
FindBlockA(RPCOperationFindBlockA),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
StartTunnelA(RPCOperationStartTunnelA),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
CompleteTunnelA(RPCOperationCompleteTunnelA),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
CancelTunnelA(RPCOperationCancelTunnelA),
|
||||
}
|
||||
|
||||
@@ -55,8 +58,11 @@ impl RPCAnswerDetail {
|
||||
RPCAnswerDetail::WatchValueA(_) => "WatchValueA",
|
||||
RPCAnswerDetail::SupplyBlockA(_) => "SupplyBlockA",
|
||||
RPCAnswerDetail::FindBlockA(_) => "FindBlockA",
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::StartTunnelA(_) => "StartTunnelA",
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::CompleteTunnelA(_) => "CompleteTunnelA",
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::CancelTunnelA(_) => "CancelTunnelA",
|
||||
}
|
||||
}
|
||||
@@ -70,8 +76,11 @@ impl RPCAnswerDetail {
|
||||
RPCAnswerDetail::WatchValueA(r) => r.validate(validate_context),
|
||||
RPCAnswerDetail::SupplyBlockA(r) => r.validate(validate_context),
|
||||
RPCAnswerDetail::FindBlockA(r) => r.validate(validate_context),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::StartTunnelA(r) => r.validate(validate_context),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::CompleteTunnelA(r) => r.validate(validate_context),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::CancelTunnelA(r) => r.validate(validate_context),
|
||||
}
|
||||
}
|
||||
@@ -120,16 +129,19 @@ impl RPCAnswerDetail {
|
||||
let out = RPCOperationFindBlockA::decode(&op_reader)?;
|
||||
RPCAnswerDetail::FindBlockA(out)
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
veilid_capnp::answer::detail::StartTunnelA(r) => {
|
||||
let op_reader = r.map_err(RPCError::protocol)?;
|
||||
let out = RPCOperationStartTunnelA::decode(&op_reader)?;
|
||||
RPCAnswerDetail::StartTunnelA(out)
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
veilid_capnp::answer::detail::CompleteTunnelA(r) => {
|
||||
let op_reader = r.map_err(RPCError::protocol)?;
|
||||
let out = RPCOperationCompleteTunnelA::decode(&op_reader)?;
|
||||
RPCAnswerDetail::CompleteTunnelA(out)
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
veilid_capnp::answer::detail::CancelTunnelA(r) => {
|
||||
let op_reader = r.map_err(RPCError::protocol)?;
|
||||
let out = RPCOperationCancelTunnelA::decode(&op_reader)?;
|
||||
@@ -155,12 +167,15 @@ impl RPCAnswerDetail {
|
||||
d.encode(&mut builder.reborrow().init_supply_block_a())
|
||||
}
|
||||
RPCAnswerDetail::FindBlockA(d) => d.encode(&mut builder.reborrow().init_find_block_a()),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::StartTunnelA(d) => {
|
||||
d.encode(&mut builder.reborrow().init_start_tunnel_a())
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::CompleteTunnelA(d) => {
|
||||
d.encode(&mut builder.reborrow().init_complete_tunnel_a())
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCAnswerDetail::CancelTunnelA(d) => {
|
||||
d.encode(&mut builder.reborrow().init_cancel_tunnel_a())
|
||||
}
|
||||
|
@@ -2,8 +2,6 @@ mod answer;
|
||||
mod operation;
|
||||
mod operation_app_call;
|
||||
mod operation_app_message;
|
||||
mod operation_cancel_tunnel;
|
||||
mod operation_complete_tunnel;
|
||||
mod operation_find_block;
|
||||
mod operation_find_node;
|
||||
mod operation_get_value;
|
||||
@@ -11,7 +9,6 @@ mod operation_return_receipt;
|
||||
mod operation_route;
|
||||
mod operation_set_value;
|
||||
mod operation_signal;
|
||||
mod operation_start_tunnel;
|
||||
mod operation_status;
|
||||
mod operation_supply_block;
|
||||
mod operation_validate_dial_info;
|
||||
@@ -21,12 +18,17 @@ mod question;
|
||||
mod respond_to;
|
||||
mod statement;
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod operation_cancel_tunnel;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod operation_complete_tunnel;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod operation_start_tunnel;
|
||||
|
||||
pub use answer::*;
|
||||
pub use operation::*;
|
||||
pub use operation_app_call::*;
|
||||
pub use operation_app_message::*;
|
||||
pub use operation_cancel_tunnel::*;
|
||||
pub use operation_complete_tunnel::*;
|
||||
pub use operation_find_block::*;
|
||||
pub use operation_find_node::*;
|
||||
pub use operation_get_value::*;
|
||||
@@ -34,7 +36,6 @@ pub use operation_return_receipt::*;
|
||||
pub use operation_route::*;
|
||||
pub use operation_set_value::*;
|
||||
pub use operation_signal::*;
|
||||
pub use operation_start_tunnel::*;
|
||||
pub use operation_status::*;
|
||||
pub use operation_supply_block::*;
|
||||
pub use operation_validate_dial_info::*;
|
||||
@@ -44,4 +45,11 @@ pub use question::*;
|
||||
pub use respond_to::*;
|
||||
pub use statement::*;
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
pub use operation_cancel_tunnel::*;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
pub use operation_complete_tunnel::*;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
pub use operation_start_tunnel::*;
|
||||
|
||||
use super::*;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RPCOperationCancelTunnelQ {
|
||||
id: TunnelId,
|
||||
@@ -37,6 +38,7 @@ impl RPCOperationCancelTunnelQ {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RPCOperationCancelTunnelA {
|
||||
Tunnel(TunnelId),
|
||||
|
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RPCOperationCompleteTunnelQ {
|
||||
id: TunnelId,
|
||||
@@ -74,6 +75,7 @@ impl RPCOperationCompleteTunnelQ {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RPCOperationCompleteTunnelA {
|
||||
Tunnel(FullTunnel),
|
||||
|
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RPCOperationStartTunnelQ {
|
||||
id: TunnelId,
|
||||
@@ -64,6 +65,7 @@ impl RPCOperationStartTunnelQ {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RPCOperationStartTunnelA {
|
||||
Partial(PartialTunnel),
|
||||
|
@@ -51,8 +51,11 @@ pub enum RPCQuestionDetail {
|
||||
WatchValueQ(RPCOperationWatchValueQ),
|
||||
SupplyBlockQ(RPCOperationSupplyBlockQ),
|
||||
FindBlockQ(RPCOperationFindBlockQ),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
StartTunnelQ(RPCOperationStartTunnelQ),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
CompleteTunnelQ(RPCOperationCompleteTunnelQ),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
CancelTunnelQ(RPCOperationCancelTunnelQ),
|
||||
}
|
||||
|
||||
@@ -67,8 +70,11 @@ impl RPCQuestionDetail {
|
||||
RPCQuestionDetail::WatchValueQ(_) => "WatchValueQ",
|
||||
RPCQuestionDetail::SupplyBlockQ(_) => "SupplyBlockQ",
|
||||
RPCQuestionDetail::FindBlockQ(_) => "FindBlockQ",
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::StartTunnelQ(_) => "StartTunnelQ",
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CompleteTunnelQ(_) => "CompleteTunnelQ",
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CancelTunnelQ(_) => "CancelTunnelQ",
|
||||
}
|
||||
}
|
||||
@@ -82,8 +88,11 @@ impl RPCQuestionDetail {
|
||||
RPCQuestionDetail::WatchValueQ(r) => r.validate(validate_context),
|
||||
RPCQuestionDetail::SupplyBlockQ(r) => r.validate(validate_context),
|
||||
RPCQuestionDetail::FindBlockQ(r) => r.validate(validate_context),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::StartTunnelQ(r) => r.validate(validate_context),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CompleteTunnelQ(r) => r.validate(validate_context),
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CancelTunnelQ(r) => r.validate(validate_context),
|
||||
}
|
||||
}
|
||||
@@ -133,16 +142,19 @@ impl RPCQuestionDetail {
|
||||
let out = RPCOperationFindBlockQ::decode(&op_reader)?;
|
||||
RPCQuestionDetail::FindBlockQ(out)
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
veilid_capnp::question::detail::StartTunnelQ(r) => {
|
||||
let op_reader = r.map_err(RPCError::protocol)?;
|
||||
let out = RPCOperationStartTunnelQ::decode(&op_reader)?;
|
||||
RPCQuestionDetail::StartTunnelQ(out)
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
veilid_capnp::question::detail::CompleteTunnelQ(r) => {
|
||||
let op_reader = r.map_err(RPCError::protocol)?;
|
||||
let out = RPCOperationCompleteTunnelQ::decode(&op_reader)?;
|
||||
RPCQuestionDetail::CompleteTunnelQ(out)
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
veilid_capnp::question::detail::CancelTunnelQ(r) => {
|
||||
let op_reader = r.map_err(RPCError::protocol)?;
|
||||
let out = RPCOperationCancelTunnelQ::decode(&op_reader)?;
|
||||
@@ -170,12 +182,15 @@ impl RPCQuestionDetail {
|
||||
RPCQuestionDetail::FindBlockQ(d) => {
|
||||
d.encode(&mut builder.reborrow().init_find_block_q())
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::StartTunnelQ(d) => {
|
||||
d.encode(&mut builder.reborrow().init_start_tunnel_q())
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CompleteTunnelQ(d) => {
|
||||
d.encode(&mut builder.reborrow().init_complete_tunnel_q())
|
||||
}
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CancelTunnelQ(d) => {
|
||||
d.encode(&mut builder.reborrow().init_cancel_tunnel_q())
|
||||
}
|
||||
|
@@ -4,8 +4,6 @@ mod fanout_call;
|
||||
mod operation_waiter;
|
||||
mod rpc_app_call;
|
||||
mod rpc_app_message;
|
||||
mod rpc_cancel_tunnel;
|
||||
mod rpc_complete_tunnel;
|
||||
mod rpc_error;
|
||||
mod rpc_find_block;
|
||||
mod rpc_find_node;
|
||||
@@ -14,13 +12,19 @@ mod rpc_return_receipt;
|
||||
mod rpc_route;
|
||||
mod rpc_set_value;
|
||||
mod rpc_signal;
|
||||
mod rpc_start_tunnel;
|
||||
mod rpc_status;
|
||||
mod rpc_supply_block;
|
||||
mod rpc_validate_dial_info;
|
||||
mod rpc_value_changed;
|
||||
mod rpc_watch_value;
|
||||
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod rpc_cancel_tunnel;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod rpc_complete_tunnel;
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
mod rpc_start_tunnel;
|
||||
|
||||
pub use coders::*;
|
||||
pub use destination::*;
|
||||
pub use fanout_call::*;
|
||||
@@ -1410,8 +1414,11 @@ impl RPCProcessor {
|
||||
RPCQuestionDetail::WatchValueQ(_) => self.process_watch_value_q(msg).await,
|
||||
RPCQuestionDetail::SupplyBlockQ(_) => self.process_supply_block_q(msg).await,
|
||||
RPCQuestionDetail::FindBlockQ(_) => self.process_find_block_q(msg).await,
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::StartTunnelQ(_) => self.process_start_tunnel_q(msg).await,
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CompleteTunnelQ(_) => self.process_complete_tunnel_q(msg).await,
|
||||
#[cfg(feature = "unstable-tunnels")]
|
||||
RPCQuestionDetail::CancelTunnelQ(_) => self.process_cancel_tunnel_q(msg).await,
|
||||
},
|
||||
RPCOperationKind::Statement(s) => match s.detail() {
|
||||
|
Reference in New Issue
Block a user