@@ -148,7 +148,7 @@ pub struct EncryptedChunk {
148
148
#[ derive( Clone ) ]
149
149
pub struct StreamSelfEncryptor {
150
150
// File path for the encryption target.
151
- file_path : Box < PathBuf > ,
151
+ file_path : PathBuf ,
152
152
// List of `(start_position, end_position)` for each chunk for the target file.
153
153
batch_positions : Vec < ( usize , usize ) > ,
154
154
// Current step (i.e. chunk_index) for encryption
@@ -158,15 +158,15 @@ pub struct StreamSelfEncryptor {
158
158
// Progressing collection of source chunks' names
159
159
src_hashes : BTreeMap < usize , XorName > ,
160
160
// File path to flush encrypted_chunks into.
161
- chunk_dir : Option < Box < PathBuf > > ,
161
+ chunk_dir : Option < PathBuf > ,
162
162
}
163
163
164
164
impl StreamSelfEncryptor {
165
165
/// For encryption, return with an intialized streaming encryptor.
166
166
/// If a `chunk_dir` is provided, the encrypted_chunks will be written into the specified dir as well.
167
167
pub fn encrypt_from_file (
168
- file_path : Box < PathBuf > ,
169
- chunk_dir : Option < Box < PathBuf > > ,
168
+ file_path : PathBuf ,
169
+ chunk_dir : Option < PathBuf > ,
170
170
) -> Result < Self > {
171
171
let file = File :: open ( & * file_path) ?;
172
172
let metadata = file. metadata ( ) ?;
@@ -261,7 +261,7 @@ impl StreamSelfEncryptor {
261
261
/// The streaming decryptor to carry out the decryption on fly, chunk by chunk.
262
262
pub struct StreamSelfDecryptor {
263
263
// File path for the decryption output.
264
- file_path : Box < PathBuf > ,
264
+ file_path : PathBuf ,
265
265
// Current step (i.e. chunk_index) for decryption
266
266
chunk_index : usize ,
267
267
// Source hashes of the chunks that collected from the data_map, they shall already be sorted by index.
@@ -274,7 +274,7 @@ pub struct StreamSelfDecryptor {
274
274
275
275
impl StreamSelfDecryptor {
276
276
/// For decryption, return with an intialized streaming decryptor
277
- pub fn decrypt_to_file ( file_path : Box < PathBuf > , data_map : & DataMap ) -> Result < Self > {
277
+ pub fn decrypt_to_file ( file_path : PathBuf , data_map : & DataMap ) -> Result < Self > {
278
278
let temp_dir = tempdir ( ) ?;
279
279
let src_hashes = extract_hashes ( data_map) ;
280
280
0 commit comments