netapp/examples/fullmesh.rs

227 lines
5.6 KiB
Rust
Raw Normal View History

use std::io::Write;
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
use std::net;
2022-07-26 10:01:13 +00:00
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use bytes::Bytes;
use futures::{stream, StreamExt};
use log::*;
use serde::{Deserialize, Serialize};
2020-12-02 12:30:47 +00:00
use structopt::StructOpt;
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
2022-07-26 10:01:13 +00:00
use tokio::sync::watch;
2020-12-02 12:30:47 +00:00
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
use tokio_unix_tcp::NamedSocketAddr;
2020-12-02 12:30:47 +00:00
use sodiumoxide::crypto::auth;
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
use sodiumoxide::crypto::sign::{ed25519, PublicKey};
2020-12-02 12:30:47 +00:00
2022-07-26 10:01:13 +00:00
use netapp::endpoint::*;
use netapp::message::*;
2020-12-02 12:30:47 +00:00
use netapp::peering::fullmesh::*;
use netapp::util::*;
2022-07-26 10:01:13 +00:00
use netapp::{NetApp, NodeID};
2020-12-02 12:30:47 +00:00
#[derive(StructOpt, Debug)]
#[structopt(name = "netapp")]
pub struct Opt {
#[structopt(long = "network-key", short = "n")]
network_key: Option<String>,
#[structopt(long = "private-key", short = "p")]
private_key: Option<String>,
#[structopt(long = "bootstrap-peer", short = "b")]
bootstrap_peers: Vec<String>,
#[structopt(long = "listen-addr", short = "l", default_value = "127.0.0.1:1980")]
listen_addr: String,
#[structopt(long = "public-addr", short = "a")]
public_addr: Option<String>,
2020-12-02 12:30:47 +00:00
}
#[tokio::main]
async fn main() {
2020-12-04 12:58:34 +00:00
env_logger::Builder::new()
.parse_env("RUST_LOG")
.format(|buf, record| {
writeln!(
buf,
"{} {} {} {}",
chrono::Local::now().format("%s%.6f"),
record.module_path().unwrap_or("_"),
record.level(),
record.args()
)
2020-12-04 12:58:34 +00:00
})
.init();
2020-12-02 12:30:47 +00:00
let opt = Opt::from_args();
let netid = match &opt.network_key {
Some(k) => auth::Key::from_slice(&hex::decode(k).unwrap()).unwrap(),
None => auth::gen_key(),
};
info!("Network key: {}", hex::encode(&netid));
let privkey = match &opt.private_key {
Some(k) => ed25519::SecretKey::from_slice(&hex::decode(k).unwrap()).unwrap(),
None => {
let (_pk, sk) = ed25519::gen_keypair();
sk
}
};
info!("Node private key: {}", hex::encode(&privkey));
2023-01-31 22:57:33 +00:00
info!("Node public key: {}", hex::encode(privkey.public_key()));
2020-12-02 12:30:47 +00:00
let public_addr = opt.public_addr.map(|x| x.parse().unwrap());
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
let listen_addr: net::SocketAddr = opt.listen_addr.parse().unwrap();
info!("Node public address: {:?}", public_addr);
info!("Node listen address: {}", listen_addr);
let netapp = NetApp::new(0u64, netid.clone(), privkey.clone());
2020-12-02 12:30:47 +00:00
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
let mut bootstrap_peers: Vec<(PublicKey, NamedSocketAddr)> = vec![];
2020-12-02 12:30:47 +00:00
for peer in opt.bootstrap_peers.iter() {
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
bootstrap_peers.push(
parse_peer_addr(peer)
.map(|(node_id, socket_bind_addr)| (node_id, socket_bind_addr.into()))
.expect("Invalid peer address"),
);
2020-12-02 12:30:47 +00:00
}
let peering = FullMeshPeeringStrategy::new(
netapp.clone(),
bootstrap_peers,
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
public_addr.map(|a| net::SocketAddr::new(a, listen_addr.port()).into()),
);
info!("Add more peers to this mesh by running: fullmesh -n {} -l 127.0.0.1:$((1000 + $RANDOM)) -b {}@{}",
hex::encode(&netid),
2023-01-31 22:57:33 +00:00
hex::encode(privkey.public_key()),
listen_addr);
let watch_cancel = netapp::util::watch_ctrl_c();
2022-07-26 10:01:13 +00:00
let example = Arc::new(Example {
netapp: netapp.clone(),
fullmesh: peering.clone(),
example_endpoint: netapp.endpoint("__netapp/examples/fullmesh.rs/Example".into()),
});
example.example_endpoint.set_handler(example.clone());
tokio::join!(
2022-07-26 10:01:13 +00:00
example.exchange_loop(watch_cancel.clone()),
everywhere: support unix sockets This patch adds support for listening on and connecting to unix sockets. This requires having wrapper types for various tokio specific network abstractions while also supporting things like serialization and deserialization. Unfortionately i was unable to find a published crate fulfilling these requirements. For this reason I've published a crate myself. Called `tokio-unix-tcp`, it serves as a drop in replacement for Tokio's TCP and Unix network types. I plan to maintain this library outside the scope of this project as well, in general the code should be simple and stable enough however to not require maintainance going forward. As i said this crate aims to support the requirement mentioned above. In addition to this it also strives to be more correct about handling the different types of unix sockets, which the libraries i reviewed were weak at. A list of these crates can be found in the crate README under "Related work". --- The changes to netapp can be summarized as the following: - `std::net::SocketAddr` has been replaced by `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates a IP address and port as well as a path in its variants and describes a concrete socket address netapp can bind or connect to. - In some places `tokio_unix_tcp::SocketAddr` is used instead of `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to the way unix sockets work: The remote peer of a client from the perspective of a server is not a concrete path but `unnamed`. They just share a file descriptor for the actual communication channel. The local address of the server is the actual file system path the server is listening on. In some cases netapp might be configured to connect to another peer using a unix socket and to not send a reachable IP address and port or unix socket path using the `HelloMessage`. As per the above (the client's remote address will be `unnamed`), we have no way of connecting back to that peer. This will currently cause the connection to be aborted by the server. - Listening on Unix sockets requires some additional handling like removing a previous file at the bind path and setting a correct mode (defaulting to `0o222` currently). This is handled by `tokio_unix_tcp`. --- I've tested these changes by including them in garage and running basic administration commands against a node and by running the unit tests here. Basalt peering is currently lacking a proper cost calculation for unix sockets - I'm sadly not familiar with this code.
2023-10-20 00:38:41 +00:00
netapp.listen(listen_addr.into(), public_addr, watch_cancel.clone()),
peering.run(watch_cancel),
);
2020-12-02 12:30:47 +00:00
}
2022-07-26 10:01:13 +00:00
// ----
struct Example {
netapp: Arc<NetApp>,
fullmesh: Arc<FullMeshPeeringStrategy>,
example_endpoint: Arc<Endpoint<ExampleMessage, Self>>,
}
impl Example {
async fn exchange_loop(self: Arc<Self>, must_exit: watch::Receiver<bool>) {
let mut i = 12000;
while !*must_exit.borrow() {
tokio::time::sleep(Duration::from_secs(2)).await;
2022-07-26 10:01:13 +00:00
let peers = self.fullmesh.get_peer_list();
for p in peers.iter() {
let id = p.id;
if id == self.netapp.id {
continue;
}
i += 1;
let example_field = i;
let self2 = self.clone();
tokio::spawn(async move {
info!(
"Send example query {} to {}",
example_field,
hex::encode(id)
);
2022-09-12 15:19:26 +00:00
// Fake data stream with some delays in item production
2022-07-26 10:01:13 +00:00
let stream =
Box::pin(stream::iter([100, 200, 300, 400]).then(|x| async move {
tokio::time::sleep(Duration::from_millis(500)).await;
2022-07-26 10:01:13 +00:00
Ok(Bytes::from(vec![(x % 256) as u8; 133 * x]))
}));
match self2
.example_endpoint
.call_streaming(
&id,
Req::new(ExampleMessage { example_field })
.unwrap()
.with_stream(stream),
PRIO_NORMAL,
)
.await
{
Ok(resp) => {
let (resp, stream) = resp.into_parts();
info!(
"Got example response to {} from {}: {:?}",
example_field,
hex::encode(id),
resp
);
let mut stream = stream.unwrap();
while let Some(x) = stream.next().await {
info!("Response: stream got bytes {:?}", x.map(|b| b.len()));
}
}
Err(e) => warn!("Error with example request: {}", e),
}
});
}
}
}
}
#[async_trait]
impl StreamingEndpointHandler<ExampleMessage> for Example {
async fn handle(
self: &Arc<Self>,
mut msg: Req<ExampleMessage>,
_from: NodeID,
) -> Resp<ExampleMessage> {
info!(
"Got example message: {:?}, sending example response",
msg.msg()
);
let source_stream = msg.take_stream().unwrap();
2022-09-12 15:19:26 +00:00
// Return same stream with 300ms delay
2022-07-26 10:01:13 +00:00
let new_stream = Box::pin(source_stream.then(|x| async move {
tokio::time::sleep(Duration::from_millis(300)).await;
2022-09-12 15:19:26 +00:00
x
2022-07-26 10:01:13 +00:00
}));
Resp::new(ExampleResponse {
example_field: false,
})
.with_stream(new_stream)
}
}
#[derive(Serialize, Deserialize, Debug)]
struct ExampleMessage {
example_field: usize,
}
#[derive(Serialize, Deserialize, Debug)]
struct ExampleResponse {
example_field: bool,
}
impl Message for ExampleMessage {
type Response = ExampleResponse;
}