Liking cljdoc? Tell your friends :D

psql.replication

PostgreSQL streaming replication over pgjdbc: log sequence numbers (LSNs), replication-slot management, and logical decoding streams.

A replication connection is a special connection opened with the replication property set; replication-spec adds the required properties to a db spec. The server must run with wal_level = logical (and enough max_wal_senders / max_replication_slots) for logical replication.

PostgreSQL streaming replication over pgjdbc: log sequence numbers (LSNs),
replication-slot management, and logical decoding streams.

A replication connection is a special connection opened with the `replication`
property set; `replication-spec` adds the required properties to a db spec.
The server must run with `wal_level = logical` (and enough `max_wal_senders` /
`max_replication_slots`) for logical replication.
raw docstring

close-stream!clj

(close-stream! stream)

Close a replication STREAM.

Close a replication STREAM.
sourceraw docstring

create-logical-slot!clj

(create-logical-slot! conn slot-name plugin)

Create a logical replication SLOT-NAME using output PLUGIN (for example "pgoutput" or "test_decoding"). Returns a slot-info map with :slot-name, :replication-type, :consistent-point, :snapshot-name, and :output-plugin.

Create a logical replication SLOT-NAME using output PLUGIN (for example
"pgoutput" or "test_decoding"). Returns a slot-info map with
`:slot-name`, `:replication-type`, `:consistent-point`, `:snapshot-name`, and
`:output-plugin`.
sourceraw docstring

create-physical-slot!clj

(create-physical-slot! conn slot-name)

Create a physical replication SLOT-NAME. Returns a slot-info map.

Create a physical replication SLOT-NAME. Returns a slot-info map.
sourceraw docstring

drop-slot!clj

(drop-slot! conn slot-name)

Drop the replication slot SLOT-NAME.

Drop the replication slot SLOT-NAME.
sourceraw docstring

force-status-update!clj

(force-status-update! stream)

Send a standby status update to the server immediately.

Send a standby status update to the server immediately.
sourceraw docstring

last-received-lsnclj

(last-received-lsn stream)

The last LSN received on STREAM.

The last LSN received on STREAM.
sourceraw docstring

lsnclj

(lsn x)

Coerce X to a pgjdbc LogSequenceNumber. X is an LSN string like "16/B374D848", a long, or an existing LogSequenceNumber.

Coerce X to a pgjdbc `LogSequenceNumber`. X is an LSN string like
"16/B374D848", a long, or an existing `LogSequenceNumber`.
sourceraw docstring

lsn->longclj

(lsn->long l)

Return the 64-bit long value of an LSN.

Return the 64-bit long value of an LSN.
sourceraw docstring

lsn->stringclj

(lsn->string l)

Return the canonical X/Y string form of an LSN.

Return the canonical `X/Y` string form of an LSN.
sourceraw docstring

read-changeclj

(read-change stream)

Read the next change from STREAM as a java.nio.ByteBuffer, blocking until one is available.

Read the next change from STREAM as a `java.nio.ByteBuffer`, blocking until
one is available.
sourceraw docstring

read-pendingclj

(read-pending stream)

Read the next available change from STREAM as a java.nio.ByteBuffer, or nil if none is pending right now (non-blocking).

Read the next available change from STREAM as a `java.nio.ByteBuffer`, or nil
if none is pending right now (non-blocking).
sourceraw docstring

replication-apiclj

(replication-api conn)

Return pgjdbc's PGReplicationConnection for a connection opened from a replication-spec.

Return pgjdbc's `PGReplicationConnection` for a connection opened from a
`replication-spec`.
sourceraw docstring

replication-specclj

(replication-spec spec)

Return SPEC with the properties pgjdbc needs to open a replication connection: :replication "database", simple query mode, and a minimum server version. Pass the result to next.jdbc/get-connection.

Return SPEC with the properties pgjdbc needs to open a replication
connection: `:replication "database"`, simple query mode, and a minimum
server version. Pass the result to `next.jdbc/get-connection`.
sourceraw docstring

set-applied-lsn!clj

(set-applied-lsn! stream l)

Tell the server STREAM has applied up to L (an LSN).

Tell the server STREAM has applied up to L (an LSN).
sourceraw docstring

set-flushed-lsn!clj

(set-flushed-lsn! stream l)

Tell the server STREAM has durably flushed up to L (an LSN).

Tell the server STREAM has durably flushed up to L (an LSN).
sourceraw docstring

start-logical-replicationclj

(start-logical-replication conn
                           {:keys [slot-name start-lsn status-interval-ms
                                   slot-options]})

Start a logical decoding stream on an existing logical slot and return a pgjdbc PGReplicationStream. OPTS keys:

  • :slot-name (required) the logical slot to stream from
  • :start-lsn start position (LSN string/long/LogSequenceNumber)
  • :status-interval-ms standby status update interval
  • :slot-options a map of output-plugin option name to string value

Consume it with read-pending/read, acknowledge progress with set-flushed-lsn!/set-applied-lsn!, and close-stream! when done.

Start a logical decoding stream on an existing logical slot and return a
pgjdbc `PGReplicationStream`. OPTS keys:

- `:slot-name`        (required) the logical slot to stream from
- `:start-lsn`        start position (LSN string/long/LogSequenceNumber)
- `:status-interval-ms` standby status update interval
- `:slot-options`     a map of output-plugin option name to string value

Consume it with `read-pending`/`read`, acknowledge progress with
`set-flushed-lsn!`/`set-applied-lsn!`, and `close-stream!` when done.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close