def __init__( self, config, version=1, global_partition_strategy=default_partition_strategy, output_buffer_size=DEFAULT_OUT_BUFFER_SIZE, ): super(SerializationServiceV1, self).__init__( version, global_partition_strategy, output_buffer_size, config.is_big_endian, config.default_int_type, ) self._portable_context = PortableContext(self, config.portable_version) self.register_class_definitions(config.class_definitions, config.check_class_definition_errors) self._registry._portable_serializer = PortableSerializer( self._portable_context, config.portable_factories) # merge configured factories with built in ones factories = {} factories.update(config.data_serializable_factories) self._registry._data_serializer = IdentifiedDataSerializer(factories) self._register_constant_serializers() # Register Custom Serializers for _type, custom_serializer in six.iteritems( config.custom_serializers): self._registry.safe_register_serializer(custom_serializer(), _type) # Register Global Serializer global_serializer = config.global_serializer if global_serializer: self._registry._global_serializer = global_serializer()
def __init__( self, config, version=1, global_partition_strategy=default_partition_strategy, output_buffer_size=DEFAULT_OUT_BUFFER_SIZE, ): self._version = version self._global_partition_strategy = global_partition_strategy self._output_buffer_size = output_buffer_size self._is_big_endian = config.is_big_endian self._active = True self._portable_context = PortableContext(self, config.portable_version) self.register_class_definitions(config.class_definitions, config.check_class_definition_errors) self._portable_serializer = PortableSerializer( self._portable_context, config.portable_factories) self._compact_stream_serializer = CompactStreamSerializer( config.compact_serializers) # merge configured factories with built in ones factories = self._get_builtin_identified_factories() factories.update(config.data_serializable_factories) self._data_serializer = IdentifiedDataSerializer(factories) # Register Global Serializer self._global_serializer = config.global_serializer( ) if config.global_serializer else None self._null_serializer = NoneSerializer() self._python_serializer = PythonObjectSerializer() self._registry = SerializerRegistry( config, self._portable_serializer, self._data_serializer, self._compact_stream_serializer, self._null_serializer, self._python_serializer, self._global_serializer, ) self._register_constant_serializers() # Register Custom Serializers for _type, custom_serializer in config.custom_serializers.items(): self._registry.safe_register_serializer(custom_serializer(), _type)