summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock6
-rw-r--r--Cargo.toml4
-rw-r--r--src/lib.rs29
3 files changed, 18 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a85b950..98369cd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -232,7 +232,7 @@ dependencies = [
[[package]]
name = "growth-ring"
-version = "0.1.3"
+version = "0.1.4"
dependencies = [
"async-trait",
"crc",
@@ -281,9 +281,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libaio-futures"
-version = "0.1.4"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e435ab17c42371feda64ba459de5a248980ba96c367c29d0c7c63ab6481fc563"
+checksum = "0d069762d093188296e4c5144630afa35f5580b1cdfdcdfd89f55935e3b16a15"
dependencies = [
"crossbeam-channel",
"libc",
diff --git a/Cargo.toml b/Cargo.toml
index c53eb7d..dd87bde 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "growth-ring"
-version = "0.1.3"
+version = "0.1.4"
authors = ["Determinant <[email protected]>"]
edition = "2018"
homepage = "https://github.com/Determinant/growth-ring"
@@ -17,7 +17,7 @@ scan_fmt = "0.2.5"
regex = "1.3.9"
async-trait = "0.1.35"
futures = "0.3.5"
-libaio-futures = "0.1.4"
+libaio-futures = "0.1.7"
nix = "0.17.0"
libc = "0.2.71"
diff --git a/src/lib.rs b/src/lib.rs
index 45d4843..be8993b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -107,17 +107,14 @@ impl WALFile for WALFileAIO {
}
async fn write(&self, offset: WALPos, data: WALBytes) -> Result<(), ()> {
- self.aiomgr
- .write(self.fd, offset, data, None)
- .await
- .or_else(|_| Err(()))
- .and_then(|(nwrote, data)| {
- if nwrote == data.len() {
- Ok(())
- } else {
- Err(())
- }
- })
+ let (res, data) = self.aiomgr.write(self.fd, offset, data, None).await;
+ res.or_else(|_| Err(())).and_then(|nwrote| {
+ if nwrote == data.len() {
+ Ok(())
+ } else {
+ Err(())
+ }
+ })
}
fn read(
@@ -125,11 +122,11 @@ impl WALFile for WALFileAIO {
offset: WALPos,
length: usize,
) -> Result<Option<WALBytes>, ()> {
- block_on(self.aiomgr.read(self.fd, offset, length, None))
- .or_else(|_| Err(()))
- .and_then(|(nread, data)| {
- Ok(if nread == length { Some(data) } else { None })
- })
+ let (res, data) =
+ block_on(self.aiomgr.read(self.fd, offset, length, None));
+ res.or_else(|_| Err(())).and_then(|nread| {
+ Ok(if nread == length { Some(data) } else { None })
+ })
}
}