diff options
Diffstat (limited to 'src/transport/mod.rs')
| -rw-r--r-- | src/transport/mod.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 7bc6ae0..ee63988 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -261,8 +261,9 @@ pub(crate) enum ParsedMessage { /// SPEAKS: the wire versions the sender speaks, the oldest and the newest, and the /// newest revision of the federation it knows, by ID, where it is built with the -/// federation. Sent with every handshake, in a layout no build changes (`wire::SPEAKS`): -/// a build that doesn't know it ignores it, as a message of another wire version. +/// federation. Sent with every handshake, and ahead of every WHO and ME +/// (`transport::identity`), in a layout no build changes (`wire::SPEAKS`): a build that +/// doesn't know it ignores it, as a message of another wire version. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) struct Speaks { pub(crate) oldest: u8, @@ -1198,7 +1199,18 @@ pub(crate) trait Transport: Send + Sync { /// identity, as `local_id` gives it on that node. async fn resolve_seed(&self, seed: &str) -> Result<String>; - fn encode(&self, peer: &str, message: &ParsedMessage) -> Result<EncodedMessage>; + /// `message` to `peer` in wire `version`, one this build speaks (`wire::OLDEST..= + /// wire::VERSION`). The identity layer writes to each node in the newest version both + /// speak, whatever is asked (`Paths::version_at`). + fn encode_in(&self, peer: &str, message: &ParsedMessage, version: u8) + -> Result<EncodedMessage>; + + /// `message` to `peer` in the newest wire version; under the identity layer, in the one + /// `peer` speaks. + fn encode(&self, peer: &str, message: &ParsedMessage) -> Result<EncodedMessage> { + self.encode_in(peer, message, wire::VERSION) + } + async fn send_encoded(&self, message: &EncodedMessage) -> Result<()>; /// Sends an outbound message payload to a targeted peer on a specific topic. |
