Apache REEF  0.16.0
Retainable Evaluator Execution Framework
Public Member Functions | List of all members
Org.Apache.REEF.Wake.Avro.ProtocolSerializer Class Reference

Given a namespace of Avro messages which represent a protocol, the ProtocolSerailizer class reflects all of the message classes and builds Avro seriailziers and deserializers. More...

Public Member Functions

 ProtocolSerializer (Assembly assembly, string messageNamespace)
 Register all of the protocol messages using reflection. More...
 
byte [] Write (object message, long sequence)
 Serialize the input message and return a byte array. More...
 
void Read< T > (byte[] data, IObserver< IMessageInstance< T >> observer)
 Read a message from the input byte array. More...
 

Detailed Description

Given a namespace of Avro messages which represent a protocol, the ProtocolSerailizer class reflects all of the message classes and builds Avro seriailziers and deserializers.

Avro messages are then serialized/deserilaized to and from byte[] arrays using the Read/Write methods. A transport such as a RemoteObserver using a ByteCodec can then be used to send and receive the serialized messages.

Constructor & Destructor Documentation

◆ ProtocolSerializer()

Org.Apache.REEF.Wake.Avro.ProtocolSerializer.ProtocolSerializer ( Assembly  assembly,
string  messageNamespace 
)
inline

Register all of the protocol messages using reflection.

Parameters
assemblyThe Assembly object which contains the namespace of the message classes.
messageNamespaceA string which contains the namespace the protocol messages.

Member Function Documentation

◆ Read< T >()

void Org.Apache.REEF.Wake.Avro.ProtocolSerializer.Read< T > ( byte []  data,
IObserver< IMessageInstance< T >>  observer 
)
inline

Read a message from the input byte array.

Parameters
dataByte array containing a header message and message to be deserialized.
observerAn object which implements the IObserver<> interface for the message being deserialized.

◆ Write()

byte [] Org.Apache.REEF.Wake.Avro.ProtocolSerializer.Write ( object  message,
long  sequence 
)
inline

Serialize the input message and return a byte array.

Parameters
messageAn object reference to the messeage to be serialized
sequenceA long which cotains the higher level protocols sequence number for the message.
Returns
A byte array containing the serialized header and message.

The documentation for this class was generated from the following file: