Jido. Signal. Serialization. Config
(Jido Signal v2.2.0)
View Source
Configuration management for serialization settings.
This module provides functions to get and set default serialization configuration for the Jido application.
Configuration Options
The following configuration keys are supported under the :jido application:
:default_serializer- The default serializer module to use (default: JsonSerializer):default_type_provider- The default type provider module to use (default: ModuleNameTypeProvider)
Example Configuration
# In your config.exs or runtime.exs
config :jido,
default_serializer: Jido.Signal.Serialization.ErlangTermSerializer,
default_type_provider: Jido.Signal.Serialization.ModuleNameTypeProviderRuntime Configuration
You can also change the configuration at runtime:
Jido.Signal.Serialization.Config.set_default_serializer(MyCustomSerializer)
Jido.Signal.Serialization.Config.set_default_type_provider(MyCustomTypeProvider)
Summary
Functions
Get all serialization configuration as a keyword list.
Get the configured default serializer.
Get the configured default type provider.
Get the configured maximum payload size in bytes.
Set the default serializer at runtime.
Set the default type provider at runtime.
Validate the current configuration.
Validate that the configured serializer implements the Serializer behaviour.
Validate that the configured type provider implements the TypeProvider behaviour.
Functions
@spec all() :: keyword()
Get all serialization configuration as a keyword list.
@spec default_serializer() :: module()
Get the configured default serializer.
@spec default_type_provider() :: module()
Get the configured default type provider.
@spec max_payload_bytes() :: non_neg_integer()
Get the configured maximum payload size in bytes.
Returns the maximum allowed payload size for deserialization. Defaults to 10MB.
Configuration
Configure in your application config:
config :jido, :max_payload_bytes, 5_000_000 # 5MBExamples
iex> Jido.Signal.Serialization.Config.max_payload_bytes()
10_000_000
@spec set_default_serializer(module()) :: :ok
Set the default serializer at runtime.
@spec set_default_type_provider(module()) :: :ok
Set the default type provider at runtime.
@spec validate() :: :ok | {:error, [String.t()]}
Validate the current configuration.
Validate that the configured serializer implements the Serializer behaviour.
Validate that the configured type provider implements the TypeProvider behaviour.