Class CachedBlock

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.CachedBlock
All Implemented Interfaces:
org.apache.hadoop.util.IntrusiveCollection.Element, org.apache.hadoop.util.LightWeightGSet.LinkedElement

@LimitedPrivate("HDFS") public final class CachedBlock extends Object implements org.apache.hadoop.util.IntrusiveCollection.Element, org.apache.hadoop.util.LightWeightGSet.LinkedElement
Represents a cached block.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CachedBlock(long blockId, short replication, boolean mark)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
     
    Get a list of the datanodes which this block is cached, planned to be cached, or planned to be uncached on.
    boolean
     
    org.apache.hadoop.util.LightWeightGSet.LinkedElement
     
    org.apache.hadoop.util.IntrusiveCollection.Element
    getNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
     
    org.apache.hadoop.util.IntrusiveCollection.Element
    getPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
     
    short
     
    int
     
    void
    insertInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev, org.apache.hadoop.util.IntrusiveCollection.Element next)
     
    boolean
    isInList(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
     
    boolean
    Return true if this CachedBlock is present on the given list.
    void
    removeInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
     
    void
    setNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element next)
     
    void
    setNext(org.apache.hadoop.util.LightWeightGSet.LinkedElement next)
     
    void
    setPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev)
     
    void
    setReplicationAndMark(short replication, boolean mark)
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CachedBlock

      public CachedBlock(long blockId, short replication, boolean mark)
  • Method Details

    • getBlockId

      public long getBlockId()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • setReplicationAndMark

      public void setReplicationAndMark(short replication, boolean mark)
    • getMark

      public boolean getMark()
    • getReplication

      public short getReplication()
    • isPresent

      public boolean isPresent(DatanodeDescriptor.CachedBlocksList cachedBlocksList)
      Return true if this CachedBlock is present on the given list.
    • getDatanodes

      Get a list of the datanodes which this block is cached, planned to be cached, or planned to be uncached on.
      Parameters:
      type - If null, this parameter is ignored. If it is non-null, we match only datanodes which have it on this list. See DatanodeDescriptor.CachedBlocksList.Type for a description of all the lists.
      Returns:
      The list of datanodes. Modifying this list does not alter the state of the CachedBlock.
    • insertInternal

      public void insertInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev, org.apache.hadoop.util.IntrusiveCollection.Element next)
      Specified by:
      insertInternal in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • setPrev

      public void setPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element prev)
      Specified by:
      setPrev in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • setNext

      public void setNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list, org.apache.hadoop.util.IntrusiveCollection.Element next)
      Specified by:
      setNext in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • removeInternal

      public void removeInternal(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
      Specified by:
      removeInternal in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • getPrev

      public org.apache.hadoop.util.IntrusiveCollection.Element getPrev(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
      Specified by:
      getPrev in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • getNext

      public org.apache.hadoop.util.IntrusiveCollection.Element getNext(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
      Specified by:
      getNext in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • isInList

      public boolean isInList(org.apache.hadoop.util.IntrusiveCollection<? extends org.apache.hadoop.util.IntrusiveCollection.Element> list)
      Specified by:
      isInList in interface org.apache.hadoop.util.IntrusiveCollection.Element
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setNext

      public void setNext(org.apache.hadoop.util.LightWeightGSet.LinkedElement next)
      Specified by:
      setNext in interface org.apache.hadoop.util.LightWeightGSet.LinkedElement
    • getNext

      public org.apache.hadoop.util.LightWeightGSet.LinkedElement getNext()
      Specified by:
      getNext in interface org.apache.hadoop.util.LightWeightGSet.LinkedElement