datatransfer.proto 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. optional bool sendChecksums = 4 [default = true];
  49. }
  50. message ChecksumProto {
  51. required ChecksumTypeProto type = 1;
  52. required uint32 bytesPerChecksum = 2;
  53. }
  54. message OpWriteBlockProto {
  55. required ClientOperationHeaderProto header = 1;
  56. repeated DatanodeInfoProto targets = 2;
  57. optional DatanodeInfoProto source = 3;
  58. enum BlockConstructionStage {
  59. PIPELINE_SETUP_APPEND = 0;
  60. // pipeline set up for failed PIPELINE_SETUP_APPEND recovery
  61. PIPELINE_SETUP_APPEND_RECOVERY = 1;
  62. // data streaming
  63. DATA_STREAMING = 2;
  64. // pipeline setup for failed data streaming recovery
  65. PIPELINE_SETUP_STREAMING_RECOVERY = 3;
  66. // close the block and pipeline
  67. PIPELINE_CLOSE = 4;
  68. // Recover a failed PIPELINE_CLOSE
  69. PIPELINE_CLOSE_RECOVERY = 5;
  70. // pipeline set up for block creation
  71. PIPELINE_SETUP_CREATE = 6;
  72. // transfer RBW for adding datanodes
  73. TRANSFER_RBW = 7;
  74. // transfer Finalized for adding datanodes
  75. TRANSFER_FINALIZED = 8;
  76. }
  77. required BlockConstructionStage stage = 4;
  78. required uint32 pipelineSize = 5;
  79. required uint64 minBytesRcvd = 6;
  80. required uint64 maxBytesRcvd = 7;
  81. required uint64 latestGenerationStamp = 8;
  82. /**
  83. * The requested checksum mechanism for this block write.
  84. */
  85. required ChecksumProto requestedChecksum = 9;
  86. }
  87. message OpTransferBlockProto {
  88. required ClientOperationHeaderProto header = 1;
  89. repeated DatanodeInfoProto targets = 2;
  90. }
  91. message OpReplaceBlockProto {
  92. required BaseHeaderProto header = 1;
  93. required string delHint = 2;
  94. required DatanodeInfoProto source = 3;
  95. }
  96. message OpCopyBlockProto {
  97. required BaseHeaderProto header = 1;
  98. }
  99. message OpBlockChecksumProto {
  100. required BaseHeaderProto header = 1;
  101. }
  102. message PacketHeaderProto {
  103. // All fields must be fixed-length!
  104. required sfixed64 offsetInBlock = 1;
  105. required sfixed64 seqno = 2;
  106. required bool lastPacketInBlock = 3;
  107. required sfixed32 dataLen = 4;
  108. optional bool syncBlock = 5 [default = false];
  109. }
  110. enum Status {
  111. SUCCESS = 0;
  112. ERROR = 1;
  113. ERROR_CHECKSUM = 2;
  114. ERROR_INVALID = 3;
  115. ERROR_EXISTS = 4;
  116. ERROR_ACCESS_TOKEN = 5;
  117. CHECKSUM_OK = 6;
  118. }
  119. message PipelineAckProto {
  120. required sint64 seqno = 1;
  121. repeated Status status = 2;
  122. optional uint64 downstreamAckTimeNanos = 3 [default = 0];
  123. }
  124. /**
  125. * Sent as part of the BlockOpResponseProto
  126. * for READ_BLOCK and COPY_BLOCK operations.
  127. */
  128. message ReadOpChecksumInfoProto {
  129. required ChecksumProto checksum = 1;
  130. /**
  131. * The offset into the block at which the first packet
  132. * will start. This is necessary since reads will align
  133. * backwards to a checksum chunk boundary.
  134. */
  135. required uint64 chunkOffset = 2;
  136. }
  137. message BlockOpResponseProto {
  138. required Status status = 1;
  139. optional string firstBadLink = 2;
  140. optional OpBlockChecksumResponseProto checksumResponse = 3;
  141. optional ReadOpChecksumInfoProto readOpChecksumInfo = 4;
  142. /** explanatory text which may be useful to log on the client side */
  143. optional string message = 5;
  144. }
  145. /**
  146. * Message sent from the client to the DN after reading the entire
  147. * read request.
  148. */
  149. message ClientReadStatusProto {
  150. required Status status = 1;
  151. }
  152. message DNTransferAckProto {
  153. required Status status = 1;
  154. }
  155. message OpBlockChecksumResponseProto {
  156. required uint32 bytesPerCrc = 1;
  157. required uint64 crcPerBlock = 2;
  158. required bytes md5 = 3;
  159. optional ChecksumTypeProto crcType = 4;
  160. }