mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 00:45:37 +01:00
Fix truncate impl in JS bindings
This commit is contained in:
@@ -726,6 +726,10 @@ impl turso_core::DatabaseStorage for DatabaseFile {
|
||||
fn size(&self) -> turso_core::Result<u64> {
|
||||
self.file.size()
|
||||
}
|
||||
fn truncate(&self, len: usize, c: turso_core::Completion) -> turso_core::Result<()> {
|
||||
let _ = self.file.truncate(len, c)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -261,7 +261,11 @@ impl turso_core::File for File {
|
||||
Ok(self.vfs.size(self.fd))
|
||||
}
|
||||
|
||||
fn truncate(&self, len: u64, c: turso_core::Completion) -> Result<Arc<turso_core::Completion>> {
|
||||
fn truncate(
|
||||
&self,
|
||||
len: usize,
|
||||
c: turso_core::Completion,
|
||||
) -> Result<Arc<turso_core::Completion>> {
|
||||
self.vfs.truncate(self.fd, len as usize);
|
||||
c.complete(0);
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
@@ -387,8 +391,8 @@ impl turso_core::DatabaseStorage for DatabaseFile {
|
||||
self.file.size()
|
||||
}
|
||||
|
||||
fn truncate(&self, len: u64, c: turso_core::Completion) -> Result<()> {
|
||||
self.file.truncate(len, c);
|
||||
fn truncate(&self, len: usize, c: turso_core::Completion) -> Result<()> {
|
||||
self.file.truncate(len, c)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ pub trait DatabaseStorage: Send + Sync {
|
||||
) -> Result<Completion>;
|
||||
fn sync(&self, c: Completion) -> Result<Completion>;
|
||||
fn size(&self) -> Result<u64>;
|
||||
fn truncate(&self, len: u64, c: Completion) -> Result<()>;
|
||||
fn truncate(&self, len: usize, c: Completion) -> Result<()>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "fs")]
|
||||
@@ -72,7 +72,7 @@ impl DatabaseStorage for DatabaseFile {
|
||||
}
|
||||
|
||||
#[instrument(skip_all, level = Level::INFO)]
|
||||
fn truncate(&self, len: u64, c: Completion) -> Result<()> {
|
||||
fn truncate(&self, len: usize, c: Completion) -> Result<()> {
|
||||
self.file.truncate(len, c)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -131,7 +131,7 @@ impl DatabaseStorage for FileMemoryStorage {
|
||||
}
|
||||
|
||||
#[instrument(skip_all, level = Level::INFO)]
|
||||
fn truncate(&self, len: u64, c: Completion) -> Result<()> {
|
||||
fn truncate(&self, len: usize, c: Completion) -> Result<()> {
|
||||
let _ = self.file.truncate(len, c)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user