hdfs.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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 = "HdfsProtos";
  22. option java_generate_equals_and_hash = true;
  23. /**
  24. * Extended block idenfies a block
  25. */
  26. message ExtendedBlockProto {
  27. required string poolId = 1; // Block pool id - gloablly unique across clusters
  28. required uint64 blockId = 2; // the local id within a pool
  29. required uint64 generationStamp = 3;
  30. optional uint64 numBytes = 4 [default = 0]; // len does not belong in ebid
  31. // here for historical reasons
  32. }
  33. /**
  34. * Block Token
  35. */
  36. message BlockTokenIdentifierProto {
  37. required bytes identifier = 1;
  38. required bytes password = 2;
  39. required string kind = 3;
  40. required string service = 4;
  41. }
  42. /**
  43. * Identifies a Datanode
  44. */
  45. message DatanodeIDProto {
  46. required string ipAddr = 1; // IP address
  47. required string hostName = 2; // hostname
  48. required string storageID = 3; // unique storage id
  49. required uint32 xferPort = 4; // data streaming port
  50. required uint32 infoPort = 5; // info server port
  51. required uint32 ipcPort = 6; // ipc server port
  52. }
  53. /**
  54. * DatanodeInfo array
  55. */
  56. message DatanodeInfosProto {
  57. repeated DatanodeInfoProto datanodes = 1;
  58. }
  59. /**
  60. * The status of a Datanode
  61. */
  62. message DatanodeInfoProto {
  63. required DatanodeIDProto id = 1;
  64. optional uint64 capacity = 2 [default = 0];
  65. optional uint64 dfsUsed = 3 [default = 0];
  66. optional uint64 remaining = 4 [default = 0];
  67. optional uint64 blockPoolUsed = 5 [default = 0];
  68. optional uint64 lastUpdate = 6 [default = 0];
  69. optional uint32 xceiverCount = 7 [default = 0];
  70. optional string location = 8;
  71. enum AdminState {
  72. NORMAL = 0;
  73. DECOMMISSION_INPROGRESS = 1;
  74. DECOMMISSIONED = 2;
  75. }
  76. optional AdminState adminState = 10 [default = NORMAL];
  77. }
  78. /**
  79. * Summary of a file or directory
  80. */
  81. message ContentSummaryProto {
  82. required uint64 length = 1;
  83. required uint64 fileCount = 2;
  84. required uint64 directoryCount = 3;
  85. required uint64 quota = 4;
  86. required uint64 spaceConsumed = 5;
  87. required uint64 spaceQuota = 6;
  88. }
  89. /**
  90. * Contains a list of paths corresponding to corrupt files and a cookie
  91. * used for iterative calls to NameNode.listCorruptFileBlocks.
  92. *
  93. */
  94. message CorruptFileBlocksProto {
  95. repeated string files = 1;
  96. required string cookie = 2;
  97. }
  98. /**
  99. * File or Directory permision - same spec as posix
  100. */
  101. message FsPermissionProto {
  102. required uint32 perm = 1; // Actually a short - only 16bits used
  103. }
  104. /**
  105. * A LocatedBlock gives information about a block and its location.
  106. */
  107. message LocatedBlockProto {
  108. required ExtendedBlockProto b = 1;
  109. required uint64 offset = 2; // offset of first byte of block in the file
  110. repeated DatanodeInfoProto locs = 3; // Locations ordered by proximity to client ip
  111. required bool corrupt = 4; // true if all replicas of a block are corrupt, else false
  112. // If block has few corrupt replicas, they are filtered and
  113. // their locations are not part of this object
  114. required BlockTokenIdentifierProto blockToken = 5;
  115. }
  116. /**
  117. * A set of file blocks and their locations.
  118. */
  119. message LocatedBlocksProto {
  120. required uint64 fileLength = 1;
  121. repeated LocatedBlockProto blocks = 2;
  122. required bool underConstruction = 3;
  123. optional LocatedBlockProto lastBlock = 4;
  124. required bool isLastBlockComplete = 5;
  125. }
  126. /**
  127. * Status of a file, directory or symlink
  128. * Optionally includes a file's block locations if requested by client on the rpc call.
  129. */
  130. message HdfsFileStatusProto {
  131. enum FileType {
  132. IS_DIR = 1;
  133. IS_FILE = 2;
  134. IS_SYMLINK = 3;
  135. }
  136. required FileType fileType = 1;
  137. required bytes path = 2; // local name of inode encoded java UTF8
  138. required uint64 length = 3;
  139. required FsPermissionProto permission = 4;
  140. required string owner = 5;
  141. required string group = 6;
  142. required uint64 modification_time = 7;
  143. required uint64 access_time = 8;
  144. // Optional fields for symlink
  145. optional bytes symlink = 9; // if symlink, target encoded java UTF8
  146. // Optional fields for file
  147. optional uint32 block_replication = 10 [default = 0]; // only 16bits used
  148. optional uint64 blocksize = 11 [default = 0];
  149. optional LocatedBlocksProto locations = 12; // suppled only if asked by client
  150. }
  151. /**
  152. * HDFS Server Defaults
  153. */
  154. message FsServerDefaultsProto {
  155. required uint64 blockSize = 1;
  156. required uint32 bytesPerChecksum = 2;
  157. required uint32 writePacketSize = 3;
  158. required uint32 replication = 4; // Actually a short - only 16 bits used
  159. required uint32 fileBufferSize = 5;
  160. }
  161. /**
  162. * Directory listing
  163. */
  164. message DirectoryListingProto {
  165. repeated HdfsFileStatusProto partialListing = 1;
  166. required uint32 remainingEntries = 2;
  167. }
  168. /**
  169. * Status of current cluster upgrade from one version to another
  170. */
  171. message UpgradeStatusReportProto {
  172. required uint32 version = 1;;
  173. required uint32 upgradeStatus = 2; // % completed in range 0 & 100
  174. required bool finalized = 3;
  175. }
  176. /**
  177. * Common node information shared by all the nodes in the cluster
  178. */
  179. message StorageInfoProto {
  180. required uint32 layoutVersion = 1; // Layout version of the file system
  181. required uint32 namespceID = 2; // File system namespace ID
  182. required string clusterID = 3; // ID of the cluster
  183. required uint64 cTime = 4; // File system creation time
  184. }
  185. /**
  186. * Information sent by a namenode to identify itself to the primary namenode.
  187. */
  188. message NamenodeRegistrationProto {
  189. required string rpcAddress = 1; // host:port of the namenode RPC address
  190. required string httpAddress = 2; // host:port of the namenode http server
  191. enum NamenodeRoleProto {
  192. NAMENODE = 1;
  193. BACKUP = 2;
  194. CHECKPOINT = 3;
  195. }
  196. required StorageInfoProto storageInfo = 3; // Node information
  197. optional NamenodeRoleProto role = 4 [default = NAMENODE]; // Namenode role
  198. }
  199. /**
  200. * Unique signature to identify checkpoint transactions.
  201. */
  202. message CheckpointSignatureProto {
  203. required string blockPoolId = 1;
  204. required uint64 mostRecentCheckpointTxId = 2;
  205. required uint64 curSegmentTxId = 3;
  206. required StorageInfoProto storageInfo = 4;
  207. }
  208. /**
  209. * Command sent from one namenode to another namenode.
  210. */
  211. message NamenodeCommandProto {
  212. enum Type {
  213. NamenodeCommand = 0; // Base command
  214. CheckPointCommand = 1; // Check point command
  215. }
  216. required uint32 action = 1;
  217. required Type type = 2;
  218. optional CheckpointCommandProto checkpointCmd = 3;
  219. }
  220. /**
  221. * Command returned from primary to checkpointing namenode.
  222. * This command has checkpoint signature that identifies
  223. * checkpoint transaction and is needed for further
  224. * communication related to checkpointing.
  225. */
  226. message CheckpointCommandProto {
  227. // Unique signature to identify checkpoint transation
  228. required CheckpointSignatureProto signature = 1;
  229. // If true, return transfer image to primary upon the completion of checkpoint
  230. required bool needToReturnImage = 2;
  231. }
  232. /**
  233. * Block information
  234. */
  235. message BlockProto {
  236. required uint64 blockId = 1;
  237. required uint64 genStamp = 2;
  238. optional uint64 numBytes = 3 [default = 0];
  239. }
  240. /**
  241. * Block and datanodes where is it located
  242. */
  243. message BlockWithLocationsProto {
  244. required BlockProto block = 1; // Block
  245. repeated string storageIDs = 2; // Datanodes with replicas of the block
  246. }
  247. /**
  248. * List of block with locations
  249. */
  250. message BlocksWithLocationsProto {
  251. repeated BlockWithLocationsProto blocks = 1;
  252. }
  253. /**
  254. * Editlog information with available transactions
  255. */
  256. message RemoteEditLogProto {
  257. required uint64 startTxId = 1; // Starting available edit log transaction
  258. required uint64 endTxId = 2; // Ending available edit log transaction
  259. }
  260. /**
  261. * Enumeration of editlogs available on a remote namenode
  262. */
  263. message RemoteEditLogManifestProto {
  264. repeated RemoteEditLogProto logs = 1;
  265. }
  266. /**
  267. * Namespace information that describes namespace on a namenode
  268. */
  269. message NamespaceInfoProto {
  270. required string buildVersion = 1; // Software revision version (e.g. an svn or git revision)
  271. required uint32 distUpgradeVersion = 2; // Distributed upgrade version
  272. required string blockPoolID = 3; // block pool used by the namespace
  273. required StorageInfoProto storageInfo = 4;// Node information
  274. required string softwareVersion = 5; // Software version number (e.g. 2.0.0)
  275. }
  276. /**
  277. * Block access token information
  278. */
  279. message BlockKeyProto {
  280. required uint32 keyId = 1; // Key identifier
  281. required uint64 expiryDate = 2; // Expiry time in milliseconds
  282. optional bytes keyBytes = 3; // Key secret
  283. }
  284. /**
  285. * Current key and set of block keys at the namenode.
  286. */
  287. message ExportedBlockKeysProto {
  288. required bool isBlockTokenEnabled = 1;
  289. required uint64 keyUpdateInterval = 2;
  290. required uint64 tokenLifeTime = 3;
  291. required BlockKeyProto currentKey = 4;
  292. repeated BlockKeyProto allKeys = 5;
  293. }
  294. /**
  295. * State of a block replica at a datanode
  296. */
  297. enum ReplicaStateProto {
  298. FINALIZED = 0; // State of a replica when it is not modified
  299. RBW = 1; // State of replica that is being written to
  300. RWR = 2; // State of replica that is waiting to be recovered
  301. RUR = 3; // State of replica that is under recovery
  302. TEMPORARY = 4; // State of replica that is created for replication
  303. }
  304. /**
  305. * Block that needs to be recovered with at a given location
  306. */
  307. message RecoveringBlockProto {
  308. required uint64 newGenStamp = 1; // New genstamp post recovery
  309. required LocatedBlockProto block = 2; // Block to be recovered
  310. }
  311. /**
  312. * void request
  313. */
  314. message VersionRequestProto {
  315. }
  316. /**
  317. * Version response from namenode.
  318. */
  319. message VersionResponseProto {
  320. required NamespaceInfoProto info = 1;
  321. }