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.Message

Description

This module contains the binary protocols messages used in the streaming replication protocol as well as the messages used in the body of the logical stream messages.

Synopsis

Documentation

data ResponseExpectation Source #

Indicates whether the server or the client should respond to the message.

Instances

Instances details
Eq ResponseExpectation Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show ResponseExpectation Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic ResponseExpectation Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep ResponseExpectation :: Type -> Type #

Serialize ResponseExpectation Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep ResponseExpectation Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep ResponseExpectation = D1 ('MetaData "ResponseExpectation" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "ShouldRespond" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DoNotRespond" 'PrefixI 'False) (U1 :: Type -> Type))

data PrimaryKeepAlive Source #

The Postgres WAL sender thread may periodically send these messages. When the server expects the client to respond it updates its internal state of the client based on the response. Failure to respond results in the dreaded "WAL timeout" error.

See StandbyStatusUpdate for the message the client should respond with.

Instances

Instances details
Eq PrimaryKeepAlive Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show PrimaryKeepAlive Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic PrimaryKeepAlive Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep PrimaryKeepAlive :: Type -> Type #

Serialize PrimaryKeepAlive Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep PrimaryKeepAlive Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep PrimaryKeepAlive = D1 ('MetaData "PrimaryKeepAlive" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "PrimaryKeepAlive" 'PrefixI 'True) (S1 ('MetaSel ('Just "primaryKeepAliveWalEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: (S1 ('MetaSel ('Just "primaryKeepAliveSendTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Just "primaryKeepAliveResponseExpectation") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ResponseExpectation))))

data StandbyStatusUpdate Source #

Sent by the client. Can be sent periodically or in response to a PrimaryKeepAlive message from the server. Gives the server information about the client stream state.

Instances

Instances details
Eq StandbyStatusUpdate Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show StandbyStatusUpdate Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic StandbyStatusUpdate Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep StandbyStatusUpdate :: Type -> Type #

Serialize StandbyStatusUpdate Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep StandbyStatusUpdate Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep StandbyStatusUpdate = D1 ('MetaData "StandbyStatusUpdate" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "StandbyStatusUpdate" 'PrefixI 'True) ((S1 ('MetaSel ('Just "standbyStatuUpdateLastWalByteReceived") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LSN) :*: S1 ('MetaSel ('Just "standbyStatusUpdateLastWalByteFlushed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LSN)) :*: (S1 ('MetaSel ('Just "standbyStatusUpdateLastWalByteApplied") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LSN) :*: (S1 ('MetaSel ('Just "standbyStatusUpdateSendTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Just "standbyStatusUpdateResponseExpectation") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ResponseExpectation)))))

data XLogData Source #

Carries WAL segments in the streaming protocol.

Instances

Instances details
Eq XLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show XLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic XLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep XLogData :: Type -> Type #

Methods

from :: XLogData -> Rep XLogData x #

to :: Rep XLogData x -> XLogData #

Serialize XLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep XLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep XLogData = D1 ('MetaData "XLogData" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "XLogData" 'PrefixI 'True) ((S1 ('MetaSel ('Just "xLogDataWalStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LSN) :*: S1 ('MetaSel ('Just "xLogDataWalEnd") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LSN)) :*: (S1 ('MetaSel ('Just "xLogDataSendTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Just "xLogDataWalData") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))))

data HotStandbyFeedback Source #

Not used yet but enables streaming in hot-standby mode.

Instances

Instances details
Eq HotStandbyFeedback Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show HotStandbyFeedback Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic HotStandbyFeedback Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep HotStandbyFeedback :: Type -> Type #

Serialize HotStandbyFeedback Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep HotStandbyFeedback Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep HotStandbyFeedback = D1 ('MetaData "HotStandbyFeedback" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "HotStandbyFeedback" 'PrefixI 'True) (S1 ('MetaSel ('Just "hotStandbyFeedbackClientSendTime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: (S1 ('MetaSel ('Just "hotStandbyFeedbackCurrentXmin") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int32) :*: S1 ('MetaSel ('Just "hotStandbyFeedbackCurrentEpoch") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int32))))

data WalCopyData Source #

This structure wraps the two messages sent by the server so that we get a Serialize instance for both.

Instances

Instances details
Eq WalCopyData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show WalCopyData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic WalCopyData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep WalCopyData :: Type -> Type #

Serialize WalCopyData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep WalCopyData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep WalCopyData = D1 ('MetaData "WalCopyData" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "XLogDataM" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 XLogData)) :+: C1 ('MetaCons "KeepAliveM" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PrimaryKeepAlive)))

data WalValue Source #

Wraps Postgres values. Since this library currently supports only the wal2json logical decoder plugin we have the JSON values much like Aeson does.

Instances

Instances details
Eq WalValue Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show WalValue Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic WalValue Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep WalValue :: Type -> Type #

Methods

from :: WalValue -> Rep WalValue x #

to :: Rep WalValue x -> WalValue #

ToJSON WalValue Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

FromJSON WalValue Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep WalValue Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep WalValue = D1 ('MetaData "WalValue" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) ((C1 ('MetaCons "WalString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "WalNumber" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Scientific))) :+: (C1 ('MetaCons "WalBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :+: C1 ('MetaCons "WalNull" 'PrefixI 'False) (U1 :: Type -> Type)))

data Column Source #

Represents a single table column. We only support the wal2json logical decoder plugin and make no attempt to parse anything but JSON-like primitives.

Constructors

Column 

Instances

Instances details
Eq Column Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Methods

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

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

Show Column Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

columns :: [Text] -> [Text] -> [WalValue] -> Either ColumnParseError [Column] Source #

Some WAL output plugins encode column values in three, equal length, heterogeneous lists.

data Insert Source #

Represents a single insert query in the logical replication format.

Constructors

Insert 

data Update Source #

Represents a single update query in the logical replication format.

Constructors

Update 

data Delete Source #

Represents a single delete query in the logical replication format

Constructors

Delete 

data Message Source #

Occasionally the server may also send these for informational purposes and can be ignored. May be used internally.

data WalLogData Source #

Instances

Instances details
Eq WalLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Show WalLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic WalLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep WalLogData :: Type -> Type #

ToJSON WalLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

FromJSON WalLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep WalLogData Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep WalLogData = D1 ('MetaData "WalLogData" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) ((C1 ('MetaCons "WInsert" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Insert)) :+: C1 ('MetaCons "WUpdate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Update))) :+: (C1 ('MetaCons "WDelete" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Delete)) :+: C1 ('MetaCons "WMessage" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Message))))

data Change Source #

Constructors

Change 

Fields

Instances

Instances details
Eq Change Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Methods

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

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

Show Change Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Generic Change Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

Associated Types

type Rep Change :: Type -> Type #

Methods

from :: Change -> Rep Change x #

to :: Rep Change x -> Change #

ToJSON Change Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

FromJSON Change Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep Change Source # 
Instance details

Defined in Database.PostgreSQL.Replicant.Message

type Rep Change = D1 ('MetaData "Change" "Database.PostgreSQL.Replicant.Message" "postgresql-replicant-0.2.0.1-LfvKLvORtF58sQk3dBptIQ" 'False) (C1 ('MetaCons "Change" 'PrefixI 'True) (S1 ('MetaSel ('Just "changeNextLSN") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LSN) :*: S1 ('MetaSel ('Just "changeDeltas") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [WalLogData])))