diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3d478e..f8f20738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Added comments about calls encoders/decoders in parallel from multiply threads + ## 3.5.1 ## * Fixed access to connection if connection cannot be found by node id diff --git a/ydb/topic.py b/ydb/topic.py index 00ffb1c4..6843eb68 100644 --- a/ydb/topic.py +++ b/ydb/topic.py @@ -170,8 +170,11 @@ def reader( consumer: str, buffer_size_bytes: int = 50 * 1024 * 1024, # decoders: map[codec_code] func(encoded_bytes)->decoded_bytes + # the func will be called from multiply threads in parallel decoders: Union[Mapping[int, Callable[[bytes], bytes]], None] = None, - decoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool + # custom decoder executor for call builtin and custom decoders. If None - use shared executor pool. + # if max_worker in the executor is 1 - then decoders will be called from the thread without parallel + decoder_executor: Optional[concurrent.futures.Executor] = None, ) -> TopicReaderAsyncIO: if not decoder_executor: @@ -194,8 +197,12 @@ def writer( auto_seqno: bool = True, auto_created_at: bool = True, codec: Optional[TopicCodec] = None, # default mean auto-select + # encoders: map[codec_code] func(encoded_bytes)->decoded_bytes + # the func will be called from multiply threads in parallel. encoders: Optional[Mapping[_ydb_topic_public_types.PublicCodec, Callable[[bytes], bytes]]] = None, - encoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool + # custom encoder executor for call builtin and custom decoders. If None - use shared executor pool. + # If max_worker in the executor is 1 - then encoders will be called from the thread without parallel. + encoder_executor: Optional[concurrent.futures.Executor] = None, ) -> TopicWriterAsyncIO: args = locals().copy() del args["self"] @@ -319,7 +326,10 @@ def reader( consumer: str, buffer_size_bytes: int = 50 * 1024 * 1024, # decoders: map[codec_code] func(encoded_bytes)->decoded_bytes + # the func will be called from multiply threads in parallel decoders: Union[Mapping[int, Callable[[bytes], bytes]], None] = None, + # custom decoder executor for call builtin and custom decoders. If None - use shared executor pool. + # if max_worker in the executor is 1 - then decoders will be called from the thread without parallel decoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool ) -> TopicReader: if not decoder_executor: @@ -343,7 +353,11 @@ def writer( auto_seqno: bool = True, auto_created_at: bool = True, codec: Optional[TopicCodec] = None, # default mean auto-select + # encoders: map[codec_code] func(encoded_bytes)->decoded_bytes + # the func will be called from multiply threads in parallel. encoders: Optional[Mapping[_ydb_topic_public_types.PublicCodec, Callable[[bytes], bytes]]] = None, + # custom encoder executor for call builtin and custom decoders. If None - use shared executor pool. + # If max_worker in the executor is 1 - then encoders will be called from the thread without parallel. encoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool ) -> TopicWriter: args = locals().copy()