nvflare.fuel.utils.fobs.decomposer module

class Decomposer[source]

Bases: ABC

Abstract base class for decomposers.

Every class to be serialized by FOBS must register a decomposer which is a concrete subclass of this class.

abstract decompose(target: T) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

abstract recompose(data: Any) T[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

abstract static supported_type() Type[T][source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type