org.apache.hadoop.hdfs.server.namenode.snapshot
Class DirectoryWithSnapshotFeature.DirectoryDiffList

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature.DirectoryDiffList
All Implemented Interfaces:
Iterable<DirectoryWithSnapshotFeature.DirectoryDiff>
Enclosing class:
org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature

public static class DirectoryWithSnapshotFeature.DirectoryDiffList
extends Object

A list of directory diffs.


Constructor Summary
DirectoryWithSnapshotFeature.DirectoryDiffList()
           
 
Method Summary
 List<D> asList()
           
 void clear()
          Get the size of the list and then clear it.
 Quota.Counts deleteSnapshotDiff(int snapshot, int prior, N currentINode, INode.BlocksMapUpdateInfo collectedBlocks, List<org.apache.hadoop.hdfs.server.namenode.INode> removedINodes, boolean countDiffChange)
          Delete a snapshot.
 D getDiffById(int snapshotId)
           
 D getLast()
           
 int getLastSnapshotId()
           
 int getPrior(int snapshotId)
           
 int getSnapshotById(int snapshotId)
          Search for the snapshot whose id is 1) no less than the given id, and 2) most close to the given id.
 A getSnapshotINode(int snapshotId, A currentINode)
           
 Iterator<D> iterator()
           
 boolean removeChild(Diff.ListType type, org.apache.hadoop.hdfs.server.namenode.INode child)
          Remove the given child in the created/deleted list, if there is any.
 boolean replaceChild(Diff.ListType type, org.apache.hadoop.hdfs.server.namenode.INode oldChild, org.apache.hadoop.hdfs.server.namenode.INode newChild)
          Replace the given child in the created/deleted list, if there is any.
 void saveSelf2Snapshot(int latestSnapshotId, N currentINode, A snapshotCopy)
          Save the snapshot copy to the latest snapshot.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectoryWithSnapshotFeature.DirectoryDiffList

public DirectoryWithSnapshotFeature.DirectoryDiffList()
Method Detail

replaceChild

public boolean replaceChild(Diff.ListType type,
                            org.apache.hadoop.hdfs.server.namenode.INode oldChild,
                            org.apache.hadoop.hdfs.server.namenode.INode newChild)
Replace the given child in the created/deleted list, if there is any.


removeChild

public boolean removeChild(Diff.ListType type,
                           org.apache.hadoop.hdfs.server.namenode.INode child)
Remove the given child in the created/deleted list, if there is any.


asList

public final List<D> asList()
Returns:
this list as a unmodifiable List.

clear

public void clear()
Get the size of the list and then clear it.


deleteSnapshotDiff

public final Quota.Counts deleteSnapshotDiff(int snapshot,
                                             int prior,
                                             N currentINode,
                                             INode.BlocksMapUpdateInfo collectedBlocks,
                                             List<org.apache.hadoop.hdfs.server.namenode.INode> removedINodes,
                                             boolean countDiffChange)
                                      throws org.apache.hadoop.hdfs.protocol.QuotaExceededException
Delete a snapshot. The synchronization of the diff list will be done outside. If the diff to remove is not the first one in the diff list, we need to combine the diff with its previous one.

Parameters:
snapshot - The id of the snapshot to be deleted
prior - The id of the snapshot taken before the to-be-deleted snapshot
collectedBlocks - Used to collect information for blocksMap update
Returns:
delta in namespace.
Throws:
org.apache.hadoop.hdfs.protocol.QuotaExceededException

getLast

public final D getLast()
Returns:
the last diff.

getLastSnapshotId

public final int getLastSnapshotId()
Returns:
the id of the last snapshot.

getPrior

public final int getPrior(int snapshotId)

getDiffById

public final D getDiffById(int snapshotId)

getSnapshotById

public final int getSnapshotById(int snapshotId)
Search for the snapshot whose id is 1) no less than the given id, and 2) most close to the given id.


getSnapshotINode

public A getSnapshotINode(int snapshotId,
                          A currentINode)
Returns:
the inode corresponding to the given snapshot. Note that the current inode is returned if there is no change between the given snapshot and the current state.

saveSelf2Snapshot

public void saveSelf2Snapshot(int latestSnapshotId,
                              N currentINode,
                              A snapshotCopy)
                       throws org.apache.hadoop.hdfs.protocol.QuotaExceededException
Save the snapshot copy to the latest snapshot.

Throws:
org.apache.hadoop.hdfs.protocol.QuotaExceededException

iterator

public Iterator<D> iterator()
Specified by:
iterator in interface Iterable<D extends org.apache.hadoop.hdfs.server.namenode.snapshot.AbstractINodeDiff<N,A,D>>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014 Apache Software Foundation. All Rights Reserved.