mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
write wal header on init
This commit is contained in:
parent
0d857661f2
commit
0b46648c0e
10 changed files with 108 additions and 21 deletions
10
core/lib.rs
10
core/lib.rs
|
@ -68,14 +68,13 @@ impl Database {
|
|||
let file = io.open_file(path, io::OpenFlags::None)?;
|
||||
let page_io = Rc::new(FileStorage::new(file));
|
||||
let wal_path = format!("{}-wal", path);
|
||||
let wal = Rc::new(RefCell::new(WalFile::new(io.clone(), wal_path)));
|
||||
Self::open(io, page_io, wal)
|
||||
Self::open(io, page_io, wal_path)
|
||||
}
|
||||
|
||||
pub fn open(
|
||||
io: Arc<dyn IO>,
|
||||
page_io: Rc<dyn DatabaseStorage>,
|
||||
wal: Rc<RefCell<dyn Wal>>,
|
||||
wal_path: String,
|
||||
) -> Result<Rc<Database>> {
|
||||
let db_header = Pager::begin_open(page_io.clone())?;
|
||||
DATABASE_VERSION.get_or_init(|| {
|
||||
|
@ -83,6 +82,11 @@ impl Database {
|
|||
version.to_string()
|
||||
});
|
||||
io.run_once()?;
|
||||
let wal = Rc::new(RefCell::new(WalFile::new(
|
||||
io.clone(),
|
||||
wal_path,
|
||||
db_header.borrow().page_size as usize,
|
||||
)));
|
||||
let pager = Rc::new(Pager::finish_open(
|
||||
db_header.clone(),
|
||||
page_io,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue