Exemplo n.º 1
0
 def _sync_persisted_offsets(self, table: CollectionT,
                             tps: Set[TP]) -> None:
     for tp in tps:
         persisted_offset = table.persisted_offset(tp)
         if persisted_offset is not None:
             curr_offset = self._table_offsets.get(tp, -1)
             self._table_offsets[tp] = max(curr_offset, persisted_offset)
Exemplo n.º 2
0
 def _create_reviver(self, table: CollectionT,
                     tps: Set[TP]) -> ChangelogReaderT:
     table = cast(Table, table)
     offsets = self._table_offsets
     table_tps = {
         tp
         for tp in tps if tp.topic == table._changelog_topic_name()
     }
     self._sync_persisted_offsets(table, table_tps)
     tp_offsets: Counter[TP] = Counter(
         {tp: offsets[tp]
          for tp in table_tps if tp in offsets})
     channel = self._channels[table]
     return ChangelogReader(
         table,
         channel,
         self.app,
         table_tps,
         tp_offsets,
         loop=self.loop,
         beacon=self.beacon,
     )
Exemplo n.º 3
0
 def _add(self, table: CollectionT, tp: TP, offsets: Counter[TP]) -> None:
     self.tp_to_table[tp] = table
     persisted_offset = table.persisted_offset(tp)
     if persisted_offset is not None:
         offsets[tp] = persisted_offset
     offsets.setdefault(tp, None)  # type: ignore