org.apache.hadoop.hdfs.server.namenode.snapshot
Class SnapshotFSImageFormat

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotFSImageFormat

public class SnapshotFSImageFormat
extends Object

A helper class defining static methods for reading/writing snapshot related information from/to FSImage.


Nested Class Summary
static class SnapshotFSImageFormat.ReferenceMap
          A reference map for fsimage serialization.
 
Constructor Summary
SnapshotFSImageFormat()
           
 
Method Summary
static org.apache.hadoop.hdfs.server.namenode.INode loadCreated(byte[] createdNodeName, INodeDirectory parent)
          Load a node stored in the created list from fsimage.
static void loadDirectoryDiffList(INodeDirectory dir, DataInput in, FSImageFormat.Loader loader)
          Load the SnapshotDiff list for the INodeDirectoryWithSnapshot directory.
static FileDiffList loadFileDiffList(DataInput in, FSImageFormat.Loader loader)
           
static void loadSnapshotList(INodeDirectory snapshottableParent, int numSnapshots, DataInput in, FSImageFormat.Loader loader)
          Load snapshots and snapshotQuota for a Snapshottable directory.
static void saveDirectoryDiffList(INodeDirectory dir, DataOutput out, SnapshotFSImageFormat.ReferenceMap referenceMap)
           
static void saveFileDiffList(org.apache.hadoop.hdfs.server.namenode.INodeFile file, DataOutput out)
           
static void saveSnapshots(INodeDirectory current, DataOutput out)
          Save snapshots and snapshot quota for a snapshottable directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnapshotFSImageFormat

public SnapshotFSImageFormat()
Method Detail

saveSnapshots

public static void saveSnapshots(INodeDirectory current,
                                 DataOutput out)
                          throws IOException
Save snapshots and snapshot quota for a snapshottable directory.

Parameters:
current - The directory that the snapshots belongs to.
out - The DataOutput to write.
Throws:
IOException

saveDirectoryDiffList

public static void saveDirectoryDiffList(INodeDirectory dir,
                                         DataOutput out,
                                         SnapshotFSImageFormat.ReferenceMap referenceMap)
                                  throws IOException
Throws:
IOException

saveFileDiffList

public static void saveFileDiffList(org.apache.hadoop.hdfs.server.namenode.INodeFile file,
                                    DataOutput out)
                             throws IOException
Throws:
IOException

loadFileDiffList

public static FileDiffList loadFileDiffList(DataInput in,
                                            FSImageFormat.Loader loader)
                                     throws IOException
Throws:
IOException

loadCreated

public static org.apache.hadoop.hdfs.server.namenode.INode loadCreated(byte[] createdNodeName,
                                                                       INodeDirectory parent)
                                                                throws IOException
Load a node stored in the created list from fsimage.

Parameters:
createdNodeName - The name of the created node.
parent - The directory that the created list belongs to.
Returns:
The created node.
Throws:
IOException

loadSnapshotList

public static void loadSnapshotList(INodeDirectory snapshottableParent,
                                    int numSnapshots,
                                    DataInput in,
                                    FSImageFormat.Loader loader)
                             throws IOException
Load snapshots and snapshotQuota for a Snapshottable directory.

Parameters:
snapshottableParent - The snapshottable directory for loading.
numSnapshots - The number of snapshots that the directory has.
loader - The loader
Throws:
IOException

loadDirectoryDiffList

public static void loadDirectoryDiffList(INodeDirectory dir,
                                         DataInput in,
                                         FSImageFormat.Loader loader)
                                  throws IOException
Load the SnapshotDiff list for the INodeDirectoryWithSnapshot directory.

Parameters:
dir - The snapshottable directory for loading.
in - The DataInput instance to read.
loader - The loader
Throws:
IOException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.