hdfs.proto 11 KB

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