/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ option java_package = "org.apache.hadoop.hdfs.server.namenode"; option java_outer_classname = "FsImageProto"; package hadoop.hdfs.fsimage; import "hdfs.proto"; /** * This file defines the on-disk layout of the file system image. The * layout is defined by the following EBNF grammar, in which angle * brackets mark protobuf definitions. (e.g., ) * * FILE := MAGIC SECTION* FileSummaryLength * MAGIC := 'HDFSIMG1' * SECTION := | ... * FileSummaryLength := 4 byte int * * Some notes: * * The codec field in FileSummary describes the compression codec used * for all sections. The fileheader is always uncompressed. * * All protobuf messages are serialized in delimited form, which means * that there always will be an integer indicates the size of the * protobuf message. * */ message FileSummary { // The version of the above EBNF grammars. required uint32 ondiskVersion = 1; // layoutVersion describes which features are available in the // FSImage. required uint32 layoutVersion = 2; optional string codec = 3; // index for each section message Section { optional string name = 1; optional uint64 length = 2; optional uint64 offset = 3; } repeated Section sections = 4; } /** * Name: NS_INFO */ message NameSystemSection { optional uint32 namespaceId = 1; optional uint64 genstampV1 = 2; optional uint64 genstampV2 = 3; optional uint64 genstampV1Limit = 4; optional uint64 lastAllocatedBlockId = 5; optional uint64 transactionId = 6; } /** * Name: INODE */ message INodeSection { message Permission { optional string user = 1; optional string group = 2; optional uint32 permission = 3; } /** * under-construction feature for INodeFile */ message FileUnderConstructionFeature { optional string clientName = 1; optional string clientMachine = 2; } message INodeFile { optional uint32 replication = 1; optional uint64 modificationTime = 2; optional uint64 accessTime = 3; optional uint64 preferredBlockSize = 4; optional Permission permission = 5; repeated BlockProto blocks = 6; optional FileUnderConstructionFeature fileUC = 7; } message INodeDirectory { optional uint64 modificationTime = 1; // namespace quota optional uint64 nsQuota = 2; // diskspace quota optional uint64 dsQuota = 3; optional Permission permission = 4; } message INodeSymlink { optional Permission permission = 1; optional bytes target = 2; } message INode { enum Type { FILE = 1; DIRECTORY = 2; SYMLINK = 3; }; required Type type = 1; required uint64 id = 2; optional bytes name = 3; optional INodeFile file = 4; optional INodeDirectory directory = 5; optional INodeSymlink symlink = 6; } optional uint64 lastInodeId = 1; optional uint64 numInodes = 2; // repeated INodes.. } /** * This section records information about under-construction files for * reconstructing the lease map. * NAME: FILES_UNDERCONSTRUCTION */ message FilesUnderConstructionSection { message FileUnderConstructionEntry { optional uint64 inodeId = 1; optional string fullPath = 2; } // repeated FileUnderConstructionEntry... } /** * This section records the children of each directories * NAME: INODE_DIR */ message INodeDirectorySection { message DirEntry { optional uint64 parent = 1; repeated uint64 children = 2; } // repeated DirEntry, ended at the boundary of the section. }