From 33070682dcf1ec0bf9b22cd2ea38cf983a628f7d Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 17 Jun 2020 23:06:09 -0400 Subject: bump the version of libaio-futures --- src/lib.rs | 15 +++++++-------- src/wal.rs | 10 ++++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index f7b3f73..45d4843 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,7 +50,7 @@ pub mod wal; use async_trait::async_trait; use futures::executor::block_on; -use libaiofut::{new_batch_scheduler, AIOBatchSchedulerIn, AIOManager}; +use libaiofut::{AIOBuilder, AIOManager}; use libc::off_t; use nix::fcntl::{fallocate, open, openat, FallocateFlags, OFlag}; use nix::sys::stat::Mode; @@ -62,14 +62,14 @@ use wal::{WALBytes, WALFile, WALPos, WALRingId, WALStore}; pub struct WALFileAIO { fd: RawFd, - aiomgr: Rc>, + aiomgr: Rc, } impl WALFileAIO { pub fn new( rootfd: RawFd, filename: &str, - aiomgr: Rc>, + aiomgr: Rc, ) -> Result { openat( rootfd, @@ -137,7 +137,7 @@ pub struct WALStoreAIO Result<(), ()>> { rootfd: RawFd, rootpath: String, recover_func: RefCell, - aiomgr: Rc>, + aiomgr: Rc, } impl Result<(), ()>> WALStoreAIO { @@ -145,14 +145,13 @@ impl Result<(), ()>> WALStoreAIO { wal_dir: &str, truncate: bool, recover_func: F, - aiomgr: Option>, + aiomgr: Option, ) -> Result { let recover_func = RefCell::new(recover_func); let rootpath = wal_dir.to_string(); let aiomgr = Rc::new(aiomgr.ok_or(Err(())).or_else( - |_: Result, ()>| { - AIOManager::new(new_batch_scheduler(None), 128, None, None) - .or(Err(())) + |_: Result| { + AIOBuilder::default().build().or(Err(())) }, )?); diff --git a/src/wal.rs b/src/wal.rs index f1a6e85..28831cd 100644 --- a/src/wal.rs +++ b/src/wal.rs @@ -574,8 +574,8 @@ pub struct WALLoader { recover_policy: RecoverPolicy, } -impl WALLoader { - pub fn new() -> Self { +impl Default for WALLoader { + fn default() -> Self { WALLoader { file_nbit: 22, // 4MB block_nbit: 15, // 32KB, @@ -583,6 +583,12 @@ impl WALLoader { recover_policy: RecoverPolicy::Strict } } +} + +impl WALLoader { + pub fn new() -> Self { + Default::default() + } pub fn file_nbit(&mut self, v: u8) -> &mut Self { self.file_nbit = v; -- cgit v1.2.3