mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
checkpoint
This commit is contained in:
parent
8b5fc96c8c
commit
8fa58f1205
@ -11,9 +11,9 @@ impl RPCAnswer {
|
|||||||
pub fn new(detail: RPCAnswerDetail) -> Self {
|
pub fn new(detail: RPCAnswerDetail) -> Self {
|
||||||
Self { detail }
|
Self { detail }
|
||||||
}
|
}
|
||||||
pub fn detail(&self) -> &RPCAnswerDetail {
|
// pub fn detail(&self) -> &RPCAnswerDetail {
|
||||||
&self.detail
|
// &self.detail
|
||||||
}
|
// }
|
||||||
pub fn into_detail(self) -> RPCAnswerDetail {
|
pub fn into_detail(self) -> RPCAnswerDetail {
|
||||||
self.detail
|
self.detail
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ impl RPCAnswer {
|
|||||||
Ok(RPCAnswer { detail })
|
Ok(RPCAnswer { detail })
|
||||||
}
|
}
|
||||||
pub fn encode(&self, builder: &mut veilid_capnp::answer::Builder) -> Result<(), RPCError> {
|
pub fn encode(&self, builder: &mut veilid_capnp::answer::Builder) -> Result<(), RPCError> {
|
||||||
self.detail.encode(&mut builder.init_detail())?;
|
self.detail.encode(&mut builder.reborrow().init_detail())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,16 +124,26 @@ impl RPCAnswerDetail {
|
|||||||
builder: &mut veilid_capnp::answer::detail::Builder,
|
builder: &mut veilid_capnp::answer::detail::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCAnswerDetail::StatusA(d) => d.encode(&mut builder.init_status_a()),
|
RPCAnswerDetail::StatusA(d) => d.encode(&mut builder.reborrow().init_status_a()),
|
||||||
RPCAnswerDetail::FindNodeA(d) => d.encode(&mut builder.init_find_node_a()),
|
RPCAnswerDetail::FindNodeA(d) => d.encode(&mut builder.reborrow().init_find_node_a()),
|
||||||
RPCAnswerDetail::GetValueA(d) => d.encode(&mut builder.init_get_value_a()),
|
RPCAnswerDetail::GetValueA(d) => d.encode(&mut builder.reborrow().init_get_value_a()),
|
||||||
RPCAnswerDetail::SetValueA(d) => d.encode(&mut builder.init_set_value_a()),
|
RPCAnswerDetail::SetValueA(d) => d.encode(&mut builder.reborrow().init_set_value_a()),
|
||||||
RPCAnswerDetail::WatchValueA(d) => d.encode(&mut builder.init_watch_value_a()),
|
RPCAnswerDetail::WatchValueA(d) => {
|
||||||
RPCAnswerDetail::SupplyBlockA(d) => d.encode(&mut builder.init_supply_block_a()),
|
d.encode(&mut builder.reborrow().init_watch_value_a())
|
||||||
RPCAnswerDetail::FindBlockA(d) => d.encode(&mut builder.init_find_block_a()),
|
}
|
||||||
RPCAnswerDetail::StartTunnelA(d) => d.encode(&mut builder.init_start_tunnel_a()),
|
RPCAnswerDetail::SupplyBlockA(d) => {
|
||||||
RPCAnswerDetail::CompleteTunnelA(d) => d.encode(&mut builder.init_complete_tunnel_a()),
|
d.encode(&mut builder.reborrow().init_supply_block_a())
|
||||||
RPCAnswerDetail::CancelTunnelA(d) => d.encode(&mut builder.init_cancel_tunnel_a()),
|
}
|
||||||
|
RPCAnswerDetail::FindBlockA(d) => d.encode(&mut builder.reborrow().init_find_block_a()),
|
||||||
|
RPCAnswerDetail::StartTunnelA(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_start_tunnel_a())
|
||||||
|
}
|
||||||
|
RPCAnswerDetail::CompleteTunnelA(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_complete_tunnel_a())
|
||||||
|
}
|
||||||
|
RPCAnswerDetail::CancelTunnelA(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_cancel_tunnel_a())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,10 @@ impl RPCOperationKind {
|
|||||||
builder: &mut veilid_capnp::operation::kind::Builder,
|
builder: &mut veilid_capnp::operation::kind::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCOperationKind::Question(k) => k.encode(&mut builder.init_question()),
|
RPCOperationKind::Question(k) => k.encode(&mut builder.reborrow().init_question()),
|
||||||
RPCOperationKind::Statement(k) => k.encode(&mut builder.init_statement()),
|
RPCOperationKind::Statement(k) => k.encode(&mut builder.reborrow().init_statement()),
|
||||||
RPCOperationKind::Answer(k) => k.encode(&mut builder.init_answer()),
|
RPCOperationKind::Answer(k) => k.encode(&mut builder.reborrow().init_answer()),
|
||||||
};
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ impl RPCOperation {
|
|||||||
&self.kind
|
&self.kind
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_kind(&self) -> RPCOperationKind {
|
pub fn into_kind(self) -> RPCOperationKind {
|
||||||
self.kind
|
self.kind
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ impl RPCOperation {
|
|||||||
|
|
||||||
pub fn encode(&self, builder: &mut veilid_capnp::operation::Builder) -> Result<(), RPCError> {
|
pub fn encode(&self, builder: &mut veilid_capnp::operation::Builder) -> Result<(), RPCError> {
|
||||||
builder.set_op_id(self.op_id);
|
builder.set_op_id(self.op_id);
|
||||||
let k_builder = builder.init_kind();
|
let mut k_builder = builder.reborrow().init_kind();
|
||||||
self.kind.encode(&mut k_builder)?;
|
self.kind.encode(&mut k_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ impl RPCOperationCompleteTunnelQ {
|
|||||||
TunnelMode::Turn => veilid_capnp::TunnelEndpointMode::Turn,
|
TunnelMode::Turn => veilid_capnp::TunnelEndpointMode::Turn,
|
||||||
});
|
});
|
||||||
builder.set_depth(self.depth);
|
builder.set_depth(self.depth);
|
||||||
let te_builder = builder.init_endpoint();
|
let mut te_builder = builder.reborrow().init_endpoint();
|
||||||
encode_tunnel_endpoint(&self.endpoint, &mut te_builder)?;
|
encode_tunnel_endpoint(&self.endpoint, &mut te_builder)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -77,7 +77,7 @@ impl RPCOperationCompleteTunnelA {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCOperationCompleteTunnelA::Tunnel(p) => {
|
RPCOperationCompleteTunnelA::Tunnel(p) => {
|
||||||
encode_full_tunnel(p, &mut builder.init_tunnel())?;
|
encode_full_tunnel(p, &mut builder.reborrow().init_tunnel())?;
|
||||||
}
|
}
|
||||||
RPCOperationCompleteTunnelA::Error(e) => {
|
RPCOperationCompleteTunnelA::Error(e) => {
|
||||||
builder.set_error(encode_tunnel_error(*e));
|
builder.set_error(encode_tunnel_error(*e));
|
||||||
|
@ -19,7 +19,7 @@ impl RPCOperationFindBlockQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_find_block_q::Builder,
|
builder: &mut veilid_capnp::operation_find_block_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let bi_builder = builder.init_block_id();
|
let mut bi_builder = builder.reborrow().init_block_id();
|
||||||
encode_block_id(&self.block_id, &mut bi_builder)?;
|
encode_block_id(&self.block_id, &mut bi_builder)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -79,7 +79,7 @@ impl RPCOperationFindBlockA {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
builder.set_data(&self.data);
|
builder.set_data(&self.data);
|
||||||
|
|
||||||
let mut suppliers_builder = builder.init_suppliers(
|
let mut suppliers_builder = builder.reborrow().init_suppliers(
|
||||||
self.suppliers
|
self.suppliers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
@ -90,7 +90,7 @@ impl RPCOperationFindBlockA {
|
|||||||
encode_peer_info(peer, &mut pi_builder)?;
|
encode_peer_info(peer, &mut pi_builder)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut peers_builder = builder.init_peers(
|
let mut peers_builder = builder.reborrow().init_peers(
|
||||||
self.peers
|
self.peers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
|
@ -18,7 +18,7 @@ impl RPCOperationFindNodeQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_find_node_q::Builder,
|
builder: &mut veilid_capnp::operation_find_node_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let ni_builder = builder.init_node_id();
|
let mut ni_builder = builder.reborrow().init_node_id();
|
||||||
encode_public_key(&self.node_id, &mut ni_builder)?;
|
encode_public_key(&self.node_id, &mut ni_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ impl RPCOperationFindNodeA {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_find_node_a::Builder,
|
builder: &mut veilid_capnp::operation_find_node_a::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let mut peers_builder = builder.init_peers(
|
let mut peers_builder = builder.reborrow().init_peers(
|
||||||
self.peers
|
self.peers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
|
@ -18,7 +18,7 @@ impl RPCOperationGetValueQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_get_value_q::Builder,
|
builder: &mut veilid_capnp::operation_get_value_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let k_builder = builder.init_key();
|
let mut k_builder = builder.reborrow().init_key();
|
||||||
encode_value_key(&self.key, &mut k_builder)?;
|
encode_value_key(&self.key, &mut k_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -62,11 +62,11 @@ impl RPCOperationGetValueA {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCOperationGetValueA::Data(data) => {
|
RPCOperationGetValueA::Data(data) => {
|
||||||
let d_builder = builder.init_data();
|
let mut d_builder = builder.reborrow().init_data();
|
||||||
encode_value_data(&data, &mut d_builder)?;
|
encode_value_data(&data, &mut d_builder)?;
|
||||||
}
|
}
|
||||||
RPCOperationGetValueA::Peers(peers) => {
|
RPCOperationGetValueA::Peers(peers) => {
|
||||||
let mut peers_builder = builder.init_peers(
|
let mut peers_builder = builder.reborrow().init_peers(
|
||||||
peers
|
peers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
|
@ -22,7 +22,7 @@ impl RPCOperationNodeInfoUpdate {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_node_info_update::Builder,
|
builder: &mut veilid_capnp::operation_node_info_update::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let sni_builder = builder.init_signed_node_info();
|
let mut sni_builder = builder.reborrow().init_signed_node_info();
|
||||||
encode_signed_node_info(&self.signed_node_info, &mut sni_builder)?;
|
encode_signed_node_info(&self.signed_node_info, &mut sni_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ impl RoutedOperation {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::routed_operation::Builder,
|
builder: &mut veilid_capnp::routed_operation::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let mut sigs_builder = builder.init_signatures(
|
let mut sigs_builder = builder.reborrow().init_signatures(
|
||||||
self.signatures
|
self.signatures
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
@ -60,7 +60,7 @@ impl RoutedOperation {
|
|||||||
let mut sig_builder = sigs_builder.reborrow().get(i as u32);
|
let mut sig_builder = sigs_builder.reborrow().get(i as u32);
|
||||||
encode_signature(sig, &mut sig_builder);
|
encode_signature(sig, &mut sig_builder);
|
||||||
}
|
}
|
||||||
let n_builder = builder.init_nonce();
|
let mut n_builder = builder.reborrow().init_nonce();
|
||||||
encode_nonce(&self.nonce, &mut n_builder);
|
encode_nonce(&self.nonce, &mut n_builder);
|
||||||
builder.set_data(&self.data);
|
builder.set_data(&self.data);
|
||||||
|
|
||||||
@ -95,9 +95,9 @@ impl RPCOperationRoute {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_route::Builder,
|
builder: &mut veilid_capnp::operation_route::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let sr_builder = builder.init_safety_route();
|
let mut sr_builder = builder.reborrow().init_safety_route();
|
||||||
encode_safety_route(&self.safety_route, &mut sr_builder)?;
|
encode_safety_route(&self.safety_route, &mut sr_builder)?;
|
||||||
let o_builder = builder.init_operation();
|
let mut o_builder = builder.reborrow().init_operation();
|
||||||
self.operation.encode(&mut o_builder)?;
|
self.operation.encode(&mut o_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ impl RPCOperationSetValueQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_set_value_q::Builder,
|
builder: &mut veilid_capnp::operation_set_value_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let k_builder = builder.init_key();
|
let mut k_builder = builder.reborrow().init_key();
|
||||||
encode_value_key(&self.key, &mut k_builder)?;
|
encode_value_key(&self.key, &mut k_builder)?;
|
||||||
let v_builder = builder.init_value();
|
let mut v_builder = builder.reborrow().init_value();
|
||||||
encode_value_data(&self.value, &mut v_builder)?;
|
encode_value_data(&self.value, &mut v_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -67,11 +67,11 @@ impl RPCOperationSetValueA {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCOperationSetValueA::Data(data) => {
|
RPCOperationSetValueA::Data(data) => {
|
||||||
let d_builder = builder.init_data();
|
let mut d_builder = builder.reborrow().init_data();
|
||||||
encode_value_data(&data, &mut d_builder)?;
|
encode_value_data(&data, &mut d_builder)?;
|
||||||
}
|
}
|
||||||
RPCOperationSetValueA::Peers(peers) => {
|
RPCOperationSetValueA::Peers(peers) => {
|
||||||
let mut peers_builder = builder.init_peers(
|
let mut peers_builder = builder.reborrow().init_peers(
|
||||||
peers
|
peers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
|
@ -17,7 +17,7 @@ impl RPCOperationSignal {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_signal::Builder,
|
builder: &mut veilid_capnp::operation_signal::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
encode_signal_info(&self.signal_info, &mut builder)?;
|
encode_signal_info(&self.signal_info, builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ impl RPCOperationStartTunnelA {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCOperationStartTunnelA::Partial(p) => {
|
RPCOperationStartTunnelA::Partial(p) => {
|
||||||
encode_partial_tunnel(p, &mut builder.init_partial())?;
|
encode_partial_tunnel(p, &mut builder.reborrow().init_partial())?;
|
||||||
}
|
}
|
||||||
RPCOperationStartTunnelA::Error(e) => {
|
RPCOperationStartTunnelA::Error(e) => {
|
||||||
builder.set_error(encode_tunnel_error(*e));
|
builder.set_error(encode_tunnel_error(*e));
|
||||||
|
@ -18,7 +18,7 @@ impl RPCOperationStatusQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_status_q::Builder,
|
builder: &mut veilid_capnp::operation_status_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let ns_builder = builder.init_node_status();
|
let mut ns_builder = builder.reborrow().init_node_status();
|
||||||
encode_node_status(&self.node_status, &mut ns_builder)?;
|
encode_node_status(&self.node_status, &mut ns_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -49,9 +49,9 @@ impl RPCOperationStatusA {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_status_a::Builder,
|
builder: &mut veilid_capnp::operation_status_a::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let ns_builder = builder.init_node_status();
|
let mut ns_builder = builder.reborrow().init_node_status();
|
||||||
encode_node_status(&self.node_status, &mut ns_builder)?;
|
encode_node_status(&self.node_status, &mut ns_builder)?;
|
||||||
let si_builder = builder.init_sender_info();
|
let mut si_builder = builder.reborrow().init_sender_info();
|
||||||
encode_sender_info(&self.sender_info, &mut si_builder)?;
|
encode_sender_info(&self.sender_info, &mut si_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ impl RPCOperationSupplyBlockQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_supply_block_q::Builder,
|
builder: &mut veilid_capnp::operation_supply_block_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let bi_builder = builder.init_block_id();
|
let mut bi_builder = builder.reborrow().init_block_id();
|
||||||
encode_block_id(&self.block_id, &mut bi_builder)?;
|
encode_block_id(&self.block_id, &mut bi_builder)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -66,7 +66,7 @@ impl RPCOperationSupplyBlockA {
|
|||||||
builder.set_expiration(*e);
|
builder.set_expiration(*e);
|
||||||
}
|
}
|
||||||
RPCOperationSupplyBlockA::Peers(peers) => {
|
RPCOperationSupplyBlockA::Peers(peers) => {
|
||||||
let mut peers_builder = builder.init_peers(
|
let mut peers_builder = builder.reborrow().init_peers(
|
||||||
peers
|
peers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
|
@ -28,7 +28,7 @@ impl RPCOperationValidateDialInfo {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_validate_dial_info::Builder,
|
builder: &mut veilid_capnp::operation_validate_dial_info::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let di_builder = builder.init_dial_info();
|
let mut di_builder = builder.reborrow().init_dial_info();
|
||||||
encode_dial_info(&self.dial_info, &mut di_builder)?;
|
encode_dial_info(&self.dial_info, &mut di_builder)?;
|
||||||
builder.set_receipt(&self.receipt);
|
builder.set_receipt(&self.receipt);
|
||||||
builder.set_redirect(self.redirect);
|
builder.set_redirect(self.redirect);
|
||||||
|
@ -21,9 +21,9 @@ impl RPCOperationValueChanged {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_value_changed::Builder,
|
builder: &mut veilid_capnp::operation_value_changed::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let k_builder = builder.init_key();
|
let mut k_builder = builder.reborrow().init_key();
|
||||||
encode_value_key(&self.key, &mut k_builder)?;
|
encode_value_key(&self.key, &mut k_builder)?;
|
||||||
let v_builder = builder.init_value();
|
let mut v_builder = builder.reborrow().init_value();
|
||||||
encode_value_data(&self.value, &mut v_builder)?;
|
encode_value_data(&self.value, &mut v_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ impl RPCOperationWatchValueQ {
|
|||||||
&self,
|
&self,
|
||||||
builder: &mut veilid_capnp::operation_watch_value_q::Builder,
|
builder: &mut veilid_capnp::operation_watch_value_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let k_builder = builder.init_key();
|
let mut k_builder = builder.reborrow().init_key();
|
||||||
encode_value_key(&self.key, &mut k_builder)?;
|
encode_value_key(&self.key, &mut k_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ impl RPCOperationWatchValueA {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
builder.set_expiration(self.expiration);
|
builder.set_expiration(self.expiration);
|
||||||
|
|
||||||
let mut peers_builder = builder.init_peers(
|
let mut peers_builder = builder.reborrow().init_peers(
|
||||||
self.peers
|
self.peers
|
||||||
.len()
|
.len()
|
||||||
.try_into()
|
.try_into()
|
||||||
|
@ -18,12 +18,12 @@ impl RPCQuestion {
|
|||||||
pub fn detail(&self) -> &RPCQuestionDetail {
|
pub fn detail(&self) -> &RPCQuestionDetail {
|
||||||
&self.detail
|
&self.detail
|
||||||
}
|
}
|
||||||
pub fn into_detail(self) -> RPCQuestionDetail {
|
// pub fn into_detail(self) -> RPCQuestionDetail {
|
||||||
self.detail
|
// self.detail
|
||||||
}
|
// }
|
||||||
pub fn into_respond_to_detail(self) -> (RespondTo, RPCQuestionDetail) {
|
// pub fn into_respond_to_detail(self) -> (RespondTo, RPCQuestionDetail) {
|
||||||
(self.respond_to, self.detail)
|
// (self.respond_to, self.detail)
|
||||||
}
|
// }
|
||||||
pub fn desc(&self) -> &'static str {
|
pub fn desc(&self) -> &'static str {
|
||||||
self.detail.desc()
|
self.detail.desc()
|
||||||
}
|
}
|
||||||
@ -38,8 +38,9 @@ impl RPCQuestion {
|
|||||||
Ok(RPCQuestion { respond_to, detail })
|
Ok(RPCQuestion { respond_to, detail })
|
||||||
}
|
}
|
||||||
pub fn encode(&self, builder: &mut veilid_capnp::question::Builder) -> Result<(), RPCError> {
|
pub fn encode(&self, builder: &mut veilid_capnp::question::Builder) -> Result<(), RPCError> {
|
||||||
self.respond_to.encode(&mut builder.init_respond_to())?;
|
self.respond_to
|
||||||
self.detail.encode(&mut builder.init_detail())?;
|
.encode(&mut builder.reborrow().init_respond_to())?;
|
||||||
|
self.detail.encode(&mut builder.reborrow().init_detail())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,18 +138,28 @@ impl RPCQuestionDetail {
|
|||||||
builder: &mut veilid_capnp::question::detail::Builder,
|
builder: &mut veilid_capnp::question::detail::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCQuestionDetail::StatusQ(d) => d.encode(&mut builder.init_status_q()),
|
RPCQuestionDetail::StatusQ(d) => d.encode(&mut builder.reborrow().init_status_q()),
|
||||||
RPCQuestionDetail::FindNodeQ(d) => d.encode(&mut builder.init_find_node_q()),
|
RPCQuestionDetail::FindNodeQ(d) => d.encode(&mut builder.reborrow().init_find_node_q()),
|
||||||
RPCQuestionDetail::GetValueQ(d) => d.encode(&mut builder.init_get_value_q()),
|
RPCQuestionDetail::GetValueQ(d) => d.encode(&mut builder.reborrow().init_get_value_q()),
|
||||||
RPCQuestionDetail::SetValueQ(d) => d.encode(&mut builder.init_set_value_q()),
|
RPCQuestionDetail::SetValueQ(d) => d.encode(&mut builder.reborrow().init_set_value_q()),
|
||||||
RPCQuestionDetail::WatchValueQ(d) => d.encode(&mut builder.init_watch_value_q()),
|
RPCQuestionDetail::WatchValueQ(d) => {
|
||||||
RPCQuestionDetail::SupplyBlockQ(d) => d.encode(&mut builder.init_supply_block_q()),
|
d.encode(&mut builder.reborrow().init_watch_value_q())
|
||||||
RPCQuestionDetail::FindBlockQ(d) => d.encode(&mut builder.init_find_block_q()),
|
}
|
||||||
RPCQuestionDetail::StartTunnelQ(d) => d.encode(&mut builder.init_start_tunnel_q()),
|
RPCQuestionDetail::SupplyBlockQ(d) => {
|
||||||
RPCQuestionDetail::CompleteTunnelQ(d) => {
|
d.encode(&mut builder.reborrow().init_supply_block_q())
|
||||||
d.encode(&mut builder.init_complete_tunnel_q())
|
}
|
||||||
|
RPCQuestionDetail::FindBlockQ(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_find_block_q())
|
||||||
|
}
|
||||||
|
RPCQuestionDetail::StartTunnelQ(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_start_tunnel_q())
|
||||||
|
}
|
||||||
|
RPCQuestionDetail::CompleteTunnelQ(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_complete_tunnel_q())
|
||||||
|
}
|
||||||
|
RPCQuestionDetail::CancelTunnelQ(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_cancel_tunnel_q())
|
||||||
}
|
}
|
||||||
RPCQuestionDetail::CancelTunnelQ(d) => d.encode(&mut builder.init_cancel_tunnel_q()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ impl RPCStatement {
|
|||||||
Ok(RPCStatement { detail })
|
Ok(RPCStatement { detail })
|
||||||
}
|
}
|
||||||
pub fn encode(&self, builder: &mut veilid_capnp::statement::Builder) -> Result<(), RPCError> {
|
pub fn encode(&self, builder: &mut veilid_capnp::statement::Builder) -> Result<(), RPCError> {
|
||||||
self.detail.encode(&mut builder.init_detail())?;
|
self.detail.encode(&mut builder.reborrow().init_detail())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,13 +100,19 @@ impl RPCStatementDetail {
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
match self {
|
match self {
|
||||||
RPCStatementDetail::ValidateDialInfo(d) => {
|
RPCStatementDetail::ValidateDialInfo(d) => {
|
||||||
d.encode(&mut builder.init_validate_dial_info())
|
d.encode(&mut builder.reborrow().init_validate_dial_info())
|
||||||
|
}
|
||||||
|
RPCStatementDetail::Route(d) => d.encode(&mut builder.reborrow().init_route()),
|
||||||
|
RPCStatementDetail::NodeInfoUpdate(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_node_info_update())
|
||||||
|
}
|
||||||
|
RPCStatementDetail::ValueChanged(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_value_changed())
|
||||||
|
}
|
||||||
|
RPCStatementDetail::Signal(d) => d.encode(&mut builder.reborrow().init_signal()),
|
||||||
|
RPCStatementDetail::ReturnReceipt(d) => {
|
||||||
|
d.encode(&mut builder.reborrow().init_return_receipt())
|
||||||
}
|
}
|
||||||
RPCStatementDetail::Route(d) => d.encode(&mut builder.init_route()),
|
|
||||||
RPCStatementDetail::NodeInfoUpdate(d) => d.encode(&mut builder.init_node_info_update()),
|
|
||||||
RPCStatementDetail::ValueChanged(d) => d.encode(&mut builder.init_value_changed()),
|
|
||||||
RPCStatementDetail::Signal(d) => d.encode(&mut builder.init_signal()),
|
|
||||||
RPCStatementDetail::ReturnReceipt(d) => d.encode(&mut builder.init_return_receipt()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@ pub fn encode_value_key(
|
|||||||
value_key: &ValueKey,
|
value_key: &ValueKey,
|
||||||
builder: &mut veilid_capnp::value_key::Builder,
|
builder: &mut veilid_capnp::value_key::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let pk_builder = builder.init_public_key();
|
let mut pk_builder = builder.reborrow().init_public_key();
|
||||||
encode_public_key(&value_key.key, &mut pk_builder)?;
|
encode_public_key(&value_key.key, &mut pk_builder)?;
|
||||||
if let Some(subkey) = value_key.subkey {
|
if let Some(subkey) = &value_key.subkey {
|
||||||
builder.set_subkey(&subkey);
|
builder.set_subkey(subkey);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ struct RPCMessageEncoded {
|
|||||||
data: RPCMessageData,
|
data: RPCMessageData,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RPCMessage {
|
pub(crate) struct RPCMessage {
|
||||||
header: RPCMessageHeader,
|
header: RPCMessageHeader,
|
||||||
operation: RPCOperation,
|
operation: RPCOperation,
|
||||||
opt_sender_nr: Option<NodeRef>,
|
opt_sender_nr: Option<NodeRef>,
|
||||||
@ -426,7 +426,7 @@ impl RPCProcessor {
|
|||||||
|
|
||||||
// To where are we sending the request
|
// To where are we sending the request
|
||||||
match dest {
|
match dest {
|
||||||
Destination::Direct(node_ref) | Destination::Relay(node_ref, _) => {
|
Destination::Direct(ref node_ref) | Destination::Relay(ref node_ref, _) => {
|
||||||
// Send to a node without a private route
|
// Send to a node without a private route
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
|
||||||
@ -453,7 +453,6 @@ impl RPCProcessor {
|
|||||||
Some(sr) => {
|
Some(sr) => {
|
||||||
// No private route was specified for the request
|
// No private route was specified for the request
|
||||||
// but we are using a safety route, so we must create an empty private route
|
// but we are using a safety route, so we must create an empty private route
|
||||||
let mut pr_builder = ::capnp::message::Builder::new_default();
|
|
||||||
let private_route = PrivateRoute::new_stub(node_id);
|
let private_route = PrivateRoute::new_stub(node_id);
|
||||||
|
|
||||||
// first
|
// first
|
||||||
@ -614,7 +613,7 @@ impl RPCProcessor {
|
|||||||
message,
|
message,
|
||||||
node_id,
|
node_id,
|
||||||
node_ref,
|
node_ref,
|
||||||
hop_count,
|
hop_count: _,
|
||||||
} = self.render_operation(dest, &operation, safety_route_spec)?;
|
} = self.render_operation(dest, &operation, safety_route_spec)?;
|
||||||
|
|
||||||
// If we need to resolve the first hop, do it
|
// If we need to resolve the first hop, do it
|
||||||
@ -631,14 +630,10 @@ impl RPCProcessor {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate answer timeout
|
|
||||||
// Timeout is number of hops times the timeout per hop
|
|
||||||
let timeout = self.inner.lock().timeout * (hop_count as u64);
|
|
||||||
|
|
||||||
// Send statement
|
// Send statement
|
||||||
let bytes = message.len() as u64;
|
let bytes = message.len() as u64;
|
||||||
let send_ts = intf::get_timestamp();
|
let send_ts = intf::get_timestamp();
|
||||||
let send_data_kind = match self
|
let _send_data_kind = match self
|
||||||
.network_manager()
|
.network_manager()
|
||||||
.send_envelope(node_ref.clone(), Some(node_id), message)
|
.send_envelope(node_ref.clone(), Some(node_id), message)
|
||||||
.await
|
.await
|
||||||
@ -713,7 +708,7 @@ impl RPCProcessor {
|
|||||||
message,
|
message,
|
||||||
node_id,
|
node_id,
|
||||||
node_ref,
|
node_ref,
|
||||||
hop_count,
|
hop_count: _,
|
||||||
} = self.render_operation(dest, &operation, safety_route_spec)?;
|
} = self.render_operation(dest, &operation, safety_route_spec)?;
|
||||||
|
|
||||||
// If we need to resolve the first hop, do it
|
// If we need to resolve the first hop, do it
|
||||||
@ -863,7 +858,7 @@ impl RPCProcessor {
|
|||||||
RPCStatementDetail::Signal(_) => self.process_signal(msg).await,
|
RPCStatementDetail::Signal(_) => self.process_signal(msg).await,
|
||||||
RPCStatementDetail::ReturnReceipt(_) => self.process_return_receipt(msg).await,
|
RPCStatementDetail::ReturnReceipt(_) => self.process_return_receipt(msg).await,
|
||||||
},
|
},
|
||||||
RPCOperationKind::Answer(a) => self.complete_op_id_waiter(msg).await,
|
RPCOperationKind::Answer(_) => self.complete_op_id_waiter(msg).await,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user