Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(fs): remove Deno.funlock[Sync]() #25442

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cli/tools/test/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
2 changes: 0 additions & 2 deletions cli/tsc/99_main_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ delete Object.prototype.__proto__;
"UnixListenOptions",
"createHttpClient",
"dlopen",
"funlock",
"funlockSync",
"listen",
"listenDatagram",
"openKv",
Expand Down
18 changes: 0 additions & 18 deletions cli/tsc/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>;

/** **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.
Expand Down
12 changes: 0 additions & 12 deletions ext/fs/30_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -935,8 +925,6 @@ export {
FsFile,
fsync,
fsyncSync,
funlock,
funlockSync,
link,
linkSync,
lstat,
Expand Down
2 changes: 0 additions & 2 deletions ext/fs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 0 additions & 22 deletions ext/fs/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RefCell<OpState>>,
#[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,
Expand Down
4 changes: 0 additions & 4 deletions runtime/js/90_deno_ns.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ denoNsUnstableById[unstableIds.ffi] = {
};

denoNsUnstableById[unstableIds.fs] = {
funlock: fs.funlock,
funlockSync: fs.funlockSync,
umask: fs.umask,
};

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions runtime/js/99_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/specs/future/runtime_api/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/specs/future/runtime_api/main.out
Original file line number Diff line number Diff line change
@@ -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
Expand Down