NamenodeProtocol.proto 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 throughout HDFS -- i.e.
  19. // by the client, server, and data transfer protocols.
  20. option java_package = "org.apache.hadoop.hdfs.protocol.proto";
  21. option java_outer_classname = "NamenodeProtocolProtos";
  22. option java_generic_services = true;
  23. option java_generate_equals_and_hash = true;
  24. import "hdfs.proto";
  25. /**
  26. * Get list of blocks for a given datanode with the total length
  27. * of adding up to given size
  28. * datanode - Datanode ID to get list of block from
  29. * size - size to which the block lengths must add up to
  30. */
  31. message GetBlocksRequestProto {
  32. required DatanodeIDProto datanode = 1; // Datanode ID
  33. required uint64 size = 2; // Size in bytes
  34. }
  35. /**
  36. * blocks - List of returned blocks
  37. */
  38. message GetBlocksResponseProto {
  39. required BlockWithLocationsProto blocks = 1; // List of blocks
  40. }
  41. /**
  42. * void request
  43. */
  44. message GetBlockKeysRequestProto {
  45. }
  46. /**
  47. * keys - Information about block keys at the active namenode
  48. */
  49. message GetBlockKeysResponseProto {
  50. required ExportedBlockKeysProto keys = 1;
  51. }
  52. /**
  53. * void request
  54. */
  55. message GetTransactionIdRequestProto {
  56. }
  57. /**
  58. * txId - Transaction ID of the most recently persisted edit log record
  59. */
  60. message GetTransactionIdResponseProto {
  61. required uint64 txId = 1; // Transaction ID
  62. }
  63. /**
  64. * void request
  65. */
  66. message RollEditLogRequestProto {
  67. }
  68. /**
  69. * signature - A unique token to identify checkpoint transaction
  70. */
  71. message RollEditLogResponseProto {
  72. required CheckpointSignatureProto signature = 1;
  73. }
  74. /**
  75. * registartion - Namenode reporting the error
  76. * errorCode - error code indicating the error
  77. * msg - Free text description of the error
  78. */
  79. message ErrorReportRequestProto {
  80. required NamenodeRegistrationProto registartion = 1; // Registartion info
  81. required uint32 errorCode = 2; // Error code
  82. required string msg = 3; // Error message
  83. }
  84. /**
  85. * void response
  86. */
  87. message ErrorReportResponseProto {
  88. }
  89. /**
  90. * registration - Information of the namenode registering with primary namenode
  91. */
  92. message RegisterRequestProto {
  93. required NamenodeRegistrationProto registration = 1; // Registration info
  94. }
  95. /**
  96. * registration - Updated registration information of the newly registered
  97. * datanode.
  98. */
  99. message RegisterResponseProto {
  100. required NamenodeRegistrationProto registration = 1; // Registration info
  101. }
  102. /**
  103. * Start checkpoint request
  104. * registration - Namenode that is starting the checkpoint
  105. */
  106. message StartCheckpointRequestProto {
  107. required NamenodeRegistrationProto registration = 1; // Registration info
  108. }
  109. /**
  110. * command - Command returned by the active namenode to be
  111. * be handled by the caller.
  112. */
  113. message StartCheckpointResponseProto {
  114. required NamenodeCommandProto command = 1;
  115. }
  116. /**
  117. * End or finalize the previously started checkpoint
  118. * registration - Namenode that is ending the checkpoint
  119. * signature - unique token to identify checkpoint transaction,
  120. * that was received when checkpoint was started.
  121. */
  122. message EndCheckpointRequestProto {
  123. required NamenodeRegistrationProto registration = 1; // Registration info
  124. required CheckpointSignatureProto signature = 2;
  125. }
  126. /**
  127. * void response
  128. */
  129. message EndCheckpointResponseProto {
  130. }
  131. /**
  132. * sinceTxId - return the editlog information for transactions >= sinceTxId
  133. */
  134. message GetEditLogManifestRequestProto {
  135. required uint64 sinceTxId = 1; // Transaction ID
  136. }
  137. /**
  138. * manifest - Enumeration of editlogs from namenode for
  139. * logs >= sinceTxId in the request
  140. */
  141. message GetEditLogManifestResponseProto {
  142. required RemoteEditLogManifestProto manifest = 1;
  143. }
  144. /**
  145. * Protocol used by the sub-ordinate namenode to send requests
  146. * the active/primary namenode.
  147. *
  148. * See the request and response for details of rpc call.
  149. */
  150. service NamenodeProtocolService {
  151. /**
  152. * Get list of blocks for a given datanode with length
  153. * of blocks adding up to given size.
  154. */
  155. rpc getBlocks(GetBlocksRequestProto) returns(GetBlocksResponseProto);
  156. /**
  157. * Get the current block keys
  158. */
  159. rpc getBlockKeys(GetBlockKeysRequestProto) returns(GetBlockKeysResponseProto);
  160. /**
  161. * Get the transaction ID of the most recently persisted editlog record
  162. */
  163. rpc getTransationId(GetTransactionIdRequestProto)
  164. returns(GetTransactionIdResponseProto);
  165. /**
  166. * Close the current editlog and open a new one for checkpointing purposes
  167. */
  168. rpc rollEditLog(RollEditLogRequestProto) returns(RollEditLogResponseProto);
  169. /**
  170. * Report from a sub-ordinate namenode of an error to the active namenode.
  171. * Active namenode may decide to unregister the reporting namenode
  172. * depending on the error.
  173. */
  174. rpc errorReport(ErrorReportRequestProto) returns(ErrorReportResponseProto);
  175. /**
  176. * Request to register a sub-ordinate namenode
  177. */
  178. rpc register(RegisterRequestProto) returns(RegisterResponseProto);
  179. /**
  180. * Request to start a checkpoint.
  181. */
  182. rpc startCheckpoint(StartCheckpointRequestProto)
  183. returns(StartCheckpointResponseProto);
  184. /**
  185. * End of finalize the previously started checkpoint
  186. */
  187. rpc endCheckpoint(EndCheckpointRequestProto)
  188. returns(EndCheckpointResponseProto);
  189. /**
  190. * Get editlog manifests from the active namenode for all the editlogs
  191. */
  192. rpc getEditLogManifest(GetEditLogManifestRequestProto)
  193. returns(GetEditLogManifestResponseProto);
  194. }