Module: Pgoutput::Messages

Defined in:
lib/pgoutput/messages.rb

Overview

Immutable message model classes for the PostgreSQL pgoutput protocol.

Every value returned by the parser is deeply shareable via ‘Ractor.make_shareable`. These classes are protocol-level structures only; they preserve tuple bytes and metadata but do not convert PostgreSQL values into application-specific Ruby types.

Defined Under Namespace

Classes: Begin, Column, Commit, Delete, Insert, Message, Origin, Relation, Truncate, TupleValue, Type, Update

Instance Attribute Summary collapse

Instance Attribute Details

#columnsArray<Column> (readonly)

Returns immutable column metadata.

Returns:

  • (Array<Column>)

    immutable column metadata.



67
# File 'lib/pgoutput/messages.rb', line 67

Relation = Data.define(:relation_id, :schema, :table, :replica_identity, :columns)

#commit_lsnInteger (readonly)

Returns commit LSN.

Returns:

  • (Integer)

    commit LSN.



142
# File 'lib/pgoutput/messages.rb', line 142

Commit = Data.define(:flags, :commit_lsn, :transaction_end_lsn, :commit_timestamp)

#commit_timestampInteger (readonly)

Returns microseconds since PostgreSQL epoch.

Returns:

  • (Integer)

    microseconds since PostgreSQL epoch.



21
# File 'lib/pgoutput/messages.rb', line 21

Begin = Data.define(:final_lsn, :commit_timestamp, :xid)

#contentString (readonly)

Returns immutable raw message content.

Returns:

  • (String)

    immutable raw message content.



33
# File 'lib/pgoutput/messages.rb', line 33

Message = Data.define(:flags, :lsn, :prefix, :content)

#final_lsnInteger (readonly)

Returns final transaction LSN.

Returns:

  • (Integer)

    final transaction LSN.



21
# File 'lib/pgoutput/messages.rb', line 21

Begin = Data.define(:final_lsn, :commit_timestamp, :xid)

#flagsInteger (readonly)

Returns commit flags; currently unused by PostgreSQL.

Returns:

  • (Integer)

    commit flags; currently unused by PostgreSQL.



33
# File 'lib/pgoutput/messages.rb', line 33

Message = Data.define(:flags, :lsn, :prefix, :content)

#format:null, ... (readonly)

Returns protocol value format.

Returns:

  • (:null, :unchanged_toast, :text, :binary)

    protocol value format.



87
# File 'lib/pgoutput/messages.rb', line 87

TupleValue = Data.define(:format, :raw, :oid)

#lsnInteger (readonly)

Returns LSN of the logical decoding message.

Returns:

  • (Integer)

    LSN of the logical decoding message.



33
# File 'lib/pgoutput/messages.rb', line 33

Message = Data.define(:flags, :lsn, :prefix, :content)

#nameString (readonly)

Returns type name.

Returns:

  • (String)

    type name.



41
# File 'lib/pgoutput/messages.rb', line 41

Origin = Data.define(:origin_lsn, :name)

#new_tupleArray<TupleValue> (readonly)

Returns new tuple data.

Returns:



110
# File 'lib/pgoutput/messages.rb', line 110

Update = Data.define(:relation_id, :old_key_tuple, :old_tuple, :new_tuple)

#oidInteger? (readonly)

Returns PostgreSQL type OID when relation metadata is known.

Returns:

  • (Integer, nil)

    PostgreSQL type OID when relation metadata is known.



53
# File 'lib/pgoutput/messages.rb', line 53

Column = Data.define(:flags, :name, :oid, :type_modifier)

#old_key_tupleArray<TupleValue>? (readonly)

Returns replica identity key tuple.

Returns:

  • (Array<TupleValue>, nil)

    replica identity key tuple.



110
# File 'lib/pgoutput/messages.rb', line 110

Update = Data.define(:relation_id, :old_key_tuple, :old_tuple, :new_tuple)

#old_tupleArray<TupleValue>? (readonly)

Returns full old tuple when replica identity is FULL.

Returns:

  • (Array<TupleValue>, nil)

    full old tuple when replica identity is FULL.



110
# File 'lib/pgoutput/messages.rb', line 110

Update = Data.define(:relation_id, :old_key_tuple, :old_tuple, :new_tuple)

#optionsInteger (readonly)

Returns option bits; 1 is CASCADE, 2 is RESTART IDENTITY.

Returns:

  • (Integer)

    option bits; 1 is CASCADE, 2 is RESTART IDENTITY.



130
# File 'lib/pgoutput/messages.rb', line 130

Truncate = Data.define(:relation_ids, :options)

#origin_lsnInteger (readonly)

Returns commit LSN on the origin server.

Returns:

  • (Integer)

    commit LSN on the origin server.



41
# File 'lib/pgoutput/messages.rb', line 41

Origin = Data.define(:origin_lsn, :name)

#prefixString (readonly)

Returns message prefix.

Returns:

  • (String)

    message prefix.



33
# File 'lib/pgoutput/messages.rb', line 33

Message = Data.define(:flags, :lsn, :prefix, :content)

#rawString? (readonly)

Returns immutable raw payload, or nil for NULL/TOAST markers.

Returns:

  • (String, nil)

    immutable raw payload, or nil for NULL/TOAST markers.



87
# File 'lib/pgoutput/messages.rb', line 87

TupleValue = Data.define(:format, :raw, :oid)

#relation_idInteger (readonly)

Returns relation OID.

Returns:

  • (Integer)

    relation OID.



67
# File 'lib/pgoutput/messages.rb', line 67

Relation = Data.define(:relation_id, :schema, :table, :replica_identity, :columns)

#relation_idsArray<Integer> (readonly)

Returns relation OIDs affected by the truncate.

Returns:

  • (Array<Integer>)

    relation OIDs affected by the truncate.



130
# File 'lib/pgoutput/messages.rb', line 130

Truncate = Data.define(:relation_ids, :options)

#replica_identityInteger (readonly)

Returns relation replica identity setting.

Returns:

  • (Integer)

    relation replica identity setting.



67
# File 'lib/pgoutput/messages.rb', line 67

Relation = Data.define(:relation_id, :schema, :table, :replica_identity, :columns)

#schemaString (readonly)

Returns namespace name.

Returns:

  • (String)

    namespace name.



67
# File 'lib/pgoutput/messages.rb', line 67

Relation = Data.define(:relation_id, :schema, :table, :replica_identity, :columns)

#tableString (readonly)

Returns relation name.

Returns:

  • (String)

    relation name.



67
# File 'lib/pgoutput/messages.rb', line 67

Relation = Data.define(:relation_id, :schema, :table, :replica_identity, :columns)

#transaction_end_lsnInteger (readonly)

Returns transaction end LSN.

Returns:

  • (Integer)

    transaction end LSN.



142
# File 'lib/pgoutput/messages.rb', line 142

Commit = Data.define(:flags, :commit_lsn, :transaction_end_lsn, :commit_timestamp)

#tupleArray<TupleValue> (readonly)

Returns new tuple data.

Returns:



95
# File 'lib/pgoutput/messages.rb', line 95

Insert = Data.define(:relation_id, :tuple)

#type_modifierInteger (readonly)

Returns PostgreSQL type modifier.

Returns:

  • (Integer)

    PostgreSQL type modifier.



53
# File 'lib/pgoutput/messages.rb', line 53

Column = Data.define(:flags, :name, :oid, :type_modifier)

#xidInteger (readonly)

Returns transaction id.

Returns:

  • (Integer)

    transaction id.



21
# File 'lib/pgoutput/messages.rb', line 21

Begin = Data.define(:final_lsn, :commit_timestamp, :xid)