Compare d48dc6a ... +0 ... eed7974

Missing base report.

Unable to compare commits because the base of the compare did not upload a coverage report.

Learn more here.


@@ -5,13 +5,12 @@
Loading
5 5
pub use asuran_core::manifest::archive::{Archive, ChunkLocation, Extent};
6 6
pub use asuran_core::manifest::listing::{Listing, Node, NodeType};
7 7
8 -
use async_lock::RwLock;
9 8
use chrono::prelude::*;
10 9
use dashmap::DashMap;
11 10
use futures::future::join_all;
12 11
use serde::{Deserialize, Serialize};
13 12
use serde_cbor::Serializer;
14 -
use smol::Task;
13 +
use smol::lock::RwLock;
15 14
use thiserror::Error;
16 15
17 16
use std::collections::VecDeque;
@@ -143,12 +142,13 @@
Loading
143 142
        repository: &mut Repository<impl BackendClone>,
144 143
        path: &str,
145 144
        from_reader: R,
145 +
        ex: &smol::Executor<'_>,
146 146
    ) -> Result<()> {
147 147
        // We take advantage of put_sparse_object's behavior of reading past the given end if the
148 148
        // given reader is actually longer
149 149
        let extent = Extent { start: 0, end: 0 };
150 150
        let readers = vec![(extent, from_reader)];
151 -
        self.put_sparse_object(chunker, repository, path, readers)
151 +
        self.put_sparse_object(chunker, repository, path, readers, ex)
152 152
            .await
153 153
    }
154 154
@@ -161,6 +161,7 @@
Loading
161 161
        repository: &mut Repository<impl BackendClone>,
162 162
        path: &str,
163 163
        from_readers: Vec<(Extent, R)>,
164 +
        ex: &smol::Executor<'_>,
164 165
    ) -> Result<()> {
165 166
        let mut locations: Vec<ChunkLocation> = Vec::new();
166 167
        let path = self.canonical_namespace() + path.trim();
@@ -175,7 +176,7 @@
Loading
175 176
                let end = start + (data.len() as u64);
176 177
177 178
                let mut repository = repository.clone();
178 -
                futs.push_back(Task::spawn(async move {
179 +
                futs.push_back(ex.spawn(async move {
179 180
                    let id = repository.write_chunk(data).await?.0;
180 181
                    let result: Result<ChunkLocation> = Ok(ChunkLocation {
181 182
                        id,
@@ -416,7 +417,12 @@
Loading
416 417
417 418
    #[test]
418 419
    fn single_add_get() {
419 -
        smol::run(async {
420 +
        let ex = smol::Executor::new();
421 +
        let ex: &'static smol::Executor = Box::leak(Box::new(ex));
422 +
        let (_signal, shutdown) = smol::channel::unbounded::<()>();
423 +
        std::thread::spawn(move || futures::executor::block_on(ex.run(shutdown.recv())));
424 +
425 +
        smol::block_on(async {
420 426
            let seed = 0;
421 427
            println!("Seed: {}", seed);
422 428
            let chunker = FastCDC::default();
@@ -439,7 +445,7 @@
Loading
439 445
            let input_file = BufReader::new(fs::File::open(input_file_path).unwrap());
440 446
441 447
            archive
442 -
                .put_object(&chunker, &mut repo, "FileOne", input_file)
448 +
                .put_object(&chunker, &mut repo, "FileOne", input_file, &ex)
443 449
                .await
444 450
                .unwrap();
445 451
@@ -471,7 +477,11 @@
Loading
471 477
472 478
    #[test]
473 479
    fn sparse_add_get() {
474 -
        smol::run(async {
480 +
        let ex = smol::Executor::new();
481 +
        let ex: &'static smol::Executor = Box::leak(Box::new(ex));
482 +
        let (_signal, shutdown) = smol::channel::unbounded::<()>();
483 +
        std::thread::spawn(move || futures::executor::block_on(ex.run(shutdown.recv())));
484 +
        smol::block_on(async {
475 485
            let seed = 0;
476 486
            let chunker: FastCDC = FastCDC::default();
477 487
            let key = Key::random(32);
@@ -483,6 +493,7 @@
Loading
483 493
            // Generate a random number of extents from one to ten
484 494
            let mut extents: Vec<Extent> = Vec::new();
485 495
            let extent_count: usize = rng.gen_range(1, 10);
496 +
            let ex: &'static smol::Executor = Box::leak(Box::new(ex));
486 497
            let mut next_start: u64 = 0;
487 498
            let mut final_size: usize = 0;
488 499
            for _ in 0..extent_count {
@@ -519,7 +530,7 @@
Loading
519 530
            // println!("Extent list: {:?}", extent_list);
520 531
            // Load data into archive
521 532
            archive
522 -
                .put_sparse_object(&chunker, &mut repo, "test", extent_list)
533 +
                .put_sparse_object(&chunker, &mut repo, "test", extent_list, &ex)
523 534
                .await
524 535
                .expect("Archive Put Failed");
525 536
@@ -575,7 +586,11 @@
Loading
575 586
576 587
    #[test]
577 588
    fn namespaced_insertions() {
578 -
        smol::run(async {
589 +
        let ex = smol::Executor::new();
590 +
        let ex: &'static smol::Executor = Box::leak(Box::new(ex));
591 +
        let (_signal, shutdown) = smol::channel::unbounded::<()>();
592 +
        std::thread::spawn(move || futures::executor::block_on(ex.run(shutdown.recv())));
593 +
        smol::block_on(async {
579 594
            let chunker = FastCDC::default();
580 595
            let key = Key::random(32);
581 596
@@ -588,11 +603,11 @@
Loading
588 603
            let mut archive_2 = archive_1.clone();
589 604
590 605
            archive_1
591 -
                .put_object(&chunker, &mut repo, "1", obj1.clone())
606 +
                .put_object(&chunker, &mut repo, "1", obj1.clone(), &ex)
592 607
                .await
593 608
                .unwrap();
594 609
            archive_2
595 -
                .put_object(&chunker, &mut repo, "2", obj2.clone())
610 +
                .put_object(&chunker, &mut repo, "2", obj2.clone(), &ex)
596 611
                .await
597 612
                .unwrap();
598 613
@@ -621,7 +636,11 @@
Loading
621 636
622 637
    #[test]
623 638
    fn commit_and_load() {
624 -
        smol::run(async {
639 +
        let ex = smol::Executor::new();
640 +
        let ex: &'static smol::Executor = Box::leak(Box::new(ex));
641 +
        let (_signal, shutdown) = smol::channel::unbounded::<()>();
642 +
        std::thread::spawn(move || futures::executor::block_on(ex.run(shutdown.recv())));
643 +
        smol::block_on(async {
625 644
            let chunker = FastCDC::default();
626 645
            let key = Key::random(32);
627 646
@@ -635,7 +654,7 @@
Loading
635 654
636 655
            let mut archive = ActiveArchive::new("test");
637 656
            archive
638 -
                .put_object(&chunker, &mut repo, "1", obj1.clone())
657 +
                .put_object(&chunker, &mut repo, "1", obj1.clone(), &ex)
639 658
                .await
640 659
                .expect("Unable to put object in archive");
641 660

@@ -32,7 +32,7 @@
Loading
32 32
// Specifically addresses gitlab issue #56
33 33
#[test]
34 34
fn create_multifile_noencryption() {
35 -
    smol::run(async {
35 +
    smol::block_on(async {
36 36
        create_multifile_repository(
37 37
            Encryption::NoEncryption,
38 38
            Compression::NoCompression,
@@ -45,7 +45,7 @@
Loading
45 45
// Attempts to reproduce gitlab issue #58
46 46
#[test]
47 47
fn create_lzma_9() {
48 -
    smol::run(async {
48 +
    smol::block_on(async {
49 49
        create_multifile_repository(
50 50
            Encryption::new_aes256ctr(),
51 51
            Compression::LZMA { level: 9 },

@@ -89,7 +89,7 @@
Loading
89 89
90 90
    #[test]
91 91
    fn chunk_settings_sanity() {
92 -
        smol::run(async {
92 +
        smol::block_on(async {
93 93
            let settings = ChunkSettings {
94 94
                encryption: Encryption::NoEncryption,
95 95
                compression: Compression::NoCompression,
@@ -110,7 +110,7 @@
Loading
110 110
111 111
    #[test]
112 112
    fn new_archive_updates_time() {
113 -
        smol::run(async {
113 +
        smol::block_on(async {
114 114
            let settings = ChunkSettings::lightweight();
115 115
            let key = Key::random(32);
116 116
            let backend = crate::repository::backend::mem::Mem::new(settings, key.clone(), 4);

@@ -335,7 +335,7 @@
Loading
335 335
336 336
    #[test]
337 337
    fn repository_add_read() {
338 -
        smol::run(async {
338 +
        smol::block_on(async {
339 339
            let key = Key::random(32);
340 340
341 341
            let size = 7 * 10_u64.pow(3);
@@ -365,7 +365,7 @@
Loading
365 365
366 366
    #[test]
367 367
    fn double_add() {
368 -
        smol::run(async {
368 +
        smol::block_on(async {
369 369
            // Adding the same chunk to the repository twice shouldn't result in
370 370
            // two chunks in the repository
371 371
            let mut repo = get_repo_mem(Key::random(32));
@@ -386,7 +386,7 @@
Loading
386 386
    // Ensure writing a chunk with an ID works
387 387
    #[test]
388 388
    fn chunk_with_id() {
389 -
        smol::run(async {
389 +
        smol::block_on(async {
390 390
            let mut repo = get_repo_mem(Key::random(32));
391 391
            // generate our chunk
392 392
            let size = 7 * 10_u64.pow(3);

@@ -195,7 +195,7 @@
Loading
195 195
196 196
    #[test]
197 197
    fn key_store_load() {
198 -
        smol::run(async {
198 +
        smol::block_on(async {
199 199
            let key = Key::random(32);
200 200
            let (tempdir, mut mf) = setup(&key).await;
201 201
            // Encrypt the key and store it
@@ -225,7 +225,7 @@
Loading
225 225
    // Test to make sure that attempting to open a repository respects an existing global lock
226 226
    #[test]
227 227
    fn repository_global_lock() {
228 -
        smol::run(async {
228 +
        smol::block_on(async {
229 229
            let tempdir = tempdir().unwrap();
230 230
            let path = tempdir.path().to_path_buf();
231 231
            let key = Key::random(32);
@@ -248,7 +248,7 @@
Loading
248 248
    // Tests to make sure that readlocks are created and destroyed properly
249 249
    #[test]
250 250
    fn read_lock_create_destroy() {
251 -
        smol::run(async {
251 +
        smol::block_on(async {
252 252
            let key = Key::random(32);
253 253
            let (tempdir, mut mf) = setup(&key).await;
254 254
            let lock_path: Arc<PathBuf> = mf.read_lock_path.clone();

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 41 files with coverage changes found.

New file asuran-core/src/manifest/archive.rs
New
Loading file...
New file asuran-core/src/manifest/listing.rs
New
Loading file...
New file asuran-chunker/src/lib.rs
New
Loading file...
New file asuran/src/repository/backend/sftp/util.rs
New
Loading file...
New file asuran/src/repository/pipeline.rs
New
Loading file...
New file asuran/src/repository/backend/common/generic_flatfile.rs
New
Loading file...
New file asuran/src/repository/backend/common/segment.rs
New
Loading file...
New file asuran-core/src/repository/backend/flatfile.rs
New
Loading file...
New file asuran/tests/creation.rs
New
Loading file...
New file asuran-core/src/repository/key.rs
New
Loading file...
New file asuran/src/manifest/archive.rs
New
Loading file...
New file asuran/src/manifest.rs
New
Loading file...
New file asuran/src/repository/backend/common/sync_backend.rs
New
Loading file...
New file asuran/src/repository/backend/sftp/index.rs
New
Loading file...
New file asuran/src/repository.rs
New
Loading file...
New file asuran/src/repository/backend/multifile/index.rs
New
Loading file...
New file asuran/src/repository/backend/multifile.rs
New
Loading file...
New file asuran/src/repository/backend/mem.rs
New
Loading file...
New file asuran-chunker/src/static_size.rs
New
Loading file...
New file asuran-cli/src/main.rs
New
Loading file...
New file asuran-core/src/repository/hmac.rs
New
Loading file...
New file asuran/src/lib.rs
New
Loading file...
New file asuran/src/repository/backend/flatfile.rs
New
Loading file...
New file asuran/src/manifest/target.rs
New
Loading file...
New file asuran/src/repository/backend/object_wrappers.rs
New
Loading file...
New file asuran/src/repository/backend/multifile/manifest.rs
New
Loading file...
New file asuran-chunker/src/buzhash.rs
New
Loading file...
New file asuran-core/src/repository/compression.rs
New
Loading file...
New file asuran-core/src/repository/encryption.rs
New
Loading file...
New file asuran-core/src/repository/encryption/aes_shim.rs
New
Loading file...
New file asuran/src/repository/backend/sftp/segment.rs
New
Loading file...
New file asuran/src/repository/backend/sftp/manifest.rs
New
Loading file...
New file asuran/src/repository/backend/multifile/segment.rs
New
Loading file...
New file asuran/src/repository/backend/common/manifest.rs
New
Loading file...
New file asuran-chunker/src/fastcdc.rs
New
Loading file...
New file asuran/src/repository/backend/common/files.rs
New
Loading file...
New file asuran/tests/common.rs
New
Loading file...
New file asuran-core/src/repository/chunk.rs
New
Loading file...
New file asuran/src/manifest/driver.rs
New
Loading file...
New file asuran/src/repository/backend/sftp.rs
New
Loading file...
New file asuran/src/manifest/target/filesystem.rs
New
Loading file...
Files Coverage
asuran 76.46%
asuran-chunker/src 79.50%
asuran-core/src 73.78%
asuran-cli/src/main.rs 100.00%
Project Totals (41 files) 76.16%
Loading