/// <summary>Serialize the actual read result on the wire.</summary> /// <exception cref="System.IO.IOException"/> internal static void WriteReadResult(OutputStream @out, DataTransferProtos.Status statusCode) { ((DataTransferProtos.ClientReadStatusProto)DataTransferProtos.ClientReadStatusProto .NewBuilder().SetStatus(statusCode).Build()).WriteDelimitedTo(@out); @out.Flush(); }
public static int CombineHeader(PipelineAck.ECN ecn, DataTransferProtos.Status status ) { int header = 0; header = PipelineAck.StatusFormat.SetStatus(header, status); header = PipelineAck.StatusFormat.SetECN(header, ecn); return(header); }
/// <summary>Get the timeout to be used for transmitting the OOB type</summary> /// <returns>the timeout in milliseconds</returns> /// <exception cref="System.IO.IOException"/> public static long GetOOBTimeout(DataTransferProtos.Status status) { int index = status.GetNumber() - OobStart; if (index >= 0 && index < NumOobTypes) { return(OobTimeout[index]); } // Not an OOB. throw new IOException("Not an OOB status: " + status); }
/// <exception cref="System.IO.IOException"/> private void SendResponse(DataTransferProtos.Status status, string firstBadLink, string message, DataOutputStream @out) { DataTransferProtos.BlockOpResponseProto.Builder builder = DataTransferProtos.BlockOpResponseProto .NewBuilder().SetStatus(status); if (firstBadLink != null) { builder.SetFirstBadLink(firstBadLink); } if (message != null) { builder.SetMessage(message); } ((DataTransferProtos.BlockOpResponseProto)builder.Build()).WriteDelimitedTo(@out); }
// in will be closed when its Socket is closed. /// <summary> /// When the reader reaches end of the read, it sends a status response /// (e.g. /// </summary> /// <remarks> /// When the reader reaches end of the read, it sends a status response /// (e.g. CHECKSUM_OK) to the DN. Failure to do so could lead to the DN /// closing our connection (which we will re-open), but won't affect /// data correctness. /// </remarks> internal virtual void SendReadResult(DataTransferProtos.Status statusCode) { System.Diagnostics.Debug.Assert(!sentStatusCode, "already sent status code to " + peer); try { WriteReadResult(peer.GetOutputStream(), statusCode); sentStatusCode = true; } catch (IOException e) { // It's ok not to be able to send this. But something is probably wrong. Log.Info("Could not send read status (" + statusCode + ") to datanode " + peer.GetRemoteAddressString () + ": " + e.Message); } }
public static int SetStatus(int old, DataTransferProtos.Status status) { return((int)PipelineAck.StatusFormat.Status.Bits.Combine(status.GetNumber(), old)); }
public static int SetStatusForHeader(int old, DataTransferProtos.Status status) { return(PipelineAck.StatusFormat.SetStatus(old, status)); }
/// <summary>return true if it is the restart OOB status code</summary> public static bool IsRestartOOBStatus(DataTransferProtos.Status st) { return(st.Equals(DataTransferProtos.Status.OobRestart)); }