diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-01-24 23:38:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 23:38:18 +0100 |
commit | 801ed74118baabef49842bbfb2164f971d2cdb03 (patch) | |
tree | 6195aa063de73500c299382fba7cd52a5d971d21 /ext/fs/ops.rs | |
parent | 316093fec41163be3d0e31e6d61b5bc0b1341b27 (diff) |
revert: Remove deprecations of file sync APIs (#22085)
- `Deno.FsFile.dataSync` -> `Deno.FsFile.syncData`
- `Deno.FsFile.dataSyncSync` -> `Deno.FsFile.syncDataSync`
Also marks these APIs as unstable
Diffstat (limited to 'ext/fs/ops.rs')
-rw-r--r-- | ext/fs/ops.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs index e41d3308f..e8573229b 100644 --- a/ext/fs/ops.rs +++ b/ext/fs/ops.rs @@ -1349,6 +1349,17 @@ pub fn op_fs_fdatasync_sync( Ok(()) } +#[op2(fast)] +pub fn op_fs_fdatasync_sync_unstable( + state: &mut OpState, + #[smi] rid: ResourceId, +) -> Result<(), AnyError> { + check_unstable(state, "Deno.FsFile.syncDataSync"); + let file = FileResource::get_file(state, rid)?; + file.datasync_sync()?; + Ok(()) +} + #[op2(async)] pub async fn op_fs_fdatasync_async( state: Rc<RefCell<OpState>>, @@ -1359,6 +1370,17 @@ pub async fn op_fs_fdatasync_async( Ok(()) } +#[op2(async)] +pub async fn op_fs_fdatasync_async_unstable( + state: Rc<RefCell<OpState>>, + #[smi] rid: ResourceId, +) -> Result<(), AnyError> { + check_unstable(&state.borrow(), "Deno.FsFile.syncData"); + let file = FileResource::get_file(&state.borrow(), rid)?; + file.datasync_async().await?; + Ok(()) +} + #[op2(fast)] pub fn op_fs_fsync_sync( state: &mut OpState, @@ -1369,6 +1391,17 @@ pub fn op_fs_fsync_sync( Ok(()) } +#[op2(fast)] +pub fn op_fs_fsync_sync_unstable( + state: &mut OpState, + #[smi] rid: ResourceId, +) -> Result<(), AnyError> { + check_unstable(state, "Deno.FsFile.syncSync"); + let file = FileResource::get_file(state, rid)?; + file.sync_sync()?; + Ok(()) +} + #[op2(async)] pub async fn op_fs_fsync_async( state: Rc<RefCell<OpState>>, @@ -1379,6 +1412,17 @@ pub async fn op_fs_fsync_async( Ok(()) } +#[op2(async)] +pub async fn op_fs_fsync_async_unstable( + state: Rc<RefCell<OpState>>, + #[smi] rid: ResourceId, +) -> Result<(), AnyError> { + check_unstable(&state.borrow(), "Deno.FsFile.sync"); + let file = FileResource::get_file(&state.borrow(), rid)?; + file.sync_async().await?; + Ok(()) +} + #[op2(fast)] pub fn op_fs_fstat_sync( state: &mut OpState, |