Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::cmp::Ordering;
use std::fmt;
use std::io;
use std::path::PathBuf;
use std::time::Duration;

use destream::en;
use freqfs::{Cache, DirLock};
Expand Down Expand Up @@ -154,7 +155,7 @@ async fn main() -> Result<(), txfs::Error> {
let path = setup_tmp_dir().await?;

// initialize the cache
let cache = Cache::new(40, None);
let cache = Cache::new(40, None, 0, Duration::from_secs(3));

// load the directory and file paths into memory (not file contents, yet)
let root = cache.load(path.clone())?;
Expand Down
8 changes: 6 additions & 2 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ where
{
let size = version.get_size();
let mut versions = versions.write().await;
versions.create_file(txn_id.to_string(), version, size)?;
versions
.create_file(txn_id.to_string(), version, size)
.await?;
}

Ok(Self {
Expand Down Expand Up @@ -202,7 +204,9 @@ where
let version = F::clone(&*canon);
let size = version.get_size();

versions.create_file(txn_id.to_string(), version, size)?
versions
.create_file(txn_id.to_string(), version, size)
.await?
} else if last_modified == txn_id {
versions.get_file(&*last_modified).expect("version").clone()
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ mod tests {
path.push(format!("txfs_test_{}_{}", std::process::id(), unique));
fs::create_dir(&path).await?;

let cache = Cache::<Entry>::new(40, None);
let cache = Cache::<Entry>::new(1024, None, 0, std::time::Duration::from_secs(3));
let root = cache.load(path.clone())?;
let dir = super::Dir::load(Txn(1), root).await?;

Expand Down
Loading