Skip to content

Commit 8aad508

Browse files
authored
Merge pull request #356 add comments about parallel calls of encoders/decoders
2 parents 5da10be + 6177adb commit 8aad508

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Added comments about calls encoders/decoders in parallel from multiply threads
2+
13
## 3.5.1 ##
24
* Fixed access to connection if connection cannot be found by node id
35

Diff for: ydb/topic.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ def reader(
170170
consumer: str,
171171
buffer_size_bytes: int = 50 * 1024 * 1024,
172172
# decoders: map[codec_code] func(encoded_bytes)->decoded_bytes
173+
# the func will be called from multiply threads in parallel
173174
decoders: Union[Mapping[int, Callable[[bytes], bytes]], None] = None,
174-
decoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool
175+
# custom decoder executor for call builtin and custom decoders. If None - use shared executor pool.
176+
# if max_worker in the executor is 1 - then decoders will be called from the thread without parallel
177+
decoder_executor: Optional[concurrent.futures.Executor] = None,
175178
) -> TopicReaderAsyncIO:
176179

177180
if not decoder_executor:
@@ -194,8 +197,12 @@ def writer(
194197
auto_seqno: bool = True,
195198
auto_created_at: bool = True,
196199
codec: Optional[TopicCodec] = None, # default mean auto-select
200+
# encoders: map[codec_code] func(encoded_bytes)->decoded_bytes
201+
# the func will be called from multiply threads in parallel.
197202
encoders: Optional[Mapping[_ydb_topic_public_types.PublicCodec, Callable[[bytes], bytes]]] = None,
198-
encoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool
203+
# custom encoder executor for call builtin and custom decoders. If None - use shared executor pool.
204+
# If max_worker in the executor is 1 - then encoders will be called from the thread without parallel.
205+
encoder_executor: Optional[concurrent.futures.Executor] = None,
199206
) -> TopicWriterAsyncIO:
200207
args = locals().copy()
201208
del args["self"]
@@ -319,7 +326,10 @@ def reader(
319326
consumer: str,
320327
buffer_size_bytes: int = 50 * 1024 * 1024,
321328
# decoders: map[codec_code] func(encoded_bytes)->decoded_bytes
329+
# the func will be called from multiply threads in parallel
322330
decoders: Union[Mapping[int, Callable[[bytes], bytes]], None] = None,
331+
# custom decoder executor for call builtin and custom decoders. If None - use shared executor pool.
332+
# if max_worker in the executor is 1 - then decoders will be called from the thread without parallel
323333
decoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool
324334
) -> TopicReader:
325335
if not decoder_executor:
@@ -343,7 +353,11 @@ def writer(
343353
auto_seqno: bool = True,
344354
auto_created_at: bool = True,
345355
codec: Optional[TopicCodec] = None, # default mean auto-select
356+
# encoders: map[codec_code] func(encoded_bytes)->decoded_bytes
357+
# the func will be called from multiply threads in parallel.
346358
encoders: Optional[Mapping[_ydb_topic_public_types.PublicCodec, Callable[[bytes], bytes]]] = None,
359+
# custom encoder executor for call builtin and custom decoders. If None - use shared executor pool.
360+
# If max_worker in the executor is 1 - then encoders will be called from the thread without parallel.
347361
encoder_executor: Optional[concurrent.futures.Executor] = None, # default shared client executor pool
348362
) -> TopicWriter:
349363
args = locals().copy()

0 commit comments

Comments
 (0)