Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
bump to new version 0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
burmecia committed Sep 7, 2021
1 parent 5951899 commit 3aa468b
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 134 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build
on: [push]

env:
LIBSODIUM: libsodium-1.0.17
LIBSODIUM: libsodium-1.0.18

jobs:
build-linux:
Expand All @@ -16,8 +16,8 @@ jobs:
id: cache-libsodium
uses: actions/cache@v1
with:
path: libsodium-1.0.17
key: ${{ runner.os }}-libsodium-1.0.17
path: libsodium-1.0.18
key: ${{ runner.os }}-libsodium-1.0.18

- name: Build libsodium
if: steps.cache-libsodium.outputs.cache-hit != 'true'
Expand All @@ -37,29 +37,29 @@ jobs:

- name: Run ZboxFS file storage tests
run: cargo test --features storage-file

build-win:
runs-on: windows-latest
env:
SODIUM_LIB_DIR: libsodium-1.0.17\x64\Release\v141\static
SODIUM_LIB_DIR: libsodium-1.0.18\x64\Release\v141\static
SODIUM_STATIC: 1

steps:
- uses: actions/checkout@v1

- name: Cache libsodium
id: cache-libsodium
uses: actions/cache@v1
with:
path: libsodium-1.0.17
key: ${{ runner.os }}-libsodium-1.0.17
path: libsodium-1.0.18
key: ${{ runner.os }}-libsodium-1.0.18

- name: Download libsodium
if: steps.cache-libsodium.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest https://download.libsodium.org/libsodium/releases/${env:LIBSODIUM}-msvc.zip -OutFile ${env:LIBSODIUM}-msvc.zip
Expand-Archive ${env:LIBSODIUM}-msvc.zip -DestinationPath ${env:LIBSODIUM}
- name: Build ZboxFS
run: cargo build

Expand Down
34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zbox"
version = "0.9.1"
version = "0.9.2"
authors = ["Bo Lu"]
description = "ZboxFS is a zero-details, privacy-focused in-app file system."
documentation = "https://docs.rs/zbox"
Expand Down Expand Up @@ -67,21 +67,21 @@ libsodium-bundled = []
docs-rs = []

[dependencies]
cfg-if = "0.1.10"
env_logger = "0.7.1"
log = "0.4.8"
rmp-serde = "0.14.0"
serde = "1.0.104"
serde_derive = "1.0.104"
cfg-if = "1.0.0"
env_logger = "0.9.0"
log = "0.4.14"
rmp-serde = "0.15.5"
serde = "1.0.130"
serde_derive = "1.0.130"
lazy_static = "1.4.0"
libsqlite3-sys = { version = "0.16.0", optional = true }
redis = { version = "0.11.0", optional = true }
http = { version = "0.1.17", optional = true }
serde_json = { version = "1.0.39", optional = true }
libsqlite3-sys = { version = "0.22.2", optional = true }
redis = { version = "0.21.2", optional = true }
http = { version = "0.2.4", optional = true }
serde_json = { version = "1.0.67", optional = true }
reqwest = { version = "0.9.18", default-features = false, features = [ "rustls-tls" ], optional = true }

[dependencies.linked-hash-map]
version = "0.5.2"
version = "0.5.4"
features = ["serde_impl"]

[target.'cfg(target_os = "android")'.dependencies]
Expand All @@ -93,14 +93,14 @@ js-sys = { version = "0.3.27" }
web-sys = { version = "0.3.27", features = [ "Crypto", "WorkerGlobalScope", "XmlHttpRequest", "XmlHttpRequestResponseType", "Blob"] }

[dev-dependencies]
bytes = "0.4.12"
bytes = "1.1.0"
tempdir = "0.3.7"
rand = "0.6.5"
rand_xorshift = "0.1.1"
rand = "0.8.4"
rand_xorshift = "0.3.0"

[build-dependencies]
pkg-config = "0.3.14"
cc = "1.0.45"
pkg-config = "0.3.19"
cc = "1.0.70"

[target.'cfg(target_os = "windows")'.build-dependencies]
libflate = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Add the following dependency to your `Cargo.toml`:

```toml
[dependencies]
zbox = "0.9.1"
zbox = "0.9.2"
```

If you don't want to install libsodium by yourself, simply specify
Expand All @@ -201,7 +201,7 @@ verify and build libsodium.

```toml
[dependencies]
zbox = { version = "0.9.1", features = ["libsodium-bundled"] }
zbox = { version = "0.9.2", features = ["libsodium-bundled"] }
```

## Example
Expand Down
12 changes: 6 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use std::path::PathBuf;
use std::process::Command;

#[cfg(all(feature = "libsodium-bundled", not(target_os = "windows")))]
const LIBSODIUM_NAME: &'static str = "libsodium-1.0.17";
const LIBSODIUM_NAME: &'static str = "libsodium-1.0.18";
#[cfg(all(feature = "libsodium-bundled", not(target_os = "windows")))]
const LIBSODIUM_URL: &'static str =
"https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz";
"https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz";

// skip the build script when building doc on docs.rs
#[cfg(feature = "docs-rs")]
Expand Down Expand Up @@ -51,7 +51,7 @@ fn main() {
// under '/usr' dir, in that case use the environment variables
// mentioned above
pkg_config::Config::new()
.atleast_version("1.0.17")
.atleast_version("1.0.18")
.statik(true)
.probe("libsodium")
.unwrap();
Expand Down Expand Up @@ -213,9 +213,9 @@ fn download_and_install_libsodium() {
use std::io;
use std::path::PathBuf;
#[cfg(target_env = "msvc")]
static LIBSODIUM_ZIP: &'static str = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-msvc.zip";
static LIBSODIUM_ZIP: &'static str = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-msvc.zip";
#[cfg(target_env = "mingw")]
static LIBSODIUM_ZIP: &'static str = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-mingw.tar.gz";
static LIBSODIUM_ZIP: &'static str = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-mingw.tar.gz";
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let sodium_lib_dir = out_dir.join("libsodium");
if !sodium_lib_dir.exists() {
Expand Down Expand Up @@ -269,7 +269,7 @@ fn download_and_install_libsodium() {
use std::io;
use std::path::PathBuf;
use tar::Archive;
static LIBSODIUM_ZIP: &'static str = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-mingw.tar.gz";
static LIBSODIUM_ZIP: &'static str = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-mingw.tar.gz";
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let sodium_lib_dir = out_dir.join("libsodium");
if !sodium_lib_dir.exists() {
Expand Down
2 changes: 1 addition & 1 deletion src/base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use env_logger;

/// Get ZboxFS library version string.
///
/// This method return ZboxFS library version as a string, e.g. "ZboxFS v0.9.1".
/// This method return ZboxFS library version as a string, e.g. "ZboxFS v0.9.2".
#[inline]
pub fn zbox_version() -> String {
format!("ZboxFS v{}", Version::lib_version())
Expand Down
1 change: 0 additions & 1 deletion src/content/content.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cmp::min;
use std::error::Error as StdError;
use std::fmt::{self, Debug};
use std::io::{
Error as IoError, ErrorKind, Read, Result as IoResult, Seek, SeekFrom,
Expand Down
1 change: 0 additions & 1 deletion src/content/segment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::error::Error as StdError;
use std::fmt::{self, Debug};
use std::io::{Error as IoError, ErrorKind, Read, Result as IoResult, Write};
use std::ops::{Index, IndexMut, Range};
Expand Down
81 changes: 1 addition & 80 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,86 +191,7 @@ impl Display for Error {
}

impl StdError for Error {
fn description(&self) -> &str {
match *self {
Error::RefOverflow => "Refcnt overflow",
Error::RefUnderflow => "Refcnt underflow",

Error::InitCrypto => "Initialise crypto error",
Error::NoAesHardware => "No AES hardware",
Error::Hashing => "Hashing out of memory",
Error::InvalidCost => "Invalid cost",
Error::InvalidCipher => "Invalid cipher",
Error::Encrypt => "Encrypt error",
Error::Decrypt => "Decrypt error",

Error::InvalidUri => "Invalid Uri",
Error::InvalidSuperBlk => "Invalid super block",
Error::Corrupted => "Volume is corrupted",
Error::WrongVersion => "Version not match",
Error::NoEntity => "Entity not found",
Error::NotInSync => "Repo is not in sync",
Error::RepoOpened => "Repo is opened",
Error::RepoClosed => "Repo is closed",
Error::RepoExists => "Repo already exists",

Error::InTrans => "Already in transaction",
Error::NotInTrans => "Not in transaction",
Error::NoTrans => "Transaction not found",
Error::Uncompleted => "Transaction uncompleted",
Error::InUse => "Entity is in use",

Error::NoContent => "Content not found",

Error::InvalidArgument => "Invalid argument",
Error::InvalidPath => "Invalid path",
Error::NotFound => "File not found",
Error::AlreadyExists => "File already exists",
Error::IsRoot => "File is root",
Error::IsDir => "Path is dir",
Error::IsFile => "Path is file",
Error::NotDir => "Path is not dir",
Error::NotFile => "Path is not file",
Error::NotEmpty => "Directory is not empty",
Error::NoVersion => "File has no version",

Error::ReadOnly => "Opened as read only",
Error::CannotRead => "Cannot read file",
Error::CannotWrite => "Cannot write file",
Error::NotWrite => "File does not write yet",
Error::NotFinish => "File does not finish yet",
Error::Closed => "File is closed",

Error::Encode(ref err) => err.description(),
Error::Decode(ref err) => err.description(),
Error::Var(ref err) => err.description(),
Error::Io(ref err) => err.description(),

#[cfg(feature = "storage-sqlite")]
Error::Sqlite(ref err) => err.description(),

#[cfg(feature = "storage-redis")]
Error::Redis(ref err) => err.description(),

#[cfg(feature = "storage-zbox")]
Error::Http(ref err) => err.description(),
#[cfg(feature = "storage-zbox")]
Error::HttpStatus(_) => "Http status error",
#[cfg(feature = "storage-zbox")]
Error::Json(ref err) => err.description(),

#[cfg(feature = "storage-zbox-native")]
Error::Reqwest(ref err) => err.description(),

#[cfg(feature = "storage-zbox-android")]
Error::Jni(ref err) => err.description(),

#[cfg(target_arch = "wasm32")]
Error::RequestError => "Http request error",
}
}

fn cause(&self) -> Option<&dyn StdError> {
fn source(&self) -> Option<&(dyn StdError + 'static)> {
match *self {
Error::Encode(ref err) => Some(err),
Error::Decode(ref err) => Some(err),
Expand Down
7 changes: 3 additions & 4 deletions src/file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::error::Error as StdError;
use std::fmt::{self, Debug};
use std::io::{self, Error as IoError, ErrorKind, Read, Seek, SeekFrom, Write};

Expand Down Expand Up @@ -583,7 +582,7 @@ impl Read for File {
if !self.can_read {
return Err(IoError::new(
ErrorKind::Other,
Error::CannotRead.description(),
Error::CannotRead.to_string(),
));
}

Expand Down Expand Up @@ -649,7 +648,7 @@ impl Write for File {
},
None => Err(IoError::new(
ErrorKind::PermissionDenied,
Error::CannotWrite.description(),
Error::CannotWrite.to_string(),
)),
}
}
Expand All @@ -661,7 +660,7 @@ impl Seek for File {
if self.wtr.is_some() {
return Err(IoError::new(
ErrorKind::Other,
Error::NotFinish.description(),
Error::NotFinish.to_string(),
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extern crate serde_derive;
// convert zbox error to IO error
macro_rules! map_io_err {
($x:expr) => {
$x.map_err(|e| IoError::new(ErrorKind::Other, e.description()));
$x.map_err(|e| IoError::new(ErrorKind::Other, e.to_string()));
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ fn open_file_with_options<P: AsRef<Path>>(
///
/// ```toml
/// [dependencies]
/// zbox = { version = "0.9.1", features = ["storage-file"] }
/// zbox = { version = "0.9.2", features = ["storage-file"] }
/// ```
///
/// # Create and open `Repo`
Expand Down
2 changes: 1 addition & 1 deletion src/trans/txmgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub type TxMgrWeakRef = Weak<RwLock<TxMgr>>;

// lock for running exclusive transactions
lazy_static! {
static ref EXCL_TX_LOCK: Arc<Mutex<()>> = { Arc::new(Mutex::new(())) };
static ref EXCL_TX_LOCK: Arc<Mutex<()>> = Arc::new(Mutex::new(()));
}

// Transaction handle
Expand Down
2 changes: 1 addition & 1 deletion src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pub const REPO_PATCH_VERSION: u8 = 0;
/// Define ZboxFS library version
pub const LIB_MAJOR_VERSION: u8 = 0;
pub const LIB_MINOR_VERSION: u8 = 9;
pub const LIB_PATCH_VERSION: u8 = 1;
pub const LIB_PATCH_VERSION: u8 = 2;
1 change: 0 additions & 1 deletion src/volume/storage/file/file_armor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cmp::min;
use std::error::Error as StdError;
use std::fmt::Debug;
use std::io::{
Error as IoError, ErrorKind, Read, Result as IoResult, Take, Write,
Expand Down
5 changes: 2 additions & 3 deletions src/volume/storage/storage.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cmp::min;
use std::error::Error as StdError;
use std::fmt::{self, Debug, Display};
use std::io::{Error as IoError, ErrorKind, Read, Result as IoResult, Write};
use std::sync::{Arc, RwLock, Weak};
Expand Down Expand Up @@ -376,7 +375,7 @@ impl Read for WalReader {
if err == Error::NotFound {
IoError::new(ErrorKind::NotFound, "Wal not found")
} else {
IoError::new(ErrorKind::Other, err.description())
IoError::new(ErrorKind::Other, err.to_string())
}
})?;

Expand Down Expand Up @@ -497,7 +496,7 @@ impl Read for Reader {
"Blocks not found",
)
} else {
IoError::new(ErrorKind::Other, err.description())
IoError::new(ErrorKind::Other, err.to_string())
}
})?;
read += read_len;
Expand Down
2 changes: 1 addition & 1 deletion tests/common/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl Step {
buf.put_u64_le(self.data_len as u64);
let mut s = self.name.clone().into_bytes();
s.resize(32, 0);
buf.put(s);
buf.put_slice(&s);
file.write_all(&buf).unwrap();
}

Expand Down
Loading

0 comments on commit 3aa468b

Please sign in to comment.