cengal.parallel_execution.asyncio.efficient_streams.versions.v_0.efficient_streams_base_internal

Module Docstring Docstrings: http://www.python.org/dev/peps/pep-0257/

 1#!/usr/bin/env python
 2# coding=utf-8
 3
 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>
 5# 
 6# Licensed under the Apache License, Version 2.0 (the "License");
 7# you may not use this file except in compliance with the License.
 8# You may obtain a copy of the License at
 9# 
10#     http://www.apache.org/licenses/LICENSE-2.0
11# 
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18
19"""
20Module Docstring
21Docstrings: http://www.python.org/dev/peps/pep-0257/
22"""
23
24
25__author__ = "ButenkoMS <gtalk@butenkoms.space>"
26__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
27__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
28__license__ = "Apache License, Version 2.0"
29__version__ = "4.4.1"
30__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
31__email__ = "gtalk@butenkoms.space"
32# __status__ = "Prototype"
33__status__ = "Development"
34# __status__ = "Production"
35
36
37from typing import Optional
38
39
40DEFAULT_PROTOCOL_GREETING = b'<<MessageProtocol>>'
41MESSAGE_SIZE_MAX_POSSIBLE_LEN = 8
42MESSAGE_SIZE_LEN = MESSAGE_SIZE_MAX_POSSIBLE_LEN
43SERVER_ANSWER__KEYWORD_ACCEPTED = b'OK'
44
45
46# DEFAULT_LIMIT = 2 ** 24  # 64 KiB
47# DEFAULT_LIMIT = cpu_info().l2_cache_size_per_virtual_core
48# DEFAULT_LIMIT = cpu_info().l3_cache_size
49DEFAULT_LIMIT = 10 * 1024**2
50
51
52class MessageProtocolSettings:
53    def __init__(self, protocol_greeting: Optional[str], message_size_len: Optional[int], max_message_size_len: Optional[int]) -> None:
54        self.protocol_greeting = protocol_greeting or DEFAULT_PROTOCOL_GREETING
55        self.max_message_size_len = max_message_size_len or MESSAGE_SIZE_MAX_POSSIBLE_LEN
56        self.message_size_len = message_size_len or MESSAGE_SIZE_LEN
DEFAULT_PROTOCOL_GREETING = b'<<MessageProtocol>>'
MESSAGE_SIZE_MAX_POSSIBLE_LEN = 8
MESSAGE_SIZE_LEN = 8
SERVER_ANSWER__KEYWORD_ACCEPTED = b'OK'
DEFAULT_LIMIT = 10485760
class MessageProtocolSettings:
53class MessageProtocolSettings:
54    def __init__(self, protocol_greeting: Optional[str], message_size_len: Optional[int], max_message_size_len: Optional[int]) -> None:
55        self.protocol_greeting = protocol_greeting or DEFAULT_PROTOCOL_GREETING
56        self.max_message_size_len = max_message_size_len or MESSAGE_SIZE_MAX_POSSIBLE_LEN
57        self.message_size_len = message_size_len or MESSAGE_SIZE_LEN
MessageProtocolSettings( protocol_greeting: Union[str, NoneType], message_size_len: Union[int, NoneType], max_message_size_len: Union[int, NoneType])
54    def __init__(self, protocol_greeting: Optional[str], message_size_len: Optional[int], max_message_size_len: Optional[int]) -> None:
55        self.protocol_greeting = protocol_greeting or DEFAULT_PROTOCOL_GREETING
56        self.max_message_size_len = max_message_size_len or MESSAGE_SIZE_MAX_POSSIBLE_LEN
57        self.message_size_len = message_size_len or MESSAGE_SIZE_LEN
protocol_greeting
max_message_size_len
message_size_len