add wal and manifest

Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
This commit is contained in:
Alex Chi Z
2024-01-19 11:21:38 +08:00
parent 643734f032
commit 49c22152ae
17 changed files with 236 additions and 71 deletions

View File

@@ -95,6 +95,7 @@ impl FileObject {
/// Create a new file object (day 2) and write the file to the disk (day 4).
pub fn create(path: &Path, data: Vec<u8>) -> Result<Self> {
std::fs::write(path, &data)?;
File::open(path)?.sync_all()?;
Ok(FileObject(
Some(File::options().read(true).write(false).open(path)?),
data.len() as u64,