liteboxfs 0.2.0

A modern POSIX filesystem in a SQLite database
Documentation
#[cfg(not(feature = "compression"))]
mod compression_disabled {
    use liteboxfs::{Connection, CreateOptions, OpenOptions};
    use xpct::{be_ok, expect, match_pattern, pattern};

    fn insert_compressed_block(db_path: &std::path::Path) {
        let db = rusqlite::Connection::open(db_path).unwrap();
        // Insert a block with encoding = 1 (ZSTD) directly via SQL, bypassing liteboxfs.
        db.execute(
            "INSERT INTO liteboxfs_blocks (length, encoding, hash, data) VALUES (4, 1, X'0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20', X'deadbeef')",
            [],
        )
        .unwrap();
    }

    #[test]
    fn fails_to_open_litebox_with_compressed_blocks() {
        let temp_dir = tempfile::tempdir().unwrap();
        let path = temp_dir.path().join("test.litebox");

        Connection::create_new(&path, &CreateOptions::new()).unwrap();

        insert_compressed_block(&path);

        expect!(Connection::open(&path, &OpenOptions::new())).to(match_pattern(pattern!(Err(
            liteboxfs::Error::FeatureDisabled { .. }
        ))));
    }

    #[test]
    fn litebox_without_compressed_blocks_opens_successfully() {
        let temp_dir = tempfile::tempdir().unwrap();
        let path = temp_dir.path().join("test.litebox");

        Connection::create_new(&path, &CreateOptions::new()).unwrap();

        expect!(Connection::open(&path, &OpenOptions::new())).to(be_ok());
    }
}