datatransfer.proto 5.0 KB

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