Beispiel #1
0
        /// <exception cref="System.IO.IOException"/>
        internal static Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot Read(DataInput
                                                                                      @in, FSImageFormat.Loader loader)
        {
            int   snapshotId = @in.ReadInt();
            INode root       = loader.LoadINodeWithLocalName(false, @in, false);

            return(new Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot(snapshotId, root
                                                                                .AsDirectory(), null));
        }
Beispiel #2
0
            /// <exception cref="System.IO.IOException"/>
            public virtual INodeReference.WithCount LoadINodeReferenceWithCount(bool isSnapshotINode
                                                                                , DataInput @in, FSImageFormat.Loader loader)
            {
                bool firstReferred = @in.ReadBoolean();

                INodeReference.WithCount withCount;
                if (firstReferred)
                {
                    INode referred = loader.LoadINodeWithLocalName(isSnapshotINode, @in, true);
                    withCount = new INodeReference.WithCount(null, referred);
                    referenceMap[withCount.GetId()] = withCount;
                }
                else
                {
                    long id = @in.ReadLong();
                    withCount = referenceMap[id];
                }
                return(withCount);
            }
Beispiel #3
0
        /// <summary>Load the deleted list from the fsimage.</summary>
        /// <param name="parent">The directory that the deleted list belongs to.</param>
        /// <param name="createdList">
        /// The created list associated with the deleted list in
        /// the same Diff.
        /// </param>
        /// <param name="in">
        /// The
        /// <see cref="System.IO.DataInput"/>
        /// to read.
        /// </param>
        /// <param name="loader">
        /// The
        /// <see cref="Loader"/>
        /// instance.
        /// </param>
        /// <returns>The deleted list.</returns>
        /// <exception cref="System.IO.IOException"/>
        private static IList <INode> LoadDeletedList(INodeDirectory parent, IList <INode> createdList
                                                     , DataInput @in, FSImageFormat.Loader loader)
        {
            int           deletedSize = @in.ReadInt();
            IList <INode> deletedList = new AList <INode>(deletedSize);

            for (int i = 0; i < deletedSize; i++)
            {
                INode deleted = loader.LoadINodeWithLocalName(true, @in, true);
                deletedList.AddItem(deleted);
                // set parent: the parent field of an INode in the deleted list is not
                // useful, but set the parent here to be consistent with the original
                // fsdir tree.
                deleted.SetParent(parent);
                if (deleted.IsFile())
                {
                    loader.UpdateBlocksMap(deleted.AsFile());
                }
            }
            return(deletedList);
        }