private static IPooledBuffer Serialize(IInvocationSendCompleted message, Nothing _) { using (var envelope = InvocationMessageEnvelope.Rent()) { var proto = InvocationSendCompletion.Rent(); envelope.SendCompletion = proto; return(envelope.Serialize()); } }
private static IPooledBuffer Serialize(IInvocationMessageReceived message, Nothing _) { using (var envelope = InvocationMessageEnvelope.Rent()) { var proto = InvocationMessageReceived.Rent(); envelope.Confirmation = proto; return(envelope.Serialize()); } }
private static IPooledBuffer Serialize(IInvocationMessageHeader message, Nothing _) { using (var envelope = InvocationMessageEnvelope.Rent()) { var proto = InvocationMessageHeader.Rent(); envelope.Message = proto; return(envelope.Serialize()); } }
public IInvocationMessage DeserializeInvocationMessage(IPooledBuffer message) { using (var envelope = InvocationMessageEnvelope.Rent()) { envelope.MergeFrom(message); switch (envelope.PayloadCase) { case InvocationMessageEnvelope.PayloadOneofCase.Message: return(_messageFactory.CreateInvocationMessageHeader()); case InvocationMessageEnvelope.PayloadOneofCase.Confirmation: return(_messageFactory.CreateInvocationMessageReceived()); case InvocationMessageEnvelope.PayloadOneofCase.SendCompletion: return(_messageFactory.CreateInvocationSendCompletion()); default: throw new InvalidOperationException($"Unexpected payload case: {envelope.PayloadCase}"); } } }