aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/mod.rs19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index c10e0d8..cef31ff 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -1,6 +1,5 @@
use anyhow::Result;
use async_trait::async_trait;
-use automerge::sync::Message;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::boxed::Box;
@@ -681,23 +680,13 @@ impl DeltaSpec {
}
}
-/// An Automerge sync message in Automerge's own encoding. Decoded only where it is
-/// applied (`decode`), after the sender proved to be a member and off the consumer: a
-/// large message from anyone else costs nothing but its bytes.
+/// A sync message as the document's engine encodes it (`state::session`): bytes to the
+/// transports. Decoded only where it is applied (`state::decode_sync`), after the sender
+/// proved to be a member and off the consumer: a large message from anyone else costs
+/// nothing but its bytes.
#[derive(Clone)]
pub(crate) struct SyncPayload(pub(crate) bytes::Bytes);
-impl SyncPayload {
- pub(crate) fn encode(message: Message) -> Self {
- Self(message.encode().into())
- }
-
- pub(crate) fn decode(&self) -> Result<Message> {
- Message::decode(&self.0)
- .map_err(|error| anyhow::anyhow!("Automerge decode failed: {error:?}"))
- }
-}
-
/// Sizes instead of contents: logged messages stay short.
impl std::fmt::Debug for SyncPayload {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {