talos-python3 3.1.2__tar.gz → 3.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {talos-python3-3.1.2/talos_python3.egg-info → talos_python3-3.1.4}/PKG-INFO +2 -2
- {talos-python3-3.1.2 → talos_python3-3.1.4}/setup.py +5 -3
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/TalosClientConfig.py +1 -1
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/compression/Compression.py +6 -0
- talos_python3-3.1.4/talos/client/compression/Zstd.py +25 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/TalosConsumer.py +9 -1
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/TalosProducer.py +2 -4
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/TalosProducerConfig.py +1 -1
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/TalosProducerConfigKey.py +1 -1
- talos_python3-3.1.4/talos/test/client/test_zstd_compression.py +23 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/message/ttypes.py +6 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4/talos_python3.egg-info}/PKG-INFO +1 -1
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos_python3.egg-info/SOURCES.txt +2 -0
- talos_python3-3.1.4/talos_python3.egg-info/requires.txt +12 -0
- talos-python3-3.1.2/talos_python3.egg-info/requires.txt +0 -6
- {talos-python3-3.1.2 → talos_python3-3.1.4}/setup.cfg +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/admin/TalosAdmin.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/admin/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/Constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/ScheduleInfoCache.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/SimpleAbnormalCallback.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/TalosClientConfigkeys.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/TalosClientFactory.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/TalosErrors.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/TalosHttpClient.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/TopicAbnormalCallback.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/compression/Gzip.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/compression/Snappy.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/compression/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerialization.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializationFactory.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializerV1.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializerV2.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializerV3.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageVersion.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/MessageCheckpointer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/MessageProcessor.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/MessageProcessorFactory.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/MessageReader.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/MessageReaderFactory.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/PartitionFetcher.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/SimpleConsumer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/TalosConsumerConfigKeys.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/TalosMessageReader.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/consumer/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/example/SimpleConsumerDemo.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/example/SimpleProducerDemo.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/example/TalosAdminDemo.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/example/TalosConsumerDemo.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/example/TalosProducerDemo.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/example/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/BufferedMessageCount.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/PartitionMessageQueue.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/PartitionSender.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/Partitioner.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/ProducerNotActiveException.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/SimplePartitioner.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/SimpleProducer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/UserMessage.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/UserMessageCallback.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/UserMessageResult.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/producer/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/admin/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/client/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/client/test_socket.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/consumer/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/consumer/test_PartitionFetcher.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/consumer/test_SimpleConsumer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/consumer/test_TalosConsumer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/consumer/test_TalosMessageReader.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/producer/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/producer/test_PartitionMessageQueue.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/producer/test_PartitionSender.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/producer/test_TalosProducer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/producer/test_UserMessage.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/test.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/TMultiplexedProcessor.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/TRecursive.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/TSCons.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/TSerialization.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/TTornado.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/Thrift.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/auth/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/auth/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/auth/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/authorization/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/authorization/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/authorization/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/common/TalosBaseService.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/common/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/common/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/common/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/compat.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/consumer/ConsumerService.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/consumer/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/consumer/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/consumer/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/message/MessageService.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/message/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/message/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/metric/MetricService.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/metric/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/metric/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/metric/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TBase.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TBinaryProtocol.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TCompactProtocol.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/THeaderProtocol.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TJSONProtocol.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TMultiplexedProtocol.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TProtocol.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/TProtocolDecorator.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/protocol/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/quota/QuotaService.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/quota/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/quota/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/quota/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/server/THttpServer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/server/TNonblockingServer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/server/TProcessPoolServer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/server/TServer.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/server/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/topic/TopicService.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/topic/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/topic/constants.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/topic/ttypes.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/THeaderTransport.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/THttpClient.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/TSSLSocket.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/TSocket.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/TTransport.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/TTwisted.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/TZlibTransport.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/thrift/transport/sslcompat.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/utils/Const.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/utils/FalconWriter.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/utils/Utils.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos/utils/__init__.py +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos_python3.egg-info/dependency_links.txt +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos_python3.egg-info/not-zip-safe +0 -0
- {talos-python3-3.1.2 → talos_python3-3.1.4}/talos_python3.egg-info/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from setuptools import find_packages, setup
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
|
-
name='
|
|
5
|
-
version='3.1.
|
|
4
|
+
name='talos_python3',
|
|
5
|
+
version='3.1.4',
|
|
6
6
|
author='huyumei',
|
|
7
7
|
author_email='huyumei@xiaomi.com',
|
|
8
8
|
maintainer='fangchengjin',
|
|
@@ -13,7 +13,9 @@ setup(
|
|
|
13
13
|
zip_safe=False,
|
|
14
14
|
install_requires=[
|
|
15
15
|
'cffi',
|
|
16
|
-
'python-snappy==0.6.1',
|
|
16
|
+
'python-snappy==0.6.1; python_version < "3.8"',
|
|
17
|
+
'python-snappy; python_version >= "3.8"',
|
|
18
|
+
'zstandard==0.21.0',
|
|
17
19
|
'atomic',
|
|
18
20
|
'dnspython',
|
|
19
21
|
'requests',
|
|
@@ -190,7 +190,7 @@ class TalosClientConfig:
|
|
|
190
190
|
TalosProducerConfigKeys.GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE_DEFAULT)
|
|
191
191
|
|
|
192
192
|
if not (self._compressionType == "NONE" or self._compressionType == "GZIP"
|
|
193
|
-
or self._compressionType == "SNAPPY"):
|
|
193
|
+
or self._compressionType == "SNAPPY" or self._compressionType == "ZSTD"):
|
|
194
194
|
raise RuntimeError("Unsupported Compression Type: " + self._compressionType)
|
|
195
195
|
|
|
196
196
|
# consumer configs
|
|
@@ -16,6 +16,7 @@ from talos.client.serialization.MessageSerialization import MessageSerialization
|
|
|
16
16
|
from talos.client.Constants import Constants
|
|
17
17
|
from talos.client.compression.Gzip import Gzip
|
|
18
18
|
from talos.client.compression.Snappy import Snappy
|
|
19
|
+
from talos.client.compression.Zstd import Zstd
|
|
19
20
|
from io import BytesIO
|
|
20
21
|
import logging
|
|
21
22
|
import traceback
|
|
@@ -26,6 +27,7 @@ class Compression(object):
|
|
|
26
27
|
logger = logging.getLogger("Compression")
|
|
27
28
|
gzip = Gzip()
|
|
28
29
|
snappy = Snappy()
|
|
30
|
+
zstd = Zstd()
|
|
29
31
|
|
|
30
32
|
def compress(self, msgList=None, compressionType=None):
|
|
31
33
|
return self.do_compress(msgList, compressionType, MessageSerializationFactory().get_default_message_version())
|
|
@@ -59,6 +61,8 @@ class Compression(object):
|
|
|
59
61
|
messageBlockData = self.gzip.compress(dataOutputIo.getvalue())
|
|
60
62
|
elif messageCompressionType == MessageCompressionType.SNAPPY:
|
|
61
63
|
messageBlockData = self.snappy.encode(dataOutputIo.getvalue())
|
|
64
|
+
elif messageCompressionType == MessageCompressionType.ZSTD:
|
|
65
|
+
messageBlockData = self.zstd.compress(dataOutputIo.getvalue())
|
|
62
66
|
else:
|
|
63
67
|
raise RuntimeError("Unsupported Compression Type: " + str(compressionType))
|
|
64
68
|
|
|
@@ -97,6 +101,8 @@ class Compression(object):
|
|
|
97
101
|
messageBlockData = BytesIO(self.gzip.decompress(messageBlock.messageBlock))
|
|
98
102
|
elif messageBlock.compressionType == MessageCompressionType.SNAPPY:
|
|
99
103
|
messageBlockData = BytesIO(self.snappy.decode(messageBlock.messageBlock))
|
|
104
|
+
elif messageBlock.compressionType == MessageCompressionType.ZSTD:
|
|
105
|
+
messageBlockData = BytesIO(self.zstd.decompress(messageBlock.messageBlock))
|
|
100
106
|
|
|
101
107
|
messageNumber = messageBlock.messageNumber
|
|
102
108
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -*- coding:utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2026, Xiaomi.
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
class Zstd:
|
|
8
|
+
def __init__(self):
|
|
9
|
+
try:
|
|
10
|
+
import zstandard
|
|
11
|
+
except ImportError:
|
|
12
|
+
raise ImportError(
|
|
13
|
+
"zstandard is required for ZSTD compression. "
|
|
14
|
+
"Please install: pip install zstandard==0.21.0"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
self._zstd = zstandard
|
|
18
|
+
self._compressor = zstandard.ZstdCompressor()
|
|
19
|
+
self._decompressor = zstandard.ZstdDecompressor()
|
|
20
|
+
|
|
21
|
+
def compress(self, c_data):
|
|
22
|
+
return self._compressor.compress(c_data)
|
|
23
|
+
|
|
24
|
+
def decompress(self, c_data):
|
|
25
|
+
return self._decompressor.decompress(c_data)
|
|
@@ -180,7 +180,7 @@ class TalosConsumer(object):
|
|
|
180
180
|
return
|
|
181
181
|
|
|
182
182
|
topicPartitionNum = response.partitionNumber
|
|
183
|
-
if self.partitionNumber
|
|
183
|
+
if self.partitionNumber != topicPartitionNum:
|
|
184
184
|
logger.info("partitionNumber changed from " + str(self.partitionNumber) + " to " +
|
|
185
185
|
str(topicPartitionNum) + ", execute a re-balance task.")
|
|
186
186
|
# update partition number and call the re - balance
|
|
@@ -458,6 +458,14 @@ class TalosConsumer(object):
|
|
|
458
458
|
hasList = self.get_has_list()
|
|
459
459
|
has = len(hasList)
|
|
460
460
|
|
|
461
|
+
hasList.sort()
|
|
462
|
+
# release all reduced partition and wait next cycle to balance
|
|
463
|
+
if len(hasList) > 0 and hasList[len(hasList) - 1] >= self.partitionNumber:
|
|
464
|
+
for partitionId in hasList:
|
|
465
|
+
if partitionId >= self.partitionNumber:
|
|
466
|
+
toReleaseList.append(partitionId)
|
|
467
|
+
break
|
|
468
|
+
|
|
461
469
|
# workerNum > partitionNum, idle workers have no match target, do nothing
|
|
462
470
|
if i >= len(targetList):
|
|
463
471
|
break
|
|
@@ -261,10 +261,8 @@ class TalosProducer(object):
|
|
|
261
261
|
self.updatePartitionIdMsgNumber)
|
|
262
262
|
|
|
263
263
|
def check_message_partition_key_validity(self, partitionKey=None):
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
except AssertionError as e:
|
|
267
|
-
raise e
|
|
264
|
+
if not partitionKey:
|
|
265
|
+
raise InvalidArgumentError("Field \"partitionKey\" must be set")
|
|
268
266
|
|
|
269
267
|
if len(partitionKey) < self.partitionKeyMinLen or len(partitionKey) > self.partitionKeyMaxLen:
|
|
270
268
|
raise InvalidArgumentError("Invalid partition key which length must be at "
|
|
@@ -54,7 +54,7 @@ class TalosProducerConfig(TalosClientConfig):
|
|
|
54
54
|
TalosProducerConfigKeys.GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE_DEFAULT)
|
|
55
55
|
|
|
56
56
|
if not (self._compressionType == "NONE" or self._compressionType == "GZIP"
|
|
57
|
-
or self._compressionType == "SNAPPY"):
|
|
57
|
+
or self._compressionType == "SNAPPY" or self._compressionType == "ZSTD"):
|
|
58
58
|
raise RuntimeError("Unsupported Compression Type: " + self._compressionType)
|
|
59
59
|
|
|
60
60
|
def parameter_checking(self):
|
|
@@ -84,7 +84,7 @@ class TalosProducerConfigKeys(TalosClientConfigKeys):
|
|
|
84
84
|
GALAXY_TALOS_PRODUCER_WAIT_PARTITION_WORKING_TIME = "galaxy.talos.producer.wait.partition.working.time.milli"
|
|
85
85
|
GALAXY_TALOS_PRODUCER_WAIT_PARTITION_WORKING_TIME_DEFAULT = 0.2
|
|
86
86
|
|
|
87
|
-
# The producer compression type, right now
|
|
87
|
+
# The producer compression type, right now support "NONE", "SNAPPY", "GZIP" and "ZSTD";
|
|
88
88
|
# default is "SNAPPY";
|
|
89
89
|
GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE = "galaxy.talos.producer.compression.type"
|
|
90
90
|
GALAXY_TALOS_PRODUCER_COMPRESSION_TYPE_DEFAULT = "SNAPPY"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Copyright 2026, Xiaomi.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
import unittest
|
|
5
|
+
|
|
6
|
+
from talos.client.compression.Compression import Compression
|
|
7
|
+
from talos.thrift.message.ttypes import Message
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class test_ZstdCompression(unittest.TestCase):
|
|
11
|
+
|
|
12
|
+
def test_compress_decompress_roundtrip(self):
|
|
13
|
+
msg1 = Message(partitionKey="k1", sequenceNumber="s1", message=b"hello", createTimestamp=1)
|
|
14
|
+
msg2 = Message(partitionKey="k2", sequenceNumber="s2", message=b"world", createTimestamp=2)
|
|
15
|
+
|
|
16
|
+
msg_block = Compression().compress([msg1, msg2], "ZSTD")
|
|
17
|
+
self.assertIsNotNone(msg_block)
|
|
18
|
+
|
|
19
|
+
out = Compression().decompress([msg_block], 0)
|
|
20
|
+
self.assertEqual(2, len(out))
|
|
21
|
+
|
|
22
|
+
self.assertEqual(b"hello", out[0].message.message)
|
|
23
|
+
self.assertEqual(b"world", out[1].message.message)
|
|
@@ -58,17 +58,23 @@ class MessageCompressionType:
|
|
|
58
58
|
NONE = 0
|
|
59
59
|
SNAPPY = 1
|
|
60
60
|
GZIP = 2
|
|
61
|
+
ZSTD = 3
|
|
62
|
+
LZ4 = 4
|
|
61
63
|
|
|
62
64
|
_VALUES_TO_NAMES = {
|
|
63
65
|
0: "NONE",
|
|
64
66
|
1: "SNAPPY",
|
|
65
67
|
2: "GZIP",
|
|
68
|
+
3: "ZSTD",
|
|
69
|
+
4: "LZ4",
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
_NAMES_TO_VALUES = {
|
|
69
73
|
"NONE": 0,
|
|
70
74
|
"SNAPPY": 1,
|
|
71
75
|
"GZIP": 2,
|
|
76
|
+
"ZSTD": 3,
|
|
77
|
+
"LZ4": 4,
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
|
|
@@ -15,6 +15,7 @@ talos/client/__init__.py
|
|
|
15
15
|
talos/client/compression/Compression.py
|
|
16
16
|
talos/client/compression/Gzip.py
|
|
17
17
|
talos/client/compression/Snappy.py
|
|
18
|
+
talos/client/compression/Zstd.py
|
|
18
19
|
talos/client/compression/__init__.py
|
|
19
20
|
talos/client/serialization/MessageSerialization.py
|
|
20
21
|
talos/client/serialization/MessageSerializationFactory.py
|
|
@@ -60,6 +61,7 @@ talos/test/test.py
|
|
|
60
61
|
talos/test/admin/__init__.py
|
|
61
62
|
talos/test/client/__init__.py
|
|
62
63
|
talos/test/client/test_socket.py
|
|
64
|
+
talos/test/client/test_zstd_compression.py
|
|
63
65
|
talos/test/consumer/__init__.py
|
|
64
66
|
talos/test/consumer/test_PartitionFetcher.py
|
|
65
67
|
talos/test/consumer/test_SimpleConsumer.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerialization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializerV1.py
RENAMED
|
File without changes
|
{talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializerV2.py
RENAMED
|
File without changes
|
{talos-python3-3.1.2 → talos_python3-3.1.4}/talos/client/serialization/MessageSerializerV3.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{talos-python3-3.1.2 → talos_python3-3.1.4}/talos/test/producer/test_PartitionMessageQueue.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|