finish persistence

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2024-01-19 17:28:47 +08:00
parent 13ae8fe8fb
commit 6b24d6dfab
9 changed files with 219 additions and 50 deletions

View File

@@ -102,8 +102,10 @@ impl FileObject {
))
}
pub fn open(_path: &Path) -> Result<Self> {
unimplemented!()
pub fn open(path: &Path) -> Result<Self> {
let file = File::options().read(true).write(false).open(path)?;
let size = file.metadata()?.len();
Ok(FileObject(Some(file), size))
}
}