ibmfl.message
JSON Serializer
JSON based serialization
-
class
ibmfl.message.json_serializer.
JSONSerializer
[source]
Class for JSON Serializer
-
deserialize
(serialized_byte_stream)[source]
Deserialize a byte stream to a message
- Parameters
serialized_byte_stream (b[]) – byte stream
- Returns
deserialized message
- Return type
Message
-
serialize
(msg)[source]
Serialize a message using JSON
- Parameters
msg (Message) – message to serialize
- Returns
serialize byte stream
- Return type
b[]
Message
The Message class is the essential information passing object,
it contains information about the data sent from a node,
the id_request, and the rank associated with the node in the network
-
class
ibmfl.message.message.
Message
(message_type=None, id_request=None, data=None, sender_info=None)[source]
Class to create message for communication between party and aggregator
-
add_sender_info
(info)[source]
Information related to source who is sending/initiating this
message
- Parameters
info (dict) – Sender information
-
get_data
()[source]
Get actual data from the message
- Param
None
- Returns
data
- Return type
bytes
Get header information for the message
- Param
None
- Returns
information about rank, id_request, and message_type
- Return type
dict
-
get_sender_info
()[source]
Information related to source who sent this message
- Returns
info. Sender information
- Return type
dict
-
set_data
(data)[source]
set data into the message
- Parameters
data (dict) –
update message information using contents in header
- Parameters
header (dict) – dictionary with message information
Message Type
An enumeration class for the message type field which describe what
kind of data is being sent inside the Message
-
class
ibmfl.message.message_type.
MessageType
[source]
Message types for communication between party and aggregator
Pickle Serializatiom
Pickle based serialization
-
class
ibmfl.message.pickle_serializer.
PickleSerializer
[source]
Class for Pickle based serialization
-
deserialize
(serialized_byte_stream)[source]
Deserialize a byte stream to a message
- Parameters
serialized_byte_stream (b[]) – byte stream
- Returns
deserialized message
- Return type
Message
-
serialize
(msg)[source]
Serialize a message using pickle
- Parameters
msg (Message) – message to serialize
- Returns
serialize byte stream
- Return type
b[]
Abstract Serializer
-
class
ibmfl.message.serializer.
Serializer
[source]
Abstract class for Serializer
-
abstract
deserialize
(serialized_byte_stream)[source]
Deserialize a byte stream to a message
- Parameters
serialized_byte_stream (b[]) – byte stream
- Returns
deserialized message
- Return type
Message
-
abstract
serialize
(msg)[source]
Serialize a message
- Parameters
msg (Message) – message to serialize
- Returns
serialized byte stream
- Return type
b[]
Serialization Factory
Serialization factory provides a way to create a serializer
and deserializer to convert byte streams to a message and
vice versa
-
class
ibmfl.message.serializer_factory.
SerializerFactory
(serializer_type)[source]
Class for a factory to serialize and deserialize
-
build
()[source]
Returns a serializer
- Param
None
- Returns
serializer
- Return type
Serializer
Serializer Types
-
class
ibmfl.message.serializer_types.
SerializerTypes
[source]
Types of supported Serializers