Exemple #1
0
        void ProcessStoreMessage()
        {
            RequestStoreMessage request = RequestStoreMessage.Deserialize(ProtocolParser.ReadBytes(input));
            ReplyStoreMessage   reply   = new ReplyStoreMessage();

            localRepo.StoreMessage(request.Prefix, ChunkHash.FromHashBytes(request.ChunkHash));
            ProtocolParser.WriteBytes(output, ReplyStoreMessage.SerializeToBytes(reply));
        }
Exemple #2
0
        public override void StoreMessage(string prefix, ChunkHash chunkHash)
        {
            RequestStoreMessage msg = new RequestStoreMessage();

            msg.Prefix    = prefix;
            msg.ChunkHash = chunkHash.bytes;
            SendMessage(msg);

            ReplyStoreMessage.Deserialize(ProtocolParser.ReadBytes(input));
        }
Exemple #3
0
 static byte[] GetMessageBytes(IPipeMessage message)
 {
     if (message is RequestCustomHash)
     {
         return(RequestCustomHash.SerializeToBytes((RequestCustomHash)message));
     }
     if (message is RequestMessageList)
     {
         return(RequestMessageList.SerializeToBytes((RequestMessageList)message));
     }
     if (message is RequestReadChunk)
     {
         return(RequestReadChunk.SerializeToBytes((RequestReadChunk)message));
     }
     if (message is RequestStoreMessage)
     {
         return(RequestStoreMessage.SerializeToBytes((RequestStoreMessage)message));
     }
     if (message is RequestWriteChunk)
     {
         return(RequestWriteChunk.SerializeToBytes((RequestWriteChunk)message));
     }
     throw new NotImplementedException();
 }