aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/mycelium.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-24 18:18:29 +0200
committertv <tv@krebsco.de>2026-10-24 18:18:29 +0200
commit96f033f77264d7f47cbfa953f8ddbbfb563e6115 (patch)
tree351d1d4980db1e433ec91bf87191acbca961af8b /src/transport/mycelium.rs
parent2044eba5744be090d9a8111a91fc2589770f9e7a (diff)
put remake content into blobs
Diffstat (limited to 'src/transport/mycelium.rs')
-rw-r--r--src/transport/mycelium.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/transport/mycelium.rs b/src/transport/mycelium.rs
index a8ab104..82e6016 100644
--- a/src/transport/mycelium.rs
+++ b/src/transport/mycelium.rs
@@ -1029,6 +1029,7 @@ pub fn bytes_to_sync_envelope(bytes: &[u8]) -> Result<SyncEnvelope, TransportErr
#[derive(Serialize, Deserialize)]
enum BlobIdShadow {
Change(ByteBuf),
+ Content(ByteBuf),
}
#[derive(Serialize, Deserialize)]
@@ -1058,6 +1059,7 @@ struct BlobShadow {
fn blob_to_bytes(msg: &BlobMessage) -> Result<Vec<u8>, rmp_serde::encode::Error> {
let id = match msg.id {
BlobId::Change(hash) => BlobIdShadow::Change(ByteBuf::from(hash.0.to_vec())),
+ BlobId::Content(hash) => BlobIdShadow::Content(ByteBuf::from(hash.to_vec())),
};
let body = match &msg.body {
BlobBody::Request { chunks } => BlobBodyShadow::Request {
@@ -1098,6 +1100,7 @@ fn bytes_to_blob(bytes: &[u8]) -> Result<BlobMessage, TransportError> {
let shadow: BlobShadow = rmp_serde::from_slice(bytes)?;
let id = match shadow.id {
BlobIdShadow::Change(hash) => BlobId::Change(ChangeHash(hash32(&hash, "a change hash")?)),
+ BlobIdShadow::Content(hash) => BlobId::Content(hash32(&hash, "a content hash")?),
};
let body = match shadow.body {
BlobBodyShadow::Request { chunks } => BlobBody::Request { chunks },