edu.unh.sdb.datasource
Class UniBlockCacheDataSource

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataSource
          extended by edu.unh.sdb.datasource.CacheDataSource
              extended by edu.unh.sdb.datasource.BlockCacheDataSource
                  extended by edu.unh.sdb.datasource.UniBlockCacheDataSource
All Implemented Interfaces:
Indexable

public class UniBlockCacheDataSource
extends BlockCacheDataSource

The UniBlockCacheDataSource provides cache service for an underlying datasource. CacheDataSources are typically created by the CacheMaker class, which tunes the size of the cache blocks to a particular iteration and underlying datasource. As its name implies, the UniBlockCacheDataSource uses a cache with a single block. When a query is received, it will be satisfied from this cache block if possible. Otherwise, one of two things will be done to satisfy the query. If the query can be satisfied entirely by reading a different block into the cache, then the new block is read, and the query satisfied. This is always the course of action for datum queries. For subblock queries, if the query region is entirely contained in some cache block, then that block is read and the query satisfied from its contents. If the query region spans more than one cache block, the query is satisfied directly from the datasource, and the cache block remains unchanged.


Field Summary
 
Fields inherited from class edu.unh.sdb.datasource.DataSource
fdlDescriptor, isActivated, name, wsName
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
UniBlockCacheDataSource(java.lang.String name, DataSource ds, IndexSpaceID blockDimensions)
          Create a UniBlockCacheDataSource with a single CacheBlock connected to the DataSource argument.
UniBlockCacheDataSource(java.lang.String name, DataSource ds, ISBounds iterationSpace, IndexSpaceID blockDimensions)
          Create a UniBlockCacheDataSource with a single CacheBlock connected to the DataSource argument.
 
Method Summary
 void activate()
          Calls activate() for the underlying datasource, and creates the actual cache, which allocates memory for the CacheBlock.
 CacheDataBlock getCacheBlockReference()
          Return the cache reference for possible need to assignment operation.
static void main(java.lang.String[] args)
          For debugging.
 void nextCacheBlock(ISBounds cacheSrcBounds)
          Read the data into the theCache which is referenced by the cache block Added by Baoqiang Yan on 11/30/2007
 
Methods inherited from class edu.unh.sdb.datasource.BlockCacheDataSource
getCacheBlockBounds, getCacheBlockBounds, getCacheBlockBounds, getCacheBlockBoundsIterator, getCacheBlockBoundsIterator, getCacheBlockDimensions, getCacheMemoryUsage
 
Methods inherited from class edu.unh.sdb.datasource.CacheDataSource
datum, datum, datum, deactivate, getIterationSpace, getSource, subblock, subblock
 
Methods inherited from class edu.unh.sdb.datasource.DataSource
checkActivated, clearCache, copyBestID, create, create, create, createRemote, createRemote, createRemoteClient, createRemoteClient, createRemoteDataSource, createRemoteDataSource, createRemoteDataSourceUDP, createRemoteUDP, createRemoteUDP, dumpData, equals, getName, getValues, isActivated, toString, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, datum, datum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDouble, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloat, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInt, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShort, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValues, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UniBlockCacheDataSource

public UniBlockCacheDataSource(java.lang.String name,
                               DataSource ds,
                               ISBounds iterationSpace,
                               IndexSpaceID blockDimensions)
Create a UniBlockCacheDataSource with a single CacheBlock connected to the DataSource argument. The CacheBlock dimensions are specified by the last argument. The memory for the cache itself is not allocated until this datasource is activated.


UniBlockCacheDataSource

public UniBlockCacheDataSource(java.lang.String name,
                               DataSource ds,
                               IndexSpaceID blockDimensions)
Create a UniBlockCacheDataSource with a single CacheBlock connected to the DataSource argument. The CacheBlock dimensions are specified by the last argument. The memory for the cache itself is not allocated until this datasource is activated.

Method Detail

getCacheBlockReference

public CacheDataBlock getCacheBlockReference()
Return the cache reference for possible need to assignment operation. This is only used when separate cache loading timeing is needed. It also saves memory and copy cost in such case if we use only one copy of the cache. Added by Baoqiang Yan on 11/30/2007


nextCacheBlock

public void nextCacheBlock(ISBounds cacheSrcBounds)
Read the data into the theCache which is referenced by the cache block Added by Baoqiang Yan on 11/30/2007


activate

public void activate()
Calls activate() for the underlying datasource, and creates the actual cache, which allocates memory for the CacheBlock.

Overrides:
activate in class BlockCacheDataSource

main

public static void main(java.lang.String[] args)
For debugging. Runs basic tests on the UniBlockCacheDataSource class.