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 {
|
||||
Self { detail }
|
||||
}
|
||||
pub fn detail(&self) -> &RPCAnswerDetail {
|
||||
&self.detail
|
||||
}
|
||||
// pub fn detail(&self) -> &RPCAnswerDetail {
|
||||
// &self.detail
|
||||
// }
|
||||
pub fn into_detail(self) -> RPCAnswerDetail {
|
||||
self.detail
|
||||
}
|
||||
@ -26,7 +26,7 @@ impl RPCAnswer {
|
||||
Ok(RPCAnswer { detail })
|
||||
}
|
||||
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(())
|
||||
}
|
||||
}
|
||||
@ -124,16 +124,26 @@ impl RPCAnswerDetail {
|
||||
builder: &mut veilid_capnp::answer::detail::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCAnswerDetail::StatusA(d) => d.encode(&mut builder.init_status_a()),
|
||||
RPCAnswerDetail::FindNodeA(d) => d.encode(&mut builder.init_find_node_a()),
|
||||
RPCAnswerDetail::GetValueA(d) => d.encode(&mut builder.init_get_value_a()),
|
||||
RPCAnswerDetail::SetValueA(d) => d.encode(&mut builder.init_set_value_a()),
|
||||
RPCAnswerDetail::WatchValueA(d) => d.encode(&mut builder.init_watch_value_a()),
|
||||
RPCAnswerDetail::SupplyBlockA(d) => d.encode(&mut builder.init_supply_block_a()),
|
||||
RPCAnswerDetail::FindBlockA(d) => d.encode(&mut builder.init_find_block_a()),
|
||||
RPCAnswerDetail::StartTunnelA(d) => d.encode(&mut builder.init_start_tunnel_a()),
|
||||
RPCAnswerDetail::CompleteTunnelA(d) => d.encode(&mut builder.init_complete_tunnel_a()),
|
||||
RPCAnswerDetail::CancelTunnelA(d) => d.encode(&mut builder.init_cancel_tunnel_a()),
|
||||
RPCAnswerDetail::StatusA(d) => d.encode(&mut builder.reborrow().init_status_a()),
|
||||
RPCAnswerDetail::FindNodeA(d) => d.encode(&mut builder.reborrow().init_find_node_a()),
|
||||
RPCAnswerDetail::GetValueA(d) => d.encode(&mut builder.reborrow().init_get_value_a()),
|
||||
RPCAnswerDetail::SetValueA(d) => d.encode(&mut builder.reborrow().init_set_value_a()),
|
||||
RPCAnswerDetail::WatchValueA(d) => {
|
||||
d.encode(&mut builder.reborrow().init_watch_value_a())
|
||||
}
|
||||
RPCAnswerDetail::SupplyBlockA(d) => {
|
||||
d.encode(&mut builder.reborrow().init_supply_block_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,
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCOperationKind::Question(k) => k.encode(&mut builder.init_question()),
|
||||
RPCOperationKind::Statement(k) => k.encode(&mut builder.init_statement()),
|
||||
RPCOperationKind::Answer(k) => k.encode(&mut builder.init_answer()),
|
||||
};
|
||||
Ok(())
|
||||
RPCOperationKind::Question(k) => k.encode(&mut builder.reborrow().init_question()),
|
||||
RPCOperationKind::Statement(k) => k.encode(&mut builder.reborrow().init_statement()),
|
||||
RPCOperationKind::Answer(k) => k.encode(&mut builder.reborrow().init_answer()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +92,7 @@ impl RPCOperation {
|
||||
&self.kind
|
||||
}
|
||||
|
||||
pub fn into_kind(&self) -> RPCOperationKind {
|
||||
pub fn into_kind(self) -> RPCOperationKind {
|
||||
self.kind
|
||||
}
|
||||
|
||||
@ -111,7 +110,7 @@ impl RPCOperation {
|
||||
|
||||
pub fn encode(&self, builder: &mut veilid_capnp::operation::Builder) -> Result<(), RPCError> {
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ impl RPCOperationCompleteTunnelQ {
|
||||
TunnelMode::Turn => veilid_capnp::TunnelEndpointMode::Turn,
|
||||
});
|
||||
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)?;
|
||||
|
||||
Ok(())
|
||||
@ -77,7 +77,7 @@ impl RPCOperationCompleteTunnelA {
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCOperationCompleteTunnelA::Tunnel(p) => {
|
||||
encode_full_tunnel(p, &mut builder.init_tunnel())?;
|
||||
encode_full_tunnel(p, &mut builder.reborrow().init_tunnel())?;
|
||||
}
|
||||
RPCOperationCompleteTunnelA::Error(e) => {
|
||||
builder.set_error(encode_tunnel_error(*e));
|
||||
|
@ -19,7 +19,7 @@ impl RPCOperationFindBlockQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_find_block_q::Builder,
|
||||
) -> 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)?;
|
||||
|
||||
Ok(())
|
||||
@ -79,7 +79,7 @@ impl RPCOperationFindBlockA {
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_data(&self.data);
|
||||
|
||||
let mut suppliers_builder = builder.init_suppliers(
|
||||
let mut suppliers_builder = builder.reborrow().init_suppliers(
|
||||
self.suppliers
|
||||
.len()
|
||||
.try_into()
|
||||
@ -90,7 +90,7 @@ impl RPCOperationFindBlockA {
|
||||
encode_peer_info(peer, &mut pi_builder)?;
|
||||
}
|
||||
|
||||
let mut peers_builder = builder.init_peers(
|
||||
let mut peers_builder = builder.reborrow().init_peers(
|
||||
self.peers
|
||||
.len()
|
||||
.try_into()
|
||||
|
@ -18,7 +18,7 @@ impl RPCOperationFindNodeQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_find_node_q::Builder,
|
||||
) -> 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)?;
|
||||
Ok(())
|
||||
}
|
||||
@ -51,7 +51,7 @@ impl RPCOperationFindNodeA {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_find_node_a::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
let mut peers_builder = builder.init_peers(
|
||||
let mut peers_builder = builder.reborrow().init_peers(
|
||||
self.peers
|
||||
.len()
|
||||
.try_into()
|
||||
|
@ -18,7 +18,7 @@ impl RPCOperationGetValueQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_get_value_q::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
let k_builder = builder.init_key();
|
||||
let mut k_builder = builder.reborrow().init_key();
|
||||
encode_value_key(&self.key, &mut k_builder)?;
|
||||
Ok(())
|
||||
}
|
||||
@ -62,11 +62,11 @@ impl RPCOperationGetValueA {
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCOperationGetValueA::Data(data) => {
|
||||
let d_builder = builder.init_data();
|
||||
let mut d_builder = builder.reborrow().init_data();
|
||||
encode_value_data(&data, &mut d_builder)?;
|
||||
}
|
||||
RPCOperationGetValueA::Peers(peers) => {
|
||||
let mut peers_builder = builder.init_peers(
|
||||
let mut peers_builder = builder.reborrow().init_peers(
|
||||
peers
|
||||
.len()
|
||||
.try_into()
|
||||
|
@ -22,7 +22,7 @@ impl RPCOperationNodeInfoUpdate {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_node_info_update::Builder,
|
||||
) -> 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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ impl RoutedOperation {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::routed_operation::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
let mut sigs_builder = builder.init_signatures(
|
||||
let mut sigs_builder = builder.reborrow().init_signatures(
|
||||
self.signatures
|
||||
.len()
|
||||
.try_into()
|
||||
@ -60,7 +60,7 @@ impl RoutedOperation {
|
||||
let mut sig_builder = sigs_builder.reborrow().get(i as u32);
|
||||
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);
|
||||
builder.set_data(&self.data);
|
||||
|
||||
@ -95,9 +95,9 @@ impl RPCOperationRoute {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_route::Builder,
|
||||
) -> 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)?;
|
||||
let o_builder = builder.init_operation();
|
||||
let mut o_builder = builder.reborrow().init_operation();
|
||||
self.operation.encode(&mut o_builder)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ impl RPCOperationSetValueQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_set_value_q::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
let k_builder = builder.init_key();
|
||||
let mut k_builder = builder.reborrow().init_key();
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
@ -67,11 +67,11 @@ impl RPCOperationSetValueA {
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCOperationSetValueA::Data(data) => {
|
||||
let d_builder = builder.init_data();
|
||||
let mut d_builder = builder.reborrow().init_data();
|
||||
encode_value_data(&data, &mut d_builder)?;
|
||||
}
|
||||
RPCOperationSetValueA::Peers(peers) => {
|
||||
let mut peers_builder = builder.init_peers(
|
||||
let mut peers_builder = builder.reborrow().init_peers(
|
||||
peers
|
||||
.len()
|
||||
.try_into()
|
||||
|
@ -17,7 +17,7 @@ impl RPCOperationSignal {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_signal::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
encode_signal_info(&self.signal_info, &mut builder)?;
|
||||
encode_signal_info(&self.signal_info, builder)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ impl RPCOperationStartTunnelA {
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCOperationStartTunnelA::Partial(p) => {
|
||||
encode_partial_tunnel(p, &mut builder.init_partial())?;
|
||||
encode_partial_tunnel(p, &mut builder.reborrow().init_partial())?;
|
||||
}
|
||||
RPCOperationStartTunnelA::Error(e) => {
|
||||
builder.set_error(encode_tunnel_error(*e));
|
||||
|
@ -18,7 +18,7 @@ impl RPCOperationStatusQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_status_q::Builder,
|
||||
) -> 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)?;
|
||||
Ok(())
|
||||
}
|
||||
@ -49,9 +49,9 @@ impl RPCOperationStatusA {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_status_a::Builder,
|
||||
) -> 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)?;
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ impl RPCOperationSupplyBlockQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_supply_block_q::Builder,
|
||||
) -> 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)?;
|
||||
|
||||
Ok(())
|
||||
@ -66,7 +66,7 @@ impl RPCOperationSupplyBlockA {
|
||||
builder.set_expiration(*e);
|
||||
}
|
||||
RPCOperationSupplyBlockA::Peers(peers) => {
|
||||
let mut peers_builder = builder.init_peers(
|
||||
let mut peers_builder = builder.reborrow().init_peers(
|
||||
peers
|
||||
.len()
|
||||
.try_into()
|
||||
|
@ -28,7 +28,7 @@ impl RPCOperationValidateDialInfo {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_validate_dial_info::Builder,
|
||||
) -> 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)?;
|
||||
builder.set_receipt(&self.receipt);
|
||||
builder.set_redirect(self.redirect);
|
||||
|
@ -21,9 +21,9 @@ impl RPCOperationValueChanged {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_value_changed::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
let k_builder = builder.init_key();
|
||||
let mut k_builder = builder.reborrow().init_key();
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ impl RPCOperationWatchValueQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_watch_value_q::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
let k_builder = builder.init_key();
|
||||
let mut k_builder = builder.reborrow().init_key();
|
||||
encode_value_key(&self.key, &mut k_builder)?;
|
||||
Ok(())
|
||||
}
|
||||
@ -55,7 +55,7 @@ impl RPCOperationWatchValueA {
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_expiration(self.expiration);
|
||||
|
||||
let mut peers_builder = builder.init_peers(
|
||||
let mut peers_builder = builder.reborrow().init_peers(
|
||||
self.peers
|
||||
.len()
|
||||
.try_into()
|
||||
|
@ -18,12 +18,12 @@ impl RPCQuestion {
|
||||
pub fn detail(&self) -> &RPCQuestionDetail {
|
||||
&self.detail
|
||||
}
|
||||
pub fn into_detail(self) -> RPCQuestionDetail {
|
||||
self.detail
|
||||
}
|
||||
pub fn into_respond_to_detail(self) -> (RespondTo, RPCQuestionDetail) {
|
||||
(self.respond_to, self.detail)
|
||||
}
|
||||
// pub fn into_detail(self) -> RPCQuestionDetail {
|
||||
// self.detail
|
||||
// }
|
||||
// pub fn into_respond_to_detail(self) -> (RespondTo, RPCQuestionDetail) {
|
||||
// (self.respond_to, self.detail)
|
||||
// }
|
||||
pub fn desc(&self) -> &'static str {
|
||||
self.detail.desc()
|
||||
}
|
||||
@ -38,8 +38,9 @@ impl RPCQuestion {
|
||||
Ok(RPCQuestion { respond_to, detail })
|
||||
}
|
||||
pub fn encode(&self, builder: &mut veilid_capnp::question::Builder) -> Result<(), RPCError> {
|
||||
self.respond_to.encode(&mut builder.init_respond_to())?;
|
||||
self.detail.encode(&mut builder.init_detail())?;
|
||||
self.respond_to
|
||||
.encode(&mut builder.reborrow().init_respond_to())?;
|
||||
self.detail.encode(&mut builder.reborrow().init_detail())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -137,18 +138,28 @@ impl RPCQuestionDetail {
|
||||
builder: &mut veilid_capnp::question::detail::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCQuestionDetail::StatusQ(d) => d.encode(&mut builder.init_status_q()),
|
||||
RPCQuestionDetail::FindNodeQ(d) => d.encode(&mut builder.init_find_node_q()),
|
||||
RPCQuestionDetail::GetValueQ(d) => d.encode(&mut builder.init_get_value_q()),
|
||||
RPCQuestionDetail::SetValueQ(d) => d.encode(&mut builder.init_set_value_q()),
|
||||
RPCQuestionDetail::WatchValueQ(d) => d.encode(&mut builder.init_watch_value_q()),
|
||||
RPCQuestionDetail::SupplyBlockQ(d) => d.encode(&mut builder.init_supply_block_q()),
|
||||
RPCQuestionDetail::FindBlockQ(d) => d.encode(&mut builder.init_find_block_q()),
|
||||
RPCQuestionDetail::StartTunnelQ(d) => d.encode(&mut builder.init_start_tunnel_q()),
|
||||
RPCQuestionDetail::CompleteTunnelQ(d) => {
|
||||
d.encode(&mut builder.init_complete_tunnel_q())
|
||||
RPCQuestionDetail::StatusQ(d) => d.encode(&mut builder.reborrow().init_status_q()),
|
||||
RPCQuestionDetail::FindNodeQ(d) => d.encode(&mut builder.reborrow().init_find_node_q()),
|
||||
RPCQuestionDetail::GetValueQ(d) => d.encode(&mut builder.reborrow().init_get_value_q()),
|
||||
RPCQuestionDetail::SetValueQ(d) => d.encode(&mut builder.reborrow().init_set_value_q()),
|
||||
RPCQuestionDetail::WatchValueQ(d) => {
|
||||
d.encode(&mut builder.reborrow().init_watch_value_q())
|
||||
}
|
||||
RPCQuestionDetail::SupplyBlockQ(d) => {
|
||||
d.encode(&mut builder.reborrow().init_supply_block_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 })
|
||||
}
|
||||
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(())
|
||||
}
|
||||
}
|
||||
@ -100,13 +100,19 @@ impl RPCStatementDetail {
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
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,
|
||||
builder: &mut veilid_capnp::value_key::Builder,
|
||||
) -> 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)?;
|
||||
if let Some(subkey) = value_key.subkey {
|
||||
builder.set_subkey(&subkey);
|
||||
if let Some(subkey) = &value_key.subkey {
|
||||
builder.set_subkey(subkey);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ struct RPCMessageEncoded {
|
||||
data: RPCMessageData,
|
||||
}
|
||||
|
||||
struct RPCMessage {
|
||||
pub(crate) struct RPCMessage {
|
||||
header: RPCMessageHeader,
|
||||
operation: RPCOperation,
|
||||
opt_sender_nr: Option<NodeRef>,
|
||||
@ -426,7 +426,7 @@ impl RPCProcessor {
|
||||
|
||||
// To where are we sending the request
|
||||
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
|
||||
// --------------------------------------
|
||||
|
||||
@ -453,7 +453,6 @@ impl RPCProcessor {
|
||||
Some(sr) => {
|
||||
// No private route was specified for the request
|
||||
// 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);
|
||||
|
||||
// first
|
||||
@ -614,7 +613,7 @@ impl RPCProcessor {
|
||||
message,
|
||||
node_id,
|
||||
node_ref,
|
||||
hop_count,
|
||||
hop_count: _,
|
||||
} = self.render_operation(dest, &operation, safety_route_spec)?;
|
||||
|
||||
// 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
|
||||
let bytes = message.len() as u64;
|
||||
let send_ts = intf::get_timestamp();
|
||||
let send_data_kind = match self
|
||||
let _send_data_kind = match self
|
||||
.network_manager()
|
||||
.send_envelope(node_ref.clone(), Some(node_id), message)
|
||||
.await
|
||||
@ -713,7 +708,7 @@ impl RPCProcessor {
|
||||
message,
|
||||
node_id,
|
||||
node_ref,
|
||||
hop_count,
|
||||
hop_count: _,
|
||||
} = self.render_operation(dest, &operation, safety_route_spec)?;
|
||||
|
||||
// If we need to resolve the first hop, do it
|
||||
@ -863,7 +858,7 @@ impl RPCProcessor {
|
||||
RPCStatementDetail::Signal(_) => self.process_signal(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