Class: Pgoutput::RelationTracker
- Inherits:
-
Object
- Object
- Pgoutput::RelationTracker
- Defined in:
- lib/pgoutput/relation_tracker.rb
Overview
Stateful relation tracker for pgoutput message sequences.
The relation tracker remembers Relation (‘R`) messages so DML tuple values can be annotated with PostgreSQL type OIDs. It does not decode or convert values. It only adds protocol metadata to tuple values while keeping returned objects deeply shareable.
The instance contains mutable relation-cache state and should not be shared across Ractors. Returned message objects are Ractor-safe.
Instance Method Summary collapse
-
#decode(payload) ⇒ Pgoutput::Messages::Begin, ...
Backwards-compatible alias for callers migrating from RelationTracker.
- #initialize ⇒ void constructor
-
#process(payload) ⇒ Pgoutput::Messages::Begin, ...
Process one pgoutput payload in stream order.
Constructor Details
#initialize ⇒ void
17 18 19 |
# File 'lib/pgoutput/relation_tracker.rb', line 17 def initialize @relations = {} end |
Instance Method Details
#decode(payload) ⇒ Pgoutput::Messages::Begin, ...
Backwards-compatible alias for callers migrating from RelationTracker.
52 53 54 |
# File 'lib/pgoutput/relation_tracker.rb', line 52 def decode(payload) process(payload) end |
#process(payload) ⇒ Pgoutput::Messages::Begin, ...
Process one pgoutput payload in stream order.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pgoutput/relation_tracker.rb', line 28 def process(payload) = BinaryParser.new(payload).parse case when Messages::Relation @relations[.relation_id] = when Messages::Insert annotate_insert() when Messages::Update annotate_update() when Messages::Delete annotate_delete() else end end |