From 99b0516476849e966f490aee55ef9363afe4fc4d Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 5 Sep 2024 14:37:19 +1000 Subject: [PATCH 1/2] BREAKING(fs): remove `Deno.funlock[Sync]()` --- cli/tools/test/fmt.rs | 1 - ext/fs/30_fs.js | 10 ---------- ext/fs/lib.rs | 2 -- ext/fs/ops.rs | 22 ---------------------- runtime/js/99_main.js | 4 ---- tests/specs/future/runtime_api/main.js | 2 -- tests/specs/future/runtime_api/main.out | 2 -- 7 files changed, 43 deletions(-) diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index 5201bead65e63a..fe141ed5141340 100644 --- a/cli/tools/test/fmt.rs +++ b/cli/tools/test/fmt.rs @@ -323,7 +323,6 @@ pub const OP_DETAILS: phf::Map<&'static str, [&'static str; 2]> = phf_map! { "op_fs_flock_async" => ["lock a file", "awaiting the result of a `Deno.FsFile.lock` call"], "op_fs_fsync_async" => ["flush pending data operations for a file to disk", "awaiting the result of a `Deno.fsync` or `Deno.FsFile.sync` call"], "op_fs_file_truncate_async" => ["truncate a file", "awaiting the result of a `Deno.FsFile.prototype.truncate` call"], - "op_fs_funlock_async_unstable" => ["unlock a file", "awaiting the result of a `Deno.funlock` call"], "op_fs_funlock_async" => ["unlock a file", "awaiting the result of a `Deno.FsFile.unlock` call"], "op_fs_link_async" => ["create a hard link", "awaiting the result of a `Deno.link` call"], "op_fs_lstat_async" => ["get file metadata", "awaiting the result of a `Deno.lstat` call"], diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 35bf0e712eabb7..39ef9301ac3573 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -26,9 +26,7 @@ import { op_fs_fsync_sync, op_fs_ftruncate_sync, op_fs_funlock_async, - op_fs_funlock_async_unstable, op_fs_funlock_sync, - op_fs_funlock_sync_unstable, op_fs_futime_async, op_fs_futime_sync, op_fs_link_async, @@ -535,14 +533,6 @@ async function fsync(rid) { await op_fs_fsync_async(rid); } -function funlockSync(rid) { - op_fs_funlock_sync_unstable(rid); -} - -async function funlock(rid) { - await op_fs_funlock_async_unstable(rid); -} - function seekSync( rid, offset, diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index 7cf5f6cb31e1d7..1725b4dd5b60c3 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -235,8 +235,6 @@ deno_core::extension!(deno_fs, op_fs_fsync_async, op_fs_file_stat_sync, op_fs_file_stat_async, - op_fs_funlock_sync_unstable, - op_fs_funlock_async_unstable, op_fs_flock_async, op_fs_flock_sync, op_fs_funlock_async, diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs index acf2c216fc642b..0ac4f501600436 100644 --- a/ext/fs/ops.rs +++ b/ext/fs/ops.rs @@ -1493,28 +1493,6 @@ pub async fn op_fs_file_stat_async( Ok(stat.into()) } -#[op2(fast)] -pub fn op_fs_funlock_sync_unstable( - state: &mut OpState, - #[smi] rid: ResourceId, -) -> Result<(), AnyError> { - check_unstable(state, "Deno.funlockSync"); - let file = FileResource::get_file(state, rid)?; - file.unlock_sync()?; - Ok(()) -} - -#[op2(async)] -pub async fn op_fs_funlock_async_unstable( - state: Rc>, - #[smi] rid: ResourceId, -) -> Result<(), AnyError> { - check_unstable(&state.borrow(), "Deno.funlock"); - let file = FileResource::get_file(&state.borrow(), rid)?; - file.unlock_async().await?; - Ok(()) -} - #[op2(fast)] pub fn op_fs_flock_sync( state: &mut OpState, diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index d0171acd27e02d..3eadf40ea33757 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -803,8 +803,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { delete Deno.Buffer; delete Deno.File; delete Deno.FsFile.prototype.rid; - delete Deno.funlock; - delete Deno.funlockSync; delete Deno.seek; delete Deno.seekSync; } @@ -967,8 +965,6 @@ function bootstrapWorkerRuntime( delete Deno.Buffer; delete Deno.File; delete Deno.FsFile.prototype.rid; - delete Deno.funlock; - delete Deno.funlockSync; delete Deno.seek; delete Deno.seekSync; } diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index 26a75373eadede..cd8a717c82ef1f 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -5,8 +5,6 @@ console.log( "Deno.FsFile.prototype.rid is", Deno.openSync(import.meta.filename).rid, ); -console.log("Deno.funlock is", Deno.funlock); -console.log("Deno.funlockSync is", Deno.funlockSync); console.log("Deno.seek is", Deno.seek); console.log("Deno.seekSync is", Deno.seekSync); diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index 0aa4e1f7c982b9..7f77389301baf0 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -2,8 +2,6 @@ window is undefined Deno.Buffer is undefined Deno.File is undefined Deno.FsFile.prototype.rid is undefined -Deno.funlock is undefined -Deno.funlockSync is undefined Deno.seek is undefined Deno.seekSync is undefined Deno.Listener.prototype.rid is undefined From 5d10021129af34060aac84252dff24f4bf7acb6b Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 5 Sep 2024 14:39:01 +1000 Subject: [PATCH 2/2] update --- cli/tsc/99_main_compiler.js | 2 -- cli/tsc/dts/lib.deno.unstable.d.ts | 18 ------------------ ext/fs/30_fs.js | 2 -- runtime/js/90_deno_ns.js | 4 ---- 4 files changed, 26 deletions(-) diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index a6ec591253d8f1..f35fa7b5d3ee67 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -46,8 +46,6 @@ delete Object.prototype.__proto__; "UnixListenOptions", "createHttpClient", "dlopen", - "funlock", - "funlockSync", "listen", "listenDatagram", "openKv", diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index 9dee14f7feb952..a478b2e1472b07 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -1130,24 +1130,6 @@ declare namespace Deno { options: UnixListenOptions & { transport: "unixpacket" }, ): DatagramConn; - /** **UNSTABLE**: New API, yet to be vetted. - * - * Release an advisory file-system lock for the provided file. - * - * @category File System - * @experimental - */ - export function funlock(rid: number): Promise; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Release an advisory file-system lock for the provided file synchronously. - * - * @category File System - * @experimental - */ - export function funlockSync(rid: number): void; - /** **UNSTABLE**: New API, yet to be vetted. * * Open a new {@linkcode Deno.Kv} connection to persist data. diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 39ef9301ac3573..7a85cc07708beb 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -944,8 +944,6 @@ export { FsFile, fsync, fsyncSync, - funlock, - funlockSync, link, linkSync, lstat, diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 6f5d85da2c6ac1..35323aec0c41f6 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -185,8 +185,6 @@ denoNsUnstableById[unstableIds.ffi] = { }; denoNsUnstableById[unstableIds.fs] = { - funlock: fs.funlock, - funlockSync: fs.funlockSync, umask: fs.umask, }; @@ -233,8 +231,6 @@ const denoNsUnstable = { UnsafePointerView: ffi.UnsafePointerView, UnsafeFnPointer: ffi.UnsafeFnPointer, UnsafeWindowSurface: webgpuSurface.UnsafeWindowSurface, - funlock: fs.funlock, - funlockSync: fs.funlockSync, openKv: kv.openKv, AtomicOperation: kv.AtomicOperation, Kv: kv.Kv,