Class: Pgoutput::Decoder::RelationCache
- Inherits:
-
Object
- Object
- Pgoutput::Decoder::RelationCache
- Defined in:
- lib/pgoutput/decoder/relation_cache.rb
Overview
Mutable per-stream cache of pgoutput-parser Relation messages.
Instance Method Summary collapse
-
#fetch(relation_id) ⇒ Pgoutput::Messages::Relation
Fetch a relation message by id.
- #initialize ⇒ void constructor
-
#store(relation) ⇒ Pgoutput::Messages::Relation
Store a relation message.
Constructor Details
#initialize ⇒ void
10 11 12 |
# File 'lib/pgoutput/decoder/relation_cache.rb', line 10 def initialize @relations = {} # : Hash[Integer, untyped] end |
Instance Method Details
#fetch(relation_id) ⇒ Pgoutput::Messages::Relation
Fetch a relation message by id.
27 28 29 30 31 |
# File 'lib/pgoutput/decoder/relation_cache.rb', line 27 def fetch(relation_id) @relations.fetch(relation_id) do raise UnknownRelationError, "unknown relation id #{relation_id}; decode Relation message first" end end |
#store(relation) ⇒ Pgoutput::Messages::Relation
Store a relation message.
18 19 20 |
# File 'lib/pgoutput/decoder/relation_cache.rb', line 18 def store(relation) @relations[relation.relation_id] = relation end |