Ferricstore.Store.BlobValue (ferricstore v0.4.1)

Copy Markdown View Source

Value-level glue for large payload blob side-channel storage.

Bitcask stores a fixed BlobRef only when the instance threshold is enabled and the persisted value is large enough. Values that already look like an encoded BlobRef are also externalized so arbitrary user bytes cannot be confused with an internal pointer on read.

Summary

Functions

Externalizes value to the blob store when it crosses the threshold.

Externalizes a batch of values with one blob append/fsync when needed.

Materializes an encoded blob ref when the side-channel is enabled.

Materializes a batch of values while loading each exact encoded blob ref once.

Returns the configured blob threshold, or 0 when disabled.

Functions

maybe_externalize(data_dir, shard_index, threshold, value)

@spec maybe_externalize(binary(), non_neg_integer(), non_neg_integer(), binary()) ::
  {:ok, binary()} | {:error, term()}

Externalizes value to the blob store when it crosses the threshold.

maybe_externalize_many(data_dir, shard_index, threshold, values)

@spec maybe_externalize_many(binary(), non_neg_integer(), non_neg_integer(), [
  binary()
]) ::
  {:ok, [binary()]} | {:error, term()}

Externalizes a batch of values with one blob append/fsync when needed.

maybe_materialize(data_dir, shard_index, threshold, value)

@spec maybe_materialize(binary(), non_neg_integer(), non_neg_integer(), term()) ::
  {:ok, term()} | {:error, term()}

Materializes an encoded blob ref when the side-channel is enabled.

When the threshold is disabled, ref-shaped user bytes are ordinary values. This keeps arbitrary 48-byte payloads from being misread as internal refs.

maybe_materialize_many(data_dir, shard_index, threshold, values)

@spec maybe_materialize_many(
  binary(),
  non_neg_integer(),
  non_neg_integer(),
  [term()]
) :: [ok: term(), error: term()]

Materializes a batch of values while loading each exact encoded blob ref once.

The result stays per-entry so one corrupt or missing blob ref only affects the values that point at that exact ref.

maybe_materialize_many(data_dir, shard_index, threshold, values, loader)

@spec maybe_materialize_many(
  binary(),
  non_neg_integer(),
  non_neg_integer(),
  [term()],
  (binary(), non_neg_integer(), Ferricstore.Store.BlobRef.t() ->
     {:ok, binary()}
     | {:error, term()})
) ::
  [ok: term(), error: term()]

threshold(arg1)

@spec threshold(term()) :: non_neg_integer()

Returns the configured blob threshold, or 0 when disabled.