actually require it to be a Send future

This commit is contained in:
Christian Schwarz
2023-12-11 17:29:18 +00:00
parent 8d604a1390
commit 242a72017d

View File

@@ -8,19 +8,21 @@ mod virtual_file;
async fn main() {
page_cache::init(10);
let cache = page_cache::get();
tokio::spawn(async move {
let cache = page_cache::get();
let res = cache
.read_immutable_buf(page_cache::next_file_id(), 0)
.await
.unwrap();
match res {
page_cache::ReadBufResult::Found(found) => todo!(),
page_cache::ReadBufResult::NotFound(write_guard) => {
let file = VirtualFile::open(camino::Utf8Path::new("foo"))
.await
.unwrap();
file.read_exact_at(write_guard, 0).await;
let res = cache
.read_immutable_buf(page_cache::next_file_id(), 0)
.await
.unwrap();
match res {
page_cache::ReadBufResult::Found(found) => todo!(),
page_cache::ReadBufResult::NotFound(write_guard) => {
let file = VirtualFile::open(camino::Utf8Path::new("foo"))
.await
.unwrap();
file.read_exact_at(write_guard, 0).await;
}
}
}
});
}