Copyright | (c) James King 2020 2021 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
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
- data ResponseExpectation
- data PrimaryKeepAlive = PrimaryKeepAlive {}
- data StandbyStatusUpdate = StandbyStatusUpdate {}
- data XLogData = XLogData {}
- data HotStandbyFeedback = HotStandbyFeedback {}
- data WalCopyData
- data WalValue
- data Column = Column {
- columnName :: !Text
- columnType :: !Text
- columnValue :: !WalValue
- data ColumnParseError = ColumnLengthMatchError
- columns :: [Text] -> [Text] -> [WalValue] -> Either ColumnParseError [Column]
- fromColumn :: Column -> (Text, Text, WalValue)
- fromColumns :: [Column] -> ([Text], [Text], [WalValue])
- data Insert = Insert {
- insertSchema :: !String
- insertTable :: !String
- insertColumns :: ![Column]
- data Update = Update {
- updateSchema :: !Text
- updateTable :: !Text
- updateColumns :: ![Column]
- data Delete = Delete {
- deleteSchema :: !Text
- deleteTable :: !Text
- deleteColumns :: ![Column]
- data Message = Message {
- messageTransactional :: !Bool
- messagePrefix :: !Text
- messageContent :: !Text
- data WalLogData
- data Change = Change {
- changeNextLSN :: LSN
- changeDeltas :: [WalLogData]
Documentation
data ResponseExpectation Source #
Indicates whether the server or the client should respond to the message.
Constructors
ShouldRespond | |
DoNotRespond |
Instances
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.
Constructors
PrimaryKeepAlive | |
Instances
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.
Constructors
StandbyStatusUpdate | |
Instances
Carries WAL segments in the streaming protocol.
Constructors
XLogData | |
Fields
|
Instances
Eq XLogData Source # | |
Show XLogData Source # | |
Generic XLogData Source # | |
Serialize XLogData Source # | |
type Rep XLogData Source # | |
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.
Constructors
HotStandbyFeedback | |
Instances
data WalCopyData Source #
This structure wraps the two messages sent by the server so that we get a Serialize instance for both.
Constructors
XLogDataM !XLogData | |
KeepAliveM !PrimaryKeepAlive |
Instances
Wraps Postgres values. Since this library currently supports
only the wal2json
logical decoder plugin we have the JSON values
much like Aeson does.
Instances
Eq WalValue Source # | |
Show WalValue Source # | |
Generic WalValue Source # | |
ToJSON WalValue Source # | |
Defined in Database.PostgreSQL.Replicant.Message | |
FromJSON WalValue Source # | |
type Rep WalValue Source # | |
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))) |
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 | |
Fields
|
data ColumnParseError Source #
Constructors
ColumnLengthMatchError |
Instances
Eq ColumnParseError Source # | |
Defined in Database.PostgreSQL.Replicant.Message Methods (==) :: ColumnParseError -> ColumnParseError -> Bool # (/=) :: ColumnParseError -> ColumnParseError -> Bool # | |
Show ColumnParseError Source # | |
Defined in Database.PostgreSQL.Replicant.Message Methods showsPrec :: Int -> ColumnParseError -> ShowS # show :: ColumnParseError -> String # showList :: [ColumnParseError] -> ShowS # |
columns :: [Text] -> [Text] -> [WalValue] -> Either ColumnParseError [Column] Source #
Some WAL output plugins encode column values in three, equal length, heterogeneous lists.
Represents a single insert query in the logical replication format.
Constructors
Insert | |
Fields
|
Represents a single update query in the logical replication format.
Constructors
Update | |
Fields
|
Represents a single delete query in the logical replication format
Constructors
Delete | |
Fields
|
Occasionally the server may also send these for informational purposes and can be ignored. May be used internally.
Constructors
Message | |
Fields
|
data WalLogData Source #
Instances
Constructors
Change | |
Fields
|
Instances
Eq Change Source # | |
Show Change Source # | |
Generic Change Source # | |
ToJSON Change Source # | |
Defined in Database.PostgreSQL.Replicant.Message | |
FromJSON Change Source # | |
type Rep Change Source # | |
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]))) |