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

chore(fs): remove Deno.flock[Sync]() #25350

Merged
merged 2 commits into from
Sep 3, 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 @@ -320,7 +320,6 @@ pub const OP_DETAILS: phf::Map<&'static str, [&'static str; 2]> = phf_map! {
"op_fs_events_poll" => ["get the next file system event", "breaking out of a for await loop looping over `Deno.FsEvents`"],
"op_fs_fdatasync_async" => ["flush pending data operations for a file to disk", "awaiting the result of a `Deno.fdatasync` or `Deno.FsFile.syncData` call"],
"op_fs_file_stat_async" => ["get file metadata", "awaiting the result of a `Deno.fstat` or `Deno.FsFile.stat` call"],
"op_fs_flock_async_unstable" => ["lock a file", "awaiting the result of a `Deno.flock` call"],
"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_ftruncate_async" => ["truncate a file", "awaiting the result of a `Deno.ftruncate` or `Deno.FsFile.truncate` 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",
"flock",
"flockSync",
"funlock",
"funlockSync",
"listen",
Expand Down
20 changes: 0 additions & 20 deletions cli/tsc/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1216,26 +1216,6 @@ declare namespace Deno {
options: UnixListenOptions & { transport: "unixpacket" },
): DatagramConn;

/** **UNSTABLE**: New API, yet to be vetted.
*
* Acquire an advisory file-system lock for the provided file.
*
* @param [exclusive=false]
* @category File System
* @experimental
*/
export function flock(rid: number, exclusive?: boolean): Promise<void>;

/** **UNSTABLE**: New API, yet to be vetted.
*
* Acquire an advisory file-system lock synchronously for the provided file.
*
* @param [exclusive=false]
* @category File System
* @experimental
*/
export function flockSync(rid: number, exclusive?: boolean): void;

/** **UNSTABLE**: New API, yet to be vetted.
*
* Release an advisory file-system lock for the provided file.
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 @@ -20,9 +20,7 @@ import {
op_fs_file_stat_async,
op_fs_file_stat_sync,
op_fs_flock_async,
op_fs_flock_async_unstable,
op_fs_flock_sync,
op_fs_flock_sync_unstable,
op_fs_fsync_async,
op_fs_fsync_sync,
op_fs_ftruncate_async,
Expand Down Expand Up @@ -554,14 +552,6 @@ async function fsync(rid) {
await op_fs_fsync_async(rid);
}

function flockSync(rid, exclusive) {
op_fs_flock_sync_unstable(rid, exclusive === true);
}

async function flock(rid, exclusive) {
await op_fs_flock_async_unstable(rid, exclusive === true);
}

function funlockSync(rid) {
op_fs_funlock_sync_unstable(rid);
}
Expand Down Expand Up @@ -977,8 +967,6 @@ export {
fdatasync,
fdatasyncSync,
File,
flock,
flockSync,
FsFile,
fstat,
fstatSync,
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_flock_sync_unstable,
op_fs_flock_async_unstable,
op_fs_funlock_sync_unstable,
op_fs_funlock_async_unstable,
op_fs_flock_async,
Expand Down
24 changes: 0 additions & 24 deletions ext/fs/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,30 +1493,6 @@ pub async fn op_fs_file_stat_async(
Ok(stat.into())
}

#[op2(fast)]
pub fn op_fs_flock_sync_unstable(
state: &mut OpState,
#[smi] rid: ResourceId,
exclusive: bool,
) -> Result<(), AnyError> {
check_unstable(state, "Deno.flockSync");
let file = FileResource::get_file(state, rid)?;
file.lock_sync(exclusive)?;
Ok(())
}

#[op2(async)]
pub async fn op_fs_flock_async_unstable(
state: Rc<RefCell<OpState>>,
#[smi] rid: ResourceId,
exclusive: bool,
) -> Result<(), AnyError> {
check_unstable(&state.borrow(), "Deno.flock");
let file = FileResource::get_file(&state.borrow(), rid)?;
file.lock_async(exclusive).await?;
Ok(())
}

#[op2(fast)]
pub fn op_fs_funlock_sync_unstable(
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 @@ -253,8 +253,6 @@ denoNsUnstableById[unstableIds.ffi] = {
};

denoNsUnstableById[unstableIds.fs] = {
flock: fs.flock,
flockSync: fs.flockSync,
funlock: fs.funlock,
funlockSync: fs.funlockSync,
umask: fs.umask,
Expand Down Expand Up @@ -303,8 +301,6 @@ const denoNsUnstable = {
UnsafePointerView: ffi.UnsafePointerView,
UnsafeFnPointer: ffi.UnsafeFnPointer,
UnsafeWindowSurface: webgpuSurface.UnsafeWindowSurface,
flock: fs.flock,
flockSync: fs.flockSync,
funlock: fs.funlock,
funlockSync: fs.funlockSync,
openKv: kv.openKv,
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 @@ -935,8 +935,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
delete Deno.fstatSync;
delete Deno.ftruncate;
delete Deno.ftruncateSync;
delete Deno.flock;
delete Deno.flockSync;
delete Deno.FsFile.prototype.rid;
delete Deno.funlock;
delete Deno.funlockSync;
Expand Down Expand Up @@ -1122,8 +1120,6 @@ function bootstrapWorkerRuntime(
delete Deno.fstatSync;
delete Deno.ftruncate;
delete Deno.ftruncateSync;
delete Deno.flock;
delete Deno.flockSync;
delete Deno.FsFile.prototype.rid;
delete Deno.funlock;
delete Deno.funlockSync;
Expand Down
1 change: 0 additions & 1 deletion tests/integration/js_unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ util::unit_test_factory!(
file_test,
filereader_test,
files_test,
flock_test,
fs_events_test,
get_random_values_test,
globals_test,
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 @@ -7,8 +7,6 @@ console.log("Deno.fstat is", Deno.fstat);
console.log("Deno.fstatSync is", Deno.fstatSync);
console.log("Deno.ftruncate is", Deno.ftruncate);
console.log("Deno.ftruncateSync is", Deno.ftruncateSync);
console.log("Deno.flock is", Deno.flock);
console.log("Deno.flockSync is", Deno.flockSync);
console.log(
"Deno.FsFile.prototype.rid is",
Deno.openSync(import.meta.filename).rid,
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
Expand Up @@ -7,8 +7,6 @@ Deno.fstat is undefined
Deno.fstatSync is undefined
Deno.ftruncate is undefined
Deno.ftruncateSync is undefined
Deno.flock is undefined
Deno.flockSync is undefined
Deno.FsFile.prototype.rid is undefined
Deno.funlock is undefined
Deno.funlockSync is undefined
Expand Down
197 changes: 0 additions & 197 deletions tests/unit/flock_test.ts

This file was deleted.