aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/mod.rs')
-rw-r--r--src/transport/mod.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index 61abe9c..4189890 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -114,6 +114,9 @@ pub(crate) enum HeadsSummary {
/// of starting the sync over to find out what it lacks.
sample: Vec<ChangeHash>,
},
+ /// Where a document of another kind than Automerge's stands, as that kind's bytes
+ /// (`docs/document.md`, Passing on): neither heads nor a digest of any.
+ Kind(Vec<u8>),
}
/// Where the next sample starts (`HeadsSummary::of`).
@@ -144,6 +147,7 @@ impl HeadsSummary {
match self {
Self::Heads(heads) => digest_of(heads),
Self::Digest { digest, .. } => *digest,
+ Self::Kind(bytes) => Sha256::digest(bytes).into(),
}
}
@@ -151,7 +155,7 @@ impl HeadsSummary {
pub(crate) fn heads(&self) -> Option<&[ChangeHash]> {
match self {
Self::Heads(heads) => Some(heads),
- Self::Digest { .. } => None,
+ Self::Digest { .. } | Self::Kind(_) => None,
}
}
@@ -160,6 +164,7 @@ impl HeadsSummary {
match self {
Self::Heads(heads) => heads,
Self::Digest { sample, .. } => sample,
+ Self::Kind(_) => &[],
}
}
}
@@ -845,6 +850,9 @@ pub(crate) enum SyncBody {
/// Instead of a message too large to send in one piece: fetch these changes as a
/// blob (`BlobId::Delta`), then sync on.
Delta(DeltaSpec),
+ /// What a document of another kind than Automerge's says, as that kind's bytes
+ /// (`docs/document.md`, Passing on).
+ Kind(#[serde(with = "serde_bytes")] Vec<u8>),
}
/// The changes in the history of `to` but not of `from`: what a peer at `from` lacks of
@@ -934,6 +942,10 @@ impl std::fmt::Debug for SyncBody {
)
.finish(),
Self::Delta(spec) => f.debug_tuple("Delta").field(spec).finish(),
+ Self::Kind(bytes) => f
+ .debug_tuple("Kind")
+ .field(&format!("{} bytes", bytes.len()))
+ .finish(),
}
}
}