Skip to main content

Module registry

Module registry 

Source
Expand description

Registries for custom data: JSON (de)serialization and Arrow encode/decode.

Mirrors Python’s register_serializable_type and register_arrow in custom.py. The registry only stores type name -> callbacks for lookup; each type provides its own deserialize/encode/decode via the trait or registration.

Functions§

decode_custom_from_arrow
Decodes a RecordBatch into Vec<Data> using the registered decoder.
deserialize_custom_from_json
Looks up and runs the JSON deserializer for the given type name. Returns None if the type is not registered.
encode_custom_to_arrow
Encodes a slice of custom data trait objects to a RecordBatch using the registered encoder.
ensure_arrow_registered
Registers Arrow schema, encoder, and decoder for the given custom data type name if not already registered. If the type is already registered, returns Ok(()) without overwriting (idempotent). Use this where repeated registration can occur (e.g. module init).
ensure_json_deserializer_registered
Registers a JSON deserializer for the given custom data type name if not already registered. If the type is already registered, returns Ok(()) without overwriting (idempotent). Use this where repeated registration can occur (e.g. module init).
ensure_py_extractor_registered
Registers a PyExtractor for the given custom data type name if not already registered. If the type is already registered, returns Ok(()) without overwriting (idempotent). Use this where repeated registration can occur (e.g. module init).
ensure_rust_extractor_factory_registered
Registers a factory that produces a PyExtractor for the given type name if not already registered. If the type is already registered, returns Ok(()) without overwriting (idempotent). Use this where repeated registration can occur (e.g. module load).
ensure_rust_extractor_registered
Registers a Rust custom data type for Python extraction if not already registered. If the type is already registered, returns Ok(()) without overwriting (idempotent). Use this where repeated registration can occur (e.g. module load).
get_arrow_schema
Returns the Arrow schema for the given custom type name, if registered.
get_rust_extractor
Calls the registered factory for the given type name and returns the extractor, if any.
register_arrow
Registers Arrow schema, encoder, and decoder for the given custom data type name.
register_json_deserializer
Registers a JSON deserializer for the given custom data type name. When Data::deserialize sees this type name, it will call this function.
register_py_extractor
Registers a PyExtractor for the given custom data type name. Used by CustomData constructor to convert Python objects to Arc<dyn CustomDataTrait>.
register_rust_extractor
Registers a Rust custom data type for Python extraction. Call once per type at module load (e.g. in the persistence PyO3 module). Uses register_rust_extractor_factory with a factory that builds the extractor for T.
register_rust_extractor_factory
Registers a factory that produces a PyExtractor for the given type name. Crates (e.g. persistence) call this at load time for each Rust custom data type. When register_custom_data_class(cls) is called with that type’s class, the factory is invoked and the extractor is registered in the main PyExtractor registry.
try_extract_from_py
Tries to extract Arc<dyn CustomDataTrait> from a Python object using the registered extractor. Returns None if no extractor is registered or extraction fails.

Type Aliases§

ArrowDecoder
ArrowEncoder
JsonDeserializer
PyExtractor