Make some remarks about where I'd like to go

This commit is contained in:
Olivier 'reivilibre' 2022-05-28 22:14:43 +01:00
parent 56dafc6b5f
commit a06b393630
3 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,8 @@ impl<'cst, CST: ChunkSubmissionTarget> Write for RecursiveChunker<'cst, CST> {
#[inline]
pub fn calculate_chunkid(chunk: &[u8]) -> ChunkId {
// TODO(newver) Allow pluggable chunkID calculations so that encrypted storage can work without
// leaking contents.
let mut chunk_id: ChunkId = Default::default();
blake::hash(256, &chunk, &mut chunk_id).expect("BLAKE problem");
chunk_id

View File

@ -265,7 +265,10 @@ pub fn store_fully<PT: ProgressTracker>(
let (control_tx, control_rx) = crossbeam_channel::unbounded();
let pile2 = pile.clone();
let pipeline = pile.raw_pile.build_storage_pipeline(sps, control_tx)?;
// TODO(newver) The existence checker stage should be able to be swapped between different implementations.
let pipeline = existence_checker_stage(pile2, pipeline);
store(
&root_dir,
&mut root_node,
@ -309,6 +312,7 @@ pub fn store_fully<PT: ProgressTracker>(
gid_lookup,
};
// TODO(newver) Allow the pointer to be returned separately.
pile.write_pointer(&new_pointer_name, &pointer_data)?;
pile.flush()?;
Ok(())

View File

@ -87,6 +87,8 @@ pub fn existence_checker_stage<RP: RawPile>(
pile: Arc<Pile<RP>>,
next_stage: Sender<(ChunkId, Vec<u8>)>,
) -> Sender<(ChunkId, Vec<u8>)> {
// TODO(newver) Do better than this.
let shared_seen_set: Arc<Mutex<HashSet<ChunkId>>> = Default::default();
let (tx, rx) = crossbeam_channel::bounded::<(ChunkId, Vec<u8>)>(32);
@ -123,6 +125,8 @@ pub enum ControllerMessage {
},
}
// TODO(newver) Make piles async
pub trait RawPile: Send + Sync + Debug + 'static {
// TODO expose verification errors?
fn exists(&self, kind: Keyspace, key: &[u8]) -> anyhow::Result<bool>;