WardrikEvents.Cursor (wardrik_events v0.1.0-rc.1)

Copy Markdown

Encodes and decodes cursors. A cursor is the last sequence number read in each log.

Summary

Types

t()

The last sequence number read, by log.

Functions

Decodes text from encode/1. Returns {:error, :invalid_cursor} if it isn't a cursor.

Encodes a cursor as URL-safe text, for :after.

Types

t()

@type t() :: %{required(String.t()) => non_neg_integer()}

The last sequence number read, by log.

Functions

decode(text)

@spec decode(String.t()) :: {:ok, t()} | {:error, :invalid_cursor}

Decodes text from encode/1. Returns {:error, :invalid_cursor} if it isn't a cursor.

encode(cursor)

@spec encode(t()) :: String.t()

Encodes a cursor as URL-safe text, for :after.