Electric.LsnTracker (electric v1.6.2)

Copy Markdown View Source

Summary

Types

stack_ref()

@type stack_ref() :: Electric.stack_id() | atom()

Functions

broadcast_last_seen_lsn(stack_ref, lsn)

@spec broadcast_last_seen_lsn(
  stack_ref(),
  Electric.Postgres.Lsn.t() | non_neg_integer()
) :: :ok

get_last_broadcast_lsn(stack_ref)

@spec get_last_broadcast_lsn(stack_ref()) :: non_neg_integer()

Returns the most recently broadcast LSN, or 0 if none has been broadcast yet.

get_last_processed_lsn(stack_ref)

@spec get_last_processed_lsn(stack_ref()) :: Electric.Postgres.Lsn.t() | nil

initialize(stack_ref)

@spec initialize(stack_ref()) :: :ok

initialize_last_processed_lsn(stack_ref, lsn)

@spec initialize_last_processed_lsn(stack_ref(), Electric.Postgres.Lsn.t()) :: :ok

set_last_processed_lsn(stack_ref, lsn)

@spec set_last_processed_lsn(
  stack_ref(),
  Electric.Postgres.Lsn.t() | non_neg_integer()
) :: :ok

stack_ref(stack_id)

@spec stack_ref(Electric.stack_id()) :: atom()

Returns the ETS table name used to store LSN info for the given stack ID.

subscribe_to_global_lsn_updates(stack_ref, value \\ [])

@spec subscribe_to_global_lsn_updates(stack_ref(), term()) ::
  {:ok, pid()} | {:error, term()}

unsubscribe_from_global_lsn_updates(stack_ref)

@spec unsubscribe_from_global_lsn_updates(stack_ref()) :: :ok