Skip to content

Commit

Permalink
Fix review comments, Iter. 3 -- Fix deserialize_metadata_block() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
s373r committed Feb 8, 2024
1 parent bf80499 commit 6a97561
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/adapter/http/src/smart_protocol/protocol_dataset_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bytes::Bytes;
use flate2::Compression;
use futures::TryStreamExt;
use kamu::domain::*;
use kamu::MetadataBlockRepositoryImpl;
use kamu::{MetadataBlockRepositoryImpl, ObjectRepositoryInMemory};
use opendatafabric::{MetadataBlock, MetadataEvent, Multihash};
use tar::Header;
use thiserror::Error;
Expand Down Expand Up @@ -189,8 +189,12 @@ pub fn decode_metadata_batch(
// This is currently necessary because we need to be able to deserialize blocks
// BEFORE an instance of MetadataChain exists. Consider injecting a
// configurable block deserializer.
MetadataBlockRepositoryImpl::deserialize_metadata_block(&hash, &bytes)
.map(|block| (hash, block))

// In this case, `ObjectRepositoryInMemory` is passed to keep compiler happy
MetadataBlockRepositoryImpl::<ObjectRepositoryInMemory>::deserialize_metadata_block(
&hash, &bytes,
)
.map(|block| (hash, block))
})
.collect::<Result<VecDeque<_>, _>>()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ where

async fn get_block(&self, hash: &Multihash) -> Result<MetadataBlock, GetBlockError> {
let block_data = self.get_block_data(hash).await?;
let block = MetadataBlockRepositoryImpl::deserialize_metadata_block(hash, &block_data)?;
let block =
MetadataBlockRepositoryImpl::<ObjRepo>::deserialize_metadata_block(hash, &block_data)?;

Ok(block)
}
Expand Down

0 comments on commit 6a97561

Please sign in to comment.