Docket.GraphVersionPage (docket v0.1.1)

Copy Markdown View Source

One newest-first page of retained graph-version metadata.

Pagination uses the immutable (published_at, graph_hash) pair. Backends read at most one row beyond the requested limit and pass those already ordered candidates to new/3, which centralizes trimming and cursor derivation. Ordering and cursor exclusivity are storage-behaviour contracts; this value does not revalidate trusted backend output.

Summary

Types

Cursor selecting versions strictly older than this immutable key.

t()

Functions

Builds a page from newest-first candidates containing at most limit + 1 rows.

Types

cursor()

@type cursor() :: {DateTime.t(), String.t()}

Cursor selecting versions strictly older than this immutable key.

t()

@type t() :: %Docket.GraphVersionPage{
  has_more?: boolean(),
  next_before: cursor() | nil,
  versions: [Docket.GraphVersion.t()]
}

Functions

new(candidates, before, limit)

@spec new([Docket.GraphVersion.t()], cursor() | nil, pos_integer()) :: t()

Builds a page from newest-first candidates containing at most limit + 1 rows.

The extra candidate determines has_more? and is not returned. The next cursor is the last returned version's (published_at, graph_hash) key. An empty page preserves the supplied cursor.