Skip to content

Commit

Permalink
Revert "refactor: move stream out of use for now"
Browse files Browse the repository at this point in the history
This reverts commit 642e58f.
  • Loading branch information
dirvine committed Dec 12, 2024
1 parent 389b305 commit 3466715
Show file tree
Hide file tree
Showing 4 changed files with 704 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ pub struct EncryptedChunk {
/// The encrypted content of the chunk
pub content: Bytes,
}

/// Calculate (start_position, end_position) for each chunk for the input file size
pub(crate) fn batch_positions(data_size: usize) -> Vec<(usize, usize)> {
let num_chunks = crate::get_num_chunks(data_size);

(0..num_chunks)
.map(|index| crate::get_start_end_positions(data_size, index))
.collect()
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ mod error;
mod python;
pub mod test_helpers;
mod utils;
/// Stream encryption and decryption
pub mod stream;

pub use chunk::EncryptedChunk;
pub use decrypt::decrypt_chunk;
Expand All @@ -107,6 +109,7 @@ pub use xor_name::XorName;
pub use self::{
data_map::{ChunkInfo, DataMap},
error::{Error, Result},
stream::{StreamSelfDecryptor, StreamSelfEncryptor},
};
use bytes::Bytes;
use lazy_static::lazy_static;
Expand Down
Loading

0 comments on commit 3466715

Please sign in to comment.