Rustler NIF bindings for Bitcask record I/O, hint files, and mmap-backed probabilistic data structure file operations.
Summary
Functions
Does the path exist? Follows symlinks (broken symlink → false). Never returns an error for the common kinds (missing, no-permission).
Is the path a directory? Follows symlinks. Returns false for
missing paths (matches File.dir?/1).
List the entries in a directory (names only, no path prefix). Yields every 256 entries to keep BEAM reductions accurate on huge directories.
Recursive mkdir -p. Idempotent when the directory already exists.
Equivalent to File.mkdir_p/1.
Atomic rename. On POSIX, rename replaces the target atomically.
Cross-device renames return {:error, {:other, _}} — caller must
handle with copy+remove.
Remove a single file. Use fs_rm_rf_async/3 for directory trees.
Async recursive remove. Runs on the Tokio blocking pool; sends
{:tokio_complete, correlation_id, :ok} or
{:tokio_complete, correlation_id, :error, {kind, msg}} to the
caller on completion. Idempotent: removing a non-existent path sends
:ok.
Creates an empty file if it does not exist. Idempotent on an existing
file (does not truncate). Equivalent to File.touch!/1 without the
timestamp update (matches our callers' usage).
Fsyncs a directory so that recent File.rename/2, File.rm/1,
File.touch!/1, or File.create/1 operations on files inside it are
durable. Use after any namespace mutation that must survive a kernel
panic — rotation, compaction rename, hint-file creation, prob-file
create/delete, shard init.
Types
Functions
@spec bloom_file_card(binary()) :: {:ok, non_neg_integer()} | {:error, term()}
@spec bloom_file_create(binary(), non_neg_integer(), non_neg_integer()) :: :ok | {:error, term()}
@spec bloom_file_info(binary()) :: {:ok, {non_neg_integer(), non_neg_integer(), non_neg_integer()}} | {:error, term()}
@spec cms_file_create(binary(), non_neg_integer(), non_neg_integer()) :: :ok | {:error, term()}
@spec cms_file_incrby(binary(), [{binary(), non_neg_integer()}]) :: :ok | {:error, term()}
@spec cms_file_info(binary()) :: {:ok, {non_neg_integer(), non_neg_integer(), non_neg_integer()}} | {:error, term()}
@spec cms_file_query(binary(), [binary()]) :: {:ok, [non_neg_integer()]} | {:error, term()}
@spec cuckoo_file_count(binary(), binary()) :: {:ok, non_neg_integer()} | {:error, term()}
@spec cuckoo_file_create(binary(), non_neg_integer(), non_neg_integer()) :: :ok | {:error, term()}
Does the path exist? Follows symlinks (broken symlink → false). Never returns an error for the common kinds (missing, no-permission).
Is the path a directory? Follows symlinks. Returns false for
missing paths (matches File.dir?/1).
List the entries in a directory (names only, no path prefix). Yields every 256 entries to keep BEAM reductions accurate on huge directories.
Recursive mkdir -p. Idempotent when the directory already exists.
Equivalent to File.mkdir_p/1.
Atomic rename. On POSIX, rename replaces the target atomically.
Cross-device renames return {:error, {:other, _}} — caller must
handle with copy+remove.
Remove a single file. Use fs_rm_rf_async/3 for directory trees.
Async recursive remove. Runs on the Tokio blocking pool; sends
{:tokio_complete, correlation_id, :ok} or
{:tokio_complete, correlation_id, :error, {kind, msg}} to the
caller on completion. Idempotent: removing a non-existent path sends
:ok.
Creates an empty file if it does not exist. Idempotent on an existing
file (does not truncate). Equivalent to File.touch!/1 without the
timestamp update (matches our callers' usage).
@spec rust_allocated_bytes() :: {:ok, non_neg_integer()} | {:error, term()}
@spec topk_file_count_v2(binary(), [binary()]) :: {:ok, [non_neg_integer()]} | {:error, term()}
@spec topk_file_create_v2( binary(), non_neg_integer(), non_neg_integer(), non_neg_integer(), float() ) :: :ok | {:error, term()}
@spec topk_file_incrby_v2(binary(), [{binary(), non_neg_integer()}]) :: {:ok, [binary() | nil]} | {:error, term()}
@spec topk_file_list_v2(binary()) :: {:ok, [{binary(), non_neg_integer()}]} | {:error, term()}
@spec v2_append_batch(binary(), [{binary(), binary(), non_neg_integer()}]) :: {:ok, [{non_neg_integer(), non_neg_integer()}]} | {:error, term()}
@spec v2_append_batch_nosync(binary(), [{binary(), binary(), non_neg_integer()}]) :: {:ok, [{non_neg_integer(), non_neg_integer()}]} | {:error, term()}
@spec v2_append_record(binary(), binary(), binary(), non_neg_integer()) :: {:ok, {non_neg_integer(), non_neg_integer()}} | {:error, term()}
@spec v2_append_tombstone(binary(), binary()) :: {:ok, non_neg_integer()} | {:error, term()}
@spec v2_copy_records(binary(), binary(), [non_neg_integer()]) :: :ok | {:error, term()}
Fsyncs a directory so that recent File.rename/2, File.rm/1,
File.touch!/1, or File.create/1 operations on files inside it are
durable. Use after any namespace mutation that must survive a kernel
panic — rotation, compaction rename, hint-file creation, prob-file
create/delete, shard init.
Returns :ok on success or {:error, reason} where reason is a
short string suitable for logging.
POSIX: file-data fsync does NOT make the filename durable; only a directory fsync does.
@spec v2_pread_at(binary(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
@spec v2_pread_at_async(pid(), term(), binary(), non_neg_integer()) :: :ok | {:error, term()}
@spec v2_pread_batch(binary(), [{non_neg_integer(), non_neg_integer()}]) :: {:ok, [binary()]} | {:error, term()}
@spec v2_pread_batch_async(pid(), term(), [{binary(), non_neg_integer()}]) :: :ok | {:error, term()}
@spec v2_read_hint_file(binary()) :: {:ok, [ {binary(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} ]} | {:error, term()}
@spec v2_scan_file(binary()) :: {:ok, [ {binary(), non_neg_integer(), non_neg_integer(), non_neg_integer(), boolean()} ]} | {:error, term()}
@spec v2_write_hint_file(binary(), [ {binary(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} ]) :: :ok | {:error, term()}