datatransfer.proto 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. // This file contains protocol buffers that are used to transfer data
  19. // to and from the datanode, as well as between datanodes.
  20. option java_package = "org.apache.hadoop.hdfs.protocol.proto";
  21. option java_outer_classname = "DataTransferProtos";
  22. option java_generate_equals_and_hash = true;
  23. package hadoop.hdfs;
  24. import "Security.proto";
  25. import "hdfs.proto";
  26. message DataTransferEncryptorMessageProto {
  27. enum DataTransferEncryptorStatus {
  28. SUCCESS = 0;
  29. ERROR_UNKNOWN_KEY = 1;
  30. ERROR = 2;
  31. }
  32. required DataTransferEncryptorStatus status = 1;
  33. optional bytes payload = 2;
  34. optional string message = 3;
  35. }
  36. message BaseHeaderProto {
  37. required ExtendedBlockProto block = 1;
  38. optional hadoop.common.TokenProto token = 2;
  39. }
  40. message ClientOperationHeaderProto {
  41. required BaseHeaderProto baseHeader = 1;
  42. required string clientName = 2;
  43. }
  44. message OpReadBlockProto {
  45. required ClientOperationHeaderProto header = 1;
  46. required uint64 offset = 2;
  47. required uint64 len = 3;
  48. }
  49. message ChecksumProto {
  50. required ChecksumTypeProto type = 1;
  51. required uint32 bytesPerChecksum = 2;
  52. }
  53. message OpWriteBlockProto {
  54. required ClientOperationHeaderProto header = 1;
  55. repeated DatanodeInfoProto targets = 2;
  56. optional DatanodeInfoProto source = 3;
  57. enum BlockConstructionStage {
  58. PIPELINE_SETUP_APPEND = 0;
  59. // pipeline set up for failed PIPELINE_SETUP_APPEND recovery
  60. PIPELINE_SETUP_APPEND_RECOVERY = 1;
  61. // data streaming
  62. DATA_STREAMING = 2;
  63. // pipeline setup for failed data streaming recovery
  64. PIPELINE_SETUP_STREAMING_RECOVERY = 3;
  65. // close the block and pipeline
  66. PIPELINE_CLOSE = 4;
  67. // Recover a failed PIPELINE_CLOSE
  68. PIPELINE_CLOSE_RECOVERY = 5;
  69. // pipeline set up for block creation
  70. PIPELINE_SETUP_CREATE = 6;
  71. // transfer RBW for adding datanodes
  72. TRANSFER_RBW = 7;
  73. // transfer Finalized for adding datanodes
  74. TRANSFER_FINALIZED = 8;
  75. }
  76. required BlockConstructionStage stage = 4;
  77. required uint32 pipelineSize = 5;
  78. required uint64 minBytesRcvd = 6;
  79. required uint64 maxBytesRcvd = 7;
  80. required uint64 latestGenerationStamp = 8;
  81. /**
  82. * The requested checksum mechanism for this block write.
  83. */
  84. required ChecksumProto requestedChecksum = 9;
  85. }
  86. message OpTransferBlockProto {
  87. required ClientOperationHeaderProto header = 1;
  88. repeated DatanodeInfoProto targets = 2;
  89. }
  90. message OpReplaceBlockProto {
  91. required BaseHeaderProto header = 1;
  92. required string delHint = 2;
  93. required DatanodeInfoProto source = 3;
  94. }
  95. message OpCopyBlockProto {
  96. required BaseHeaderProto header = 1;
  97. }
  98. message OpBlockChecksumProto {
  99. required BaseHeaderProto header = 1;
  100. }
  101. message PacketHeaderProto {
  102. // All fields must be fixed-length!
  103. required sfixed64 offsetInBlock = 1;
  104. required sfixed64 seqno = 2;
  105. required bool lastPacketInBlock = 3;
  106. required sfixed32 dataLen = 4;
  107. optional bool syncBlock = 5 [default = false];
  108. }
  109. enum Status {
  110. SUCCESS = 0;
  111. ERROR = 1;
  112. ERROR_CHECKSUM = 2;
  113. ERROR_INVALID = 3;
  114. ERROR_EXISTS = 4;
  115. ERROR_ACCESS_TOKEN = 5;
  116. CHECKSUM_OK = 6;
  117. }
  118. message PipelineAckProto {
  119. required sint64 seqno = 1;
  120. repeated Status status = 2;
  121. optional uint64 downstreamAckTimeNanos = 3 [default = 0];
  122. }
  123. /**
  124. * Sent as part of the BlockOpResponseProto
  125. * for READ_BLOCK and COPY_BLOCK operations.
  126. */
  127. message ReadOpChecksumInfoProto {
  128. required ChecksumProto checksum = 1;
  129. /**
  130. * The offset into the block at which the first packet
  131. * will start. This is necessary since reads will align
  132. * backwards to a checksum chunk boundary.
  133. */
  134. required uint64 chunkOffset = 2;
  135. }
  136. message BlockOpResponseProto {
  137. required Status status = 1;
  138. optional string firstBadLink = 2;
  139. optional OpBlockChecksumResponseProto checksumResponse = 3;
  140. optional ReadOpChecksumInfoProto readOpChecksumInfo = 4;
  141. /** explanatory text which may be useful to log on the client side */
  142. optional string message = 5;
  143. }
  144. /**
  145. * Message sent from the client to the DN after reading the entire
  146. * read request.
  147. */
  148. message ClientReadStatusProto {
  149. required Status status = 1;
  150. }
  151. message DNTransferAckProto {
  152. required Status status = 1;
  153. }
  154. message OpBlockChecksumResponseProto {
  155. required uint32 bytesPerCrc = 1;
  156. required uint64 crcPerBlock = 2;
  157. required bytes md5 = 3;
  158. optional ChecksumTypeProto crcType = 4 [default = CHECKSUM_CRC32];
  159. }