fsimage.proto 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. option java_package = "org.apache.hadoop.hdfs.server.namenode";
  19. option java_outer_classname = "FsImageProto";
  20. package hadoop.hdfs.fsimage;
  21. import "hdfs.proto";
  22. /**
  23. * This file defines the on-disk layout of the file system image. The
  24. * layout is defined by the following EBNF grammar, in which angle
  25. * brackets mark protobuf definitions. (e.g., <FileSummary>)
  26. *
  27. * FILE := MAGIC SECTION* <FileSummary> FileSummaryLength
  28. * MAGIC := 'HDFSIMG1'
  29. * SECTION := <NameSystemSection> | ...
  30. * FileSummaryLength := 4 byte int
  31. *
  32. * Some notes:
  33. *
  34. * The codec field in FileSummary describes the compression codec used
  35. * for all sections. The fileheader is always uncompressed.
  36. *
  37. * All protobuf messages are serialized in delimited form, which means
  38. * that there always will be an integer indicates the size of the
  39. * protobuf message.
  40. *
  41. */
  42. message FileSummary {
  43. // The version of the above EBNF grammars.
  44. required uint32 ondiskVersion = 1;
  45. // layoutVersion describes which features are available in the
  46. // FSImage.
  47. required uint32 layoutVersion = 2;
  48. optional string codec = 3;
  49. // index for each section
  50. message Section {
  51. optional string name = 1;
  52. optional uint64 length = 2;
  53. optional uint64 offset = 3;
  54. }
  55. repeated Section sections = 4;
  56. }
  57. /**
  58. * Name: NS_INFO
  59. */
  60. message NameSystemSection {
  61. optional uint32 namespaceId = 1;
  62. optional uint64 genstampV1 = 2;
  63. optional uint64 genstampV2 = 3;
  64. optional uint64 genstampV1Limit = 4;
  65. optional uint64 lastAllocatedBlockId = 5;
  66. optional uint64 transactionId = 6;
  67. }
  68. /**
  69. * Name: INODE
  70. */
  71. message INodeSection {
  72. message Permission {
  73. optional string user = 1;
  74. optional string group = 2;
  75. optional uint32 permission = 3;
  76. }
  77. /**
  78. * under-construction feature for INodeFile
  79. */
  80. message FileUnderConstructionFeature {
  81. optional string clientName = 1;
  82. optional string clientMachine = 2;
  83. }
  84. message INodeFile {
  85. optional uint32 replication = 1;
  86. optional uint64 modificationTime = 2;
  87. optional uint64 accessTime = 3;
  88. optional uint64 preferredBlockSize = 4;
  89. optional Permission permission = 5;
  90. repeated BlockProto blocks = 6;
  91. optional FileUnderConstructionFeature fileUC = 7;
  92. }
  93. message INodeDirectory {
  94. optional uint64 modificationTime = 1;
  95. // namespace quota
  96. optional uint64 nsQuota = 2;
  97. // diskspace quota
  98. optional uint64 dsQuota = 3;
  99. optional Permission permission = 4;
  100. }
  101. message INodeSymlink {
  102. optional Permission permission = 1;
  103. optional bytes target = 2;
  104. }
  105. message INode {
  106. enum Type {
  107. FILE = 1;
  108. DIRECTORY = 2;
  109. SYMLINK = 3;
  110. };
  111. required Type type = 1;
  112. required uint64 id = 2;
  113. optional bytes name = 3;
  114. optional INodeFile file = 4;
  115. optional INodeDirectory directory = 5;
  116. optional INodeSymlink symlink = 6;
  117. }
  118. optional uint64 lastInodeId = 1;
  119. optional uint64 numInodes = 2;
  120. // repeated INodes..
  121. }
  122. /**
  123. * This section records information about under-construction files for
  124. * reconstructing the lease map.
  125. * NAME: FILES_UNDERCONSTRUCTION
  126. */
  127. message FilesUnderConstructionSection {
  128. message FileUnderConstructionEntry {
  129. optional uint64 inodeId = 1;
  130. optional string fullPath = 2;
  131. }
  132. // repeated FileUnderConstructionEntry...
  133. }
  134. /**
  135. * This section records the children of each directories
  136. * NAME: INODE_DIR
  137. */
  138. message INodeDirectorySection {
  139. message DirEntry {
  140. optional uint64 parent = 1;
  141. repeated uint64 children = 2;
  142. }
  143. // repeated DirEntry, ended at the boundary of the section.
  144. }