Add async recursion fixes.
This commit is contained in:
parent
0d6460b01c
commit
48a62fc165
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -17,6 +17,17 @@ version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "async-recursion"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
@ -291,6 +302,7 @@ dependencies = [
|
||||
name = "storage"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-recursion",
|
||||
"pack",
|
||||
"tokio",
|
||||
]
|
||||
|
@ -6,5 +6,6 @@ edition = "2021"
|
||||
[dependencies]
|
||||
|
||||
tokio = { version = "1.44.1", features = ["full"] }
|
||||
async-recursion = "1.1.1"
|
||||
|
||||
pack = { git = "https://git.tsukiyo.org/Utility/pack" }
|
||||
|
@ -6,16 +6,18 @@ async fn main()
|
||||
{
|
||||
std::fs::create_dir_all("data").ok();
|
||||
|
||||
/*
|
||||
if let Ok(mut bf) = BlockFile::<16>::open("data/cache_data.bin") {
|
||||
if let Ok(id) = bf.insert("This is a test of the block file system.".as_bytes()) {
|
||||
let data = String::from_utf8(bf.get(id).unwrap()).unwrap();
|
||||
println!("BLOCKFILE");
|
||||
|
||||
if let Ok(mut bf) = BlockFile::<16>::open("data/cache_data.bin").await {
|
||||
if let Ok(id) = bf.insert("This is a test of the block file system.".as_bytes()).await {
|
||||
let data = String::from_utf8(bf.get(id).await.unwrap()).unwrap();
|
||||
println!("id {} = '{}'", id, data);
|
||||
}
|
||||
} else {
|
||||
println!("Failed to open.");
|
||||
}
|
||||
*/
|
||||
|
||||
println!("TRIEFILE");
|
||||
|
||||
if let Ok(mut tf) = TrieFile::<8>::open("data/cache_index.bin").await {
|
||||
|
||||
|
@ -249,6 +249,7 @@ impl<const Z:usize> BlockFile<Z> {
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
#[async_recursion::async_recursion]
|
||||
async fn allocate(&mut self, count:usize) -> Result<Vec<u32>, std::io::Error>
|
||||
// Mark as allocated and return the next available N blocks.
|
||||
//
|
||||
@ -278,6 +279,7 @@ impl<const Z:usize> BlockFile<Z> {
|
||||
Ok(blocks)
|
||||
}
|
||||
|
||||
#[async_recursion::async_recursion]
|
||||
async fn allocate_traverse(
|
||||
&mut self,
|
||||
block_id:u32,
|
||||
|
Loading…
x
Reference in New Issue
Block a user