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] #[inline]
pub fn calculate_chunkid(chunk: &[u8]) -> ChunkId { 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(); let mut chunk_id: ChunkId = Default::default();
blake::hash(256, &chunk, &mut chunk_id).expect("BLAKE problem"); blake::hash(256, &chunk, &mut chunk_id).expect("BLAKE problem");
chunk_id chunk_id

View File

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

View File

@ -87,6 +87,8 @@ pub fn existence_checker_stage<RP: RawPile>(
pile: Arc<Pile<RP>>, pile: Arc<Pile<RP>>,
next_stage: Sender<(ChunkId, Vec<u8>)>, next_stage: Sender<(ChunkId, Vec<u8>)>,
) -> 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 shared_seen_set: Arc<Mutex<HashSet<ChunkId>>> = Default::default();
let (tx, rx) = crossbeam_channel::bounded::<(ChunkId, Vec<u8>)>(32); 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 { pub trait RawPile: Send + Sync + Debug + 'static {
// TODO expose verification errors? // TODO expose verification errors?
fn exists(&self, kind: Keyspace, key: &[u8]) -> anyhow::Result<bool>; fn exists(&self, kind: Keyspace, key: &[u8]) -> anyhow::Result<bool>;