public override ChunkHash GetCustomHash(CustomID id) { string idPath = Path.Combine (idRoot, id.ToString () + ".id"); if (File.Exists (idPath) == false) return null; byte[] hash = File.ReadAllBytes (idPath); return ChunkHash.FromHashBytes (hash); }
public CustomID GetID(Chunk chunk) { using (MemoryStream ms = new MemoryStream()) { ms.Write(keyBuffer, 0, keyBuffer.Length); ProtocolParser.WriteBytes(ms, chunk.ClearHash.bytes); return(CustomID.FromBytes(Hash.ComputeHash(ms.ToArray()).bytes)); } }
public override ChunkHash GetCustomHash(CustomID id) { string idPath = Path.Combine(idRoot, id.ToString() + ".id"); if (File.Exists(idPath) == false) { return(null); } byte[] hash = File.ReadAllBytes(idPath); return(ChunkHash.FromHashBytes(hash)); }
public override ChunkHash GetCustomHash(CustomID customID) { RequestCustomHash msg = new RequestCustomHash(); msg.CustomID = customID.bytes; SendMessage(msg); byte[] rbytes = ProtocolParser.ReadBytes(input); //Console.WriteLine("Got reply " + rbytes.Length); ReplyCustomHash reply = ReplyCustomHash.Deserialize(rbytes); //Console.WriteLine("Got reply " + reply); return(ChunkHash.FromHashBytes(reply.ChunkHash)); }
void ProcessGetCustomHash() { RequestCustomHash request = RequestCustomHash.Deserialize(ProtocolParser.ReadBytes(input)); ReplyCustomHash reply = new ReplyCustomHash(); ChunkHash ch = localRepo.GetCustomHash(CustomID.FromBytes(request.CustomID)); if (ch == null) { reply.ChunkHash = null; } else { reply.ChunkHash = ch.bytes; } //Console.Error.WriteLine("PipeServer: Sending: " + reply); byte[] rbytes = ReplyCustomHash.SerializeToBytes(reply); //Console.Error.WriteLine("PipeServer: Sending: " + rbytes.Length + ", " + BitConverter.ToString(rbytes)); ProtocolParser.WriteBytes(output, rbytes); }
public override ChunkHash GetCustomHash(CustomID customID) { //foreach (Storage s in repos) throw new System.NotImplementedException(); }
public override ChunkHash GetCustomHash(CustomID customID) { return(backend.GetCustomHash(customID)); }