org.apache.spark.storage
Class StorageStatus

Object
  extended by org.apache.spark.storage.StorageStatus

public class StorageStatus
extends Object

:: DeveloperApi :: Storage information for each BlockManager.

This class assumes BlockId and BlockStatus are immutable, such that the consumers of this class cannot mutate the source of the information. Accesses are not thread-safe.


Constructor Summary
StorageStatus(BlockManagerId blockManagerId, long maxMem)
           
StorageStatus(BlockManagerId bmid, long maxMem, scala.collection.Map<BlockId,BlockStatus> initialBlocks)
          Create a storage status with an initial set of blocks, leaving the source unmodified.
 
Method Summary
 BlockManagerId blockManagerId()
           
 scala.collection.Map<BlockId,BlockStatus> blocks()
          Return the blocks stored in this block manager.
 boolean containsBlock(BlockId blockId)
          Return whether the given block is stored in this block manager in O(1) time.
 long diskUsed()
          Return the disk space used by this block manager.
 long diskUsedByRdd(int rddId)
          Return the disk space used by the given RDD in this block manager in O(1) time.
 scala.Option<BlockStatus> getBlock(BlockId blockId)
          Return the given block stored in this block manager in O(1) time.
 long maxMem()
           
 long memRemaining()
          Return the memory remaining in this block manager.
 long memUsed()
          Return the memory used by this block manager.
 long memUsedByRdd(int rddId)
          Return the memory used by the given RDD in this block manager in O(1) time.
 int numBlocks()
          Return the number of blocks stored in this block manager in O(RDDs) time.
 int numRddBlocks()
          Return the number of RDD blocks stored in this block manager in O(RDDs) time.
 int numRddBlocksById(int rddId)
          Return the number of blocks that belong to the given RDD in O(1) time.
 long offHeapUsed()
          Return the off-heap space used by this block manager.
 long offHeapUsedByRdd(int rddId)
          Return the off-heap space used by the given RDD in this block manager in O(1) time.
 scala.collection.Map<BlockId,BlockStatus> rddBlocks()
          Return the RDD blocks stored in this block manager.
 scala.collection.Map<BlockId,BlockStatus> rddBlocksById(int rddId)
          Return the blocks that belong to the given RDD stored in this block manager.
 scala.Option<StorageLevel> rddStorageLevel(int rddId)
          Return the storage level, if any, used by the given RDD in this block manager.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageStatus

public StorageStatus(BlockManagerId blockManagerId,
                     long maxMem)

StorageStatus

public StorageStatus(BlockManagerId bmid,
                     long maxMem,
                     scala.collection.Map<BlockId,BlockStatus> initialBlocks)
Create a storage status with an initial set of blocks, leaving the source unmodified.

Method Detail

blockManagerId

public BlockManagerId blockManagerId()

maxMem

public long maxMem()

blocks

public scala.collection.Map<BlockId,BlockStatus> blocks()
Return the blocks stored in this block manager.

Note that this is somewhat expensive, as it involves cloning the underlying maps and then concatenating them together. Much faster alternatives exist for common operations such as contains, get, and size.

Returns:
(undocumented)

rddBlocks

public scala.collection.Map<BlockId,BlockStatus> rddBlocks()
Return the RDD blocks stored in this block manager.

Note that this is somewhat expensive, as it involves cloning the underlying maps and then concatenating them together. Much faster alternatives exist for common operations such as getting the memory, disk, and off-heap memory sizes occupied by this RDD.

Returns:
(undocumented)

rddBlocksById

public scala.collection.Map<BlockId,BlockStatus> rddBlocksById(int rddId)
Return the blocks that belong to the given RDD stored in this block manager.


containsBlock

public boolean containsBlock(BlockId blockId)
Return whether the given block is stored in this block manager in O(1) time. Note that this is much faster than this.blocks.contains, which is O(blocks) time.

Parameters:
blockId - (undocumented)
Returns:
(undocumented)

getBlock

public scala.Option<BlockStatus> getBlock(BlockId blockId)
Return the given block stored in this block manager in O(1) time. Note that this is much faster than this.blocks.get, which is O(blocks) time.

Parameters:
blockId - (undocumented)
Returns:
(undocumented)

numBlocks

public int numBlocks()
Return the number of blocks stored in this block manager in O(RDDs) time. Note that this is much faster than this.blocks.size, which is O(blocks) time.

Returns:
(undocumented)

numRddBlocks

public int numRddBlocks()
Return the number of RDD blocks stored in this block manager in O(RDDs) time. Note that this is much faster than this.rddBlocks.size, which is O(RDD blocks) time.

Returns:
(undocumented)

numRddBlocksById

public int numRddBlocksById(int rddId)
Return the number of blocks that belong to the given RDD in O(1) time. Note that this is much faster than this.rddBlocksById(rddId).size, which is O(blocks in this RDD) time.

Parameters:
rddId - (undocumented)
Returns:
(undocumented)

memRemaining

public long memRemaining()
Return the memory remaining in this block manager.


memUsed

public long memUsed()
Return the memory used by this block manager.


diskUsed

public long diskUsed()
Return the disk space used by this block manager.


offHeapUsed

public long offHeapUsed()
Return the off-heap space used by this block manager.


memUsedByRdd

public long memUsedByRdd(int rddId)
Return the memory used by the given RDD in this block manager in O(1) time.


diskUsedByRdd

public long diskUsedByRdd(int rddId)
Return the disk space used by the given RDD in this block manager in O(1) time.


offHeapUsedByRdd

public long offHeapUsedByRdd(int rddId)
Return the off-heap space used by the given RDD in this block manager in O(1) time.


rddStorageLevel

public scala.Option<StorageLevel> rddStorageLevel(int rddId)
Return the storage level, if any, used by the given RDD in this block manager.