Ferricstore.Store.Ops (ferricstore v0.3.5)

Copy Markdown View Source

Unified interface for store operations.

Dispatches based on the type of store argument:

  • %FerricStore.Instance{} struct -> calls Router directly
  • %LocalTxStore{} struct -> local ETS for same-shard, Router for remote
  • map (closure-based store) -> calls the closure

This allows incremental migration from closure maps to instance structs without changing command handler logic.

Summary

Functions

append(ctx, key, suffix)

@spec append(store(), binary(), binary()) :: {:ok, non_neg_integer()}

cas(ctx, key, expected, new_val, ttl)

@spec cas(store(), binary(), binary(), binary(), non_neg_integer() | nil) ::
  1 | 0 | nil

compound_count(ctx, redis_key, prefix)

@spec compound_count(store(), binary(), binary()) :: non_neg_integer()

compound_delete(ctx, redis_key, compound_key)

@spec compound_delete(store(), binary(), binary()) :: :ok

compound_delete_prefix(ctx, redis_key, prefix)

@spec compound_delete_prefix(store(), binary(), binary()) :: :ok

compound_get(ctx, redis_key, compound_key)

@spec compound_get(store(), binary(), binary()) :: binary() | nil

compound_get_meta(ctx, redis_key, compound_key)

@spec compound_get_meta(store(), binary(), binary()) ::
  {binary(), non_neg_integer()} | nil

compound_put(ctx, redis_key, compound_key, value, exp)

@spec compound_put(store(), binary(), binary(), binary(), non_neg_integer()) :: :ok

compound_scan(ctx, redis_key, prefix)

@spec compound_scan(store(), binary(), binary()) :: [{binary(), binary()}]

dbsize(ctx)

@spec dbsize(store()) :: non_neg_integer()

delete(ctx, key)

@spec delete(store(), binary()) :: :ok

exists?(ctx, key)

@spec exists?(store(), binary()) :: boolean()

extend(ctx, key, owner, ttl)

@spec extend(store(), binary(), binary(), pos_integer()) :: 1 | {:error, binary()}

flush(ctx)

@spec flush(store()) :: :ok

get(ctx, key)

@spec get(store(), binary()) :: binary() | nil

get_meta(ctx, key)

@spec get_meta(store(), binary()) :: {binary(), non_neg_integer()} | nil

getdel(ctx, key)

@spec getdel(store(), binary()) :: binary() | nil

getex(ctx, key, exp)

@spec getex(store(), binary(), non_neg_integer()) :: binary() | nil

getset(ctx, key, value)

@spec getset(store(), binary(), binary()) :: binary() | nil

has_compound?(store)

@spec has_compound?(store()) :: boolean()

incr(ctx, key, delta)

@spec incr(store(), binary(), integer()) :: {:ok, integer()} | {:error, binary()}

incr_float(ctx, key, delta)

@spec incr_float(store(), binary(), float()) :: {:ok, binary()} | {:error, binary()}

keys(ctx)

@spec keys(store()) :: [binary()]

list_op(ctx, key, op)

@spec list_op(store(), binary(), term()) :: term()

lock(ctx, key, owner, ttl)

@spec lock(store(), binary(), binary(), pos_integer()) :: :ok | {:error, binary()}

on_push(store, key)

@spec on_push(store(), binary()) :: :ok | nil

prob_dir(ctx, key)

@spec prob_dir(store(), binary()) :: binary()

prob_write(ctx, command)

@spec prob_write(store(), tuple()) :: term()

put(ctx, key, value, exp)

@spec put(store(), binary(), binary(), non_neg_integer()) :: :ok | {:error, binary()}

ratelimit_add(ctx, key, window, max, count)

@spec ratelimit_add(store(), binary(), pos_integer(), pos_integer(), pos_integer()) ::
  [term()]

setrange(ctx, key, offset, value)

@spec setrange(store(), binary(), non_neg_integer(), binary()) ::
  {:ok, non_neg_integer()}

unlock(ctx, key, owner)

@spec unlock(store(), binary(), binary()) :: 1 | {:error, binary()}