datatransfer.proto 5.0 KB

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