hdfs.proto 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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; // block len does not belong in ebid - here for historical reasons
  31. }
  32. /**
  33. * Block Token
  34. */
  35. message BlockTokenIdentifierProto {
  36. required bytes identifier = 1;
  37. required bytes password = 2;
  38. required string kind = 3;
  39. required string service = 4;
  40. }
  41. /**
  42. * Identifies a Datanode
  43. */
  44. message DatanodeIDProto {
  45. required string name = 1; // hostname:portNumber
  46. required string storageID = 2; // Unique storage id
  47. required uint32 infoPort = 3; // the port where the infoserver is running
  48. required uint32 ipcPort = 4; // the port where the ipc Server is running
  49. }
  50. /**
  51. * The status of a Datanode
  52. */
  53. message DatanodeInfoProto {
  54. required DatanodeIDProto id = 1;
  55. optional uint64 capacity = 2;
  56. optional uint64 dfsUsed = 3;
  57. optional uint64 remaining = 4;
  58. optional uint64 blockPoolUsed = 5;
  59. optional uint64 lastUpdate = 6;
  60. optional uint32 xceiverCount = 7;
  61. optional string location = 8;
  62. optional string hostName = 9;
  63. enum AdminState {
  64. NORMAL = 0;
  65. DECOMMISSION_INPROGRESS = 1;
  66. DECOMMISSIONED = 2;
  67. }
  68. optional AdminState adminState = 10;
  69. }
  70. /**
  71. * Summary of a file or directory
  72. */
  73. message ContentSummaryProto {
  74. required uint64 length = 1;
  75. required uint64 fileCount = 2;
  76. required uint64 directoryCount = 3;
  77. required uint64 quota = 4;
  78. required uint64 spaceConsumed = 5;
  79. required uint64 spaceQuota = 6;
  80. }
  81. /**
  82. * Contains a list of paths corresponding to corrupt files and a cookie
  83. * used for iterative calls to NameNode.listCorruptFileBlocks.
  84. *
  85. */
  86. message CorruptFileBlocksProto {
  87. repeated string files = 1;
  88. required string cookie = 2;
  89. }
  90. /**
  91. * File or Directory permision - same spec as posix
  92. */
  93. message FsPermissionProto {
  94. required uint32 perm = 1; // Actually a short - only 16bits used
  95. }
  96. /**
  97. * A LocatedBlock gives information about a block and its location.
  98. */
  99. message LocatedBlockProto {
  100. required ExtendedBlockProto b = 1;
  101. required uint64 offset = 2; // offset of first byte of block in the file
  102. repeated DatanodeInfoProto locs = 3; // Locations ordered by proximity to client ip
  103. required bool corrupt = 4; // true if all replicas of a block are corrupt, else false
  104. // If block has few corrupt replicas, they are filtered and
  105. // their locations are not part of this object
  106. required BlockTokenIdentifierProto blockToken = 5;
  107. }
  108. /**
  109. * A set of file blocks and their locations.
  110. */
  111. message LocatedBlocksProto {
  112. required uint64 fileLength = 1;
  113. repeated LocatedBlockProto blocks = 2;
  114. required bool underConstruction = 3;
  115. optional LocatedBlockProto lastBlock = 4;
  116. required bool isLastBlockComplete = 5;
  117. }
  118. /**
  119. * Status of a file, directory or symlink
  120. * Optionally includes a file's block locations if requested by client on the rpc call.
  121. */
  122. message HdfsFileStatusProto {
  123. enum FileType {
  124. IS_DIR = 1;
  125. IS_FILE = 2;
  126. IS_SYMLINK = 3;
  127. }
  128. required FileType fileType = 1;
  129. required bytes path = 2; // local name of inode encoded java UTF8
  130. required uint64 length = 3;
  131. required FsPermissionProto permission = 4;
  132. required string owner = 5;
  133. required string group = 6;
  134. required uint64 modification_time = 7;
  135. required uint64 access_time = 8;
  136. //
  137. // Optional fields for symlink
  138. optional bytes symlink = 9; // if symlink, target encoded java UTF8
  139. //
  140. // Optional fields for file
  141. optional uint32 block_replication = 10; // Actually a short - only 16bits used
  142. optional uint64 blocksize = 11;
  143. optional LocatedBlocksProto locations = 12; // suppled only if asked by client
  144. }
  145. /**
  146. * HDFS Server Defaults
  147. */
  148. message FsServerDefaultsProto {
  149. required uint64 blockSize = 1;
  150. required uint32 bytesPerChecksum = 2;
  151. required uint32 writePacketSize = 3;
  152. required uint32 replication = 4; // Actually a short - only 16bits used
  153. required uint32 fileBufferSize = 5;
  154. }
  155. /**
  156. * Directory listing
  157. */
  158. message DirectoryListingProto {
  159. repeated HdfsFileStatusProto partialListing = 1;
  160. required uint32 remainingEntries = 2;
  161. }
  162. /**
  163. * Status of current cluster upgrade from one version to another
  164. */
  165. message UpgradeStatusReportProto {
  166. required uint32 version = 1;;
  167. required uint32 upgradeStatus = 2; // Between 0 and 100 indicating the % complete
  168. }