postgresql-replicant-0.2.0.1: PostgreSQL logical streaming replication library
Copyright(c) James King 2020 2021
LicenseBSD3
Maintainerjames@agentultra.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Replicant.Types.Lsn

Description

Log Sequence Number or LSN is a pointer to a place inside of a WAL log file. It contains the file name and an offset in bytes encoded in two parts.

LSNs can be serialized into 64-bit big-endian numbers in the binary protocol but are also represented textually in query results and other places.

This module follows a similar convention to many containers libraries and should probably be imported qualified to avoid name clashes if needed.

See: https://www.postgresql.org/docs/10/datatype-pg-lsn.html

Synopsis

Documentation

data LSN Source #

Constructors

LSN 

Fields

Instances

Instances details
Eq LSN Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Types.Lsn

Methods

(==) :: LSN -> LSN -> Bool #

(/=) :: LSN -> LSN -> Bool #

Ord LSN Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Types.Lsn

Methods

compare :: LSN -> LSN -> Ordering #

(<) :: LSN -> LSN -> Bool #

(<=) :: LSN -> LSN -> Bool #

(>) :: LSN -> LSN -> Bool #

(>=) :: LSN -> LSN -> Bool #

max :: LSN -> LSN -> LSN #

min :: LSN -> LSN -> LSN #

Show LSN Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Types.Lsn

Methods

showsPrec :: Int -> LSN -> ShowS #

show :: LSN -> String #

showList :: [LSN] -> ShowS #

ToJSON LSN Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Types.Lsn

FromJSON LSN Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Types.Lsn

Serialize LSN Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Types.Lsn

Methods

put :: Putter LSN #

get :: Get LSN #

toInt64 :: LSN -> Int64 Source #

Convert an LSN to a 64-bit integer

fromInt64 :: Int64 -> LSN Source #

Convert a 64-bit integer to an LSN

toByteString :: LSN -> ByteString Source #

Note that as of bytestring ~0.10.12.0 we don't have upper-case hex encoders but the patch to add them has been merged and when available we should switch to them

add :: LSN -> Int64 -> LSN Source #

Add a number of bytes to an LSN

sub :: LSN -> Int64 -> LSN Source #

Subtract a number of bytes from an LSN

subLsn :: LSN -> LSN -> Int64 Source #

Subtract two LSN's to calculate the difference of bytes between them.