Esempio n. 1
0
    def __init__(self, storage: WritableTableStorage,
                 metrics: MetricsBackend) -> None:
        self.clickhouse = storage.get_cluster().get_query_connection(
            ClickhouseClientSettings.REPLACE)

        self.metrics = metrics
        processor = storage.get_table_writer().get_replacer_processor()
        assert (
            processor
        ), f"This storage writer does not support replacements {storage.get_storage_key().value}"
        self.__replacer_processor = processor
        self.__database_name = storage.get_cluster().get_database()
        self.__table_name = (
            storage.get_table_writer().get_schema().get_local_table_name())
Esempio n. 2
0
    def __init__(self, storage: WritableTableStorage,
                 metrics: MetricsBackend) -> None:
        self.__storage = storage

        self.metrics = metrics
        processor = storage.get_table_writer().get_replacer_processor()
        assert (
            processor
        ), f"This storage writer does not support replacements {storage.get_storage_key().value}"
        self.__replacer_processor = processor
        self.__database_name = storage.get_cluster().get_database()

        self.__sharded_pool = RoundRobinConnectionPool(
            self.__storage.get_cluster())
Esempio n. 3
0
    def __init__(
        self,
        storage: WritableTableStorage,
        consumer_group: str,
        metrics: MetricsBackend,
    ) -> None:
        self.__storage = storage

        self.metrics = metrics
        processor = storage.get_table_writer().get_replacer_processor()
        assert (
            processor
        ), f"This storage writer does not support replacements {storage.get_storage_key().value}"
        self.__replacer_processor = processor
        self.__database_name = storage.get_cluster().get_database()

        self.__sharded_pool = RoundRobinConnectionPool(
            self.__storage.get_cluster())
        self.__rate_limiter = RateLimiter("replacements")

        self.__last_offset_processed_per_partition: MutableMapping[
            str, int] = dict()
        self.__consumer_group = consumer_group