Copyright | (c) James King 2020 2021 |
---|---|
License | BSD3 |
Maintainer | james@agentultra.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
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.
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.
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.
Instances
Carries WAL segments in the streaming protocol.
XLogData | |
|
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.0-8EhsvkP2ynUCo4pWTu8JBk" '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
data WalCopyData Source #
This structure wraps the two messages sent by the server so that we get a Serialize instance for both.
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.0-8EhsvkP2ynUCo4pWTu8JBk" '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.
Column | |
|
data ColumnParseError Source #
Instances
Eq ColumnParseError Source # | |
Defined in Database.PostgreSQL.Replicant.Message (==) :: ColumnParseError -> ColumnParseError -> Bool # (/=) :: ColumnParseError -> ColumnParseError -> Bool # | |
Show ColumnParseError Source # | |
Defined in Database.PostgreSQL.Replicant.Message 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.
Insert | |
|
Represents a single update query in the logical replication format.
Update | |
|
Represents a single delete query in the logical replication format
Delete | |
|
Occasionally the server may also send these for informational purposes and can be ignored. May be used internally.
Message | |
|
data WalLogData Source #
Instances
Change | |
|
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.0-8EhsvkP2ynUCo4pWTu8JBk" 'False) (C1 ('MetaCons "Change" 'PrefixI 'True) (S1 ('MetaSel ('Just "changeNextLSN") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LSN) :*: S1 ('MetaSel ('Just "changeDeltas") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [WalLogData]))) |