Electric.AsyncDeleter (electric v1.4.13)

View Source

A service that batches file/directory deletions by first moving them into a per-stack trash directory and then, after a configurable interval, removing the trash directory contents in one rm -rf operation.

This reduces filesystem churn when many deletes happen in quick succession (e.g. cache eviction) and avoids blocking callers: delete/1 returns after a quick File.rename/2 into the trash directory.

Configuration:

  • :cleanup_interval_ms - interval in milliseconds after the first queued delete before the batch is removed. Defaults to 10000 ms.

Summary

Functions

Returns a specification to start this module under a supervisor.

Deletes the given directory by first renaming it into the stack's trash directory then asynchronously removing the trash entry using rm -rf.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete(stack_id, path)

@spec delete(Electric.stack_id(), Path.t()) :: :ok | {:error, term()}

Deletes the given directory by first renaming it into the stack's trash directory then asynchronously removing the trash entry using rm -rf.

name(stack_id)

start_link(opts)

trash_dir(storage_dir, stack_id)

trash_dir!(stack_id)