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

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiffList
All Implemented Interfaces:
Iterable<FileDiff>

public class FileDiffList
extends Object

A list of FileDiffs for storing snapshot data.


Constructor Summary
FileDiffList()
           
 
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()
           
 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

FileDiffList

public FileDiffList()
Method Detail

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.