mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
fix generic and windows sync compilation
This commit is contained in:
parent
ab2fc3fb13
commit
3d3cdbeb0c
3 changed files with 10 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
use crate::{Completion, File, LimboError, OpenFlags, Result, IO};
|
||||
use std::cell::RefCell;
|
||||
use std::io::{Read, Seek, Write};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
pub struct GenericIO {}
|
||||
|
@ -13,15 +13,18 @@ impl GenericIO {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for GenericIO {}
|
||||
unsafe impl Sync for GenericIO {}
|
||||
|
||||
impl IO for GenericIO {
|
||||
fn open_file(&self, path: &str, flags: OpenFlags, _direct: bool) -> Result<Rc<dyn File>> {
|
||||
fn open_file(&self, path: &str, flags: OpenFlags, _direct: bool) -> Result<Arc<dyn File>> {
|
||||
trace!("open_file(path = {})", path);
|
||||
let file = std::fs::OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(matches!(flags, OpenFlags::Create))
|
||||
.open(path)?;
|
||||
Ok(Rc::new(GenericFile {
|
||||
Ok(Arc::new(GenericFile {
|
||||
file: RefCell::new(file),
|
||||
}))
|
||||
}
|
||||
|
@ -72,7 +75,7 @@ impl File for GenericFile {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn pwrite(&self, pos: usize, buffer: Rc<RefCell<crate::Buffer>>, c: Completion) -> Result<()> {
|
||||
fn pwrite(&self, pos: usize, buffer: Arc<RefCell<crate::Buffer>>, c: Completion) -> Result<()> {
|
||||
let mut file = self.file.borrow_mut();
|
||||
file.seek(std::io::SeekFrom::Start(pos as u64))?;
|
||||
let buf = buffer.borrow();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue