Add fn read_header() to DatabaseStorage trait

This commit is contained in:
Jussi Saurio
2025-08-12 20:30:10 +03:00
parent a2a6feb193
commit ee58b7bd86
2 changed files with 20 additions and 0 deletions

View File

@@ -473,6 +473,15 @@ impl DatabaseFile {
}
impl turso_core::DatabaseStorage for DatabaseFile {
fn read_header(&self, c: turso_core::Completion) -> turso_core::Result<turso_core::Completion> {
let r = c.as_read();
let size = r.buf().len();
assert!(
size == 100,
"the size of the database header must be 100 bytes, got {size}"
);
self.file.pread(0, c)
}
fn read_page(
&self,
page_idx: usize,