Postgres log sequence numbers.
An LSN identifies a byte offset into the write-ahead log. Postgres
prints it as two hex halves joined by a slash, e.g. 0/16B374D;
the first half is the high 32 bits, the second the low 32.
This library represents an LSN as a plain 64-bit long, so ordinary
comparisons and arithmetic work on it: a later LSN is a bigger
number, and subtracting two LSNs yields the bytes of WAL between
them. Real-world LSNs stay far below Long/MAX_VALUE, so the
unsigned interpretation Postgres uses never matters in practice.
Postgres log sequence numbers. An LSN identifies a byte offset into the write-ahead log. Postgres prints it as two hex halves joined by a slash, e.g. ``0/16B374D``; the first half is the high 32 bits, the second the low 32. This library represents an LSN as a plain 64-bit long, so ordinary comparisons and arithmetic work on it: a later LSN is a bigger number, and subtracting two LSNs yields the bytes of WAL between them. Real-world LSNs stay far below ``Long/MAX_VALUE``, so the unsigned interpretation Postgres uses never matters in practice.
(diff lsn1 lsn2)Bytes of WAL between two LSNs: how far lsn2 is ahead of lsn1.
Negative when lsn2 is behind. Backs replication-lag reporting.
Bytes of WAL between two LSNs: how far `lsn2` is ahead of `lsn1`. Negative when `lsn2` is behind. Backs replication-lag reporting.
(format lsn)Render a long LSN in the canonical uppercase HI/LO text form.
Render a long LSN in the canonical uppercase ``HI/LO`` text form.
The LSN Postgres reports when no position exists (0/0).
The LSN Postgres reports when no position exists (``0/0``).
(parse s)Parse the textual LSN form HI/LO (hex, case-insensitive) into a
long. Throws ex-info when the string is not an LSN.
Parse the textual LSN form ``HI/LO`` (hex, case-insensitive) into a long. Throws ex-info when the string is not an LSN.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |