Beispiel #1
0
        void ProcessWriteChunk()
        {
            RequestWriteChunk request = RequestWriteChunk.Deserialize(ProtocolParser.ReadBytes(input));
            ReplyWriteChunk   reply   = new ReplyWriteChunk();
            Chunk             chunk   = new Chunk(request.ChunkData);

            localRepo.WriteChunk(chunk);

            ProtocolParser.WriteBytes(output, ReplyWriteChunk.SerializeToBytes(reply));
        }
Beispiel #2
0
        public override ChunkHash WriteChunk(Chunk chunk)
        {
            RequestWriteChunk msg = new RequestWriteChunk();

            msg.ChunkData = chunk.Data;
            SendMessage(msg);

            ReplyWriteChunk.Deserialize(ProtocolParser.ReadBytes(input));

            return(chunk.ChunkHash);
        }
Beispiel #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();
 }