From 7d95c5c062c7d836bab912e95587bf7fa52326c4 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 5 Sep 2024 21:23:37 +1000 Subject: [PATCH] BREAKING(fs): remove `Deno.funlock[Sync]()` (#25442) Towards #22079 --------- Signed-off-by: Asher Gomez --- cli/tools/test/fmt.rs | 1 - cli/tsc/99_main_compiler.js | 2 -- cli/tsc/dts/lib.deno.unstable.d.ts | 18 ------------------ ext/fs/30_fs.js | 12 ------------ ext/fs/lib.rs | 2 -- ext/fs/ops.rs | 22 ---------------------- runtime/js/90_deno_ns.js | 4 ---- runtime/js/99_main.js | 4 ---- tests/specs/future/runtime_api/main.js | 2 -- tests/specs/future/runtime_api/main.out | 2 -- 10 files changed, 69 deletions(-) diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index 733e860d22b7a2..7a24c854abad67 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/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 3509a61d7bb5bf..adeceed533c27a 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 openSync( path, options, @@ -935,8 +925,6 @@ export { FsFile, fsync, fsyncSync, - funlock, - funlockSync, link, linkSync, lstat, 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/90_deno_ns.js b/runtime/js/90_deno_ns.js index db928bdfd3d986..e8e1ad57ac0781 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -169,8 +169,6 @@ denoNsUnstableById[unstableIds.ffi] = { }; denoNsUnstableById[unstableIds.fs] = { - funlock: fs.funlock, - funlockSync: fs.funlockSync, umask: fs.umask, }; @@ -217,8 +215,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, diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 1b80487251b61b..e00c592f16e9ef 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -802,8 +802,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { delete globalThis.window; delete Deno.Buffer; delete Deno.FsFile.prototype.rid; - delete Deno.funlock; - delete Deno.funlockSync; } } else { // Warmup @@ -963,8 +961,6 @@ function bootstrapWorkerRuntime( if (internals.future) { delete Deno.Buffer; delete Deno.FsFile.prototype.rid; - delete Deno.funlock; - delete Deno.funlockSync; } } else { // Warmup diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index 1a0275e5310b26..d19e68f1bbe02e 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -4,8 +4,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); // TCP // Since these tests may run in parallel, ensure this port is unique to this file diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index e04fce76af757d..beaeecd93a6bdb 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -1,8 +1,6 @@ window is undefined Deno.Buffer is undefined Deno.FsFile.prototype.rid is undefined -Deno.funlock is undefined -Deno.funlockSync is undefined Deno.Listener.prototype.rid is undefined Deno.Conn.prototype.rid is undefined Deno.UnixConn.prototype.rid is undefined