com.bigdata.journal
Class TemporaryStore

java.lang.Object
  extended by com.bigdata.rawstore.AbstractRawStore
      extended by com.bigdata.rawstore.AbstractRawWormStore
          extended by com.bigdata.journal.TemporaryRawStore
              extended by com.bigdata.journal.TemporaryStore
All Implemented Interfaces:
ICounterSetAccess, IBTreeManager, IIndexManager, IIndexStore, IAddressManager, IMRMW, IMROW, IRawStore, IWORM

public class TemporaryStore
extends TemporaryRawStore
implements IBTreeManager

A temporary store that supports named indices but no concurrency controls.

If you want a temporary store that supports named indices and concurrency controls then choose a Journal with BufferMode.Temporary. This has the advantage of full concurrency support, group commit, and low-latency startup (since the file is not created until the store attempts to write through to the disk). However, TemporaryStore is lighter weight precisely because it does not provide concurrency control.

Version:
$Id: TemporaryStore.java 6352 2012-06-14 18:08:09Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 
Fields inherited from class com.bigdata.rawstore.AbstractRawWormStore
am
 
Fields inherited from interface com.bigdata.rawstore.IAddressManager
NULL
 
Constructor Summary
TemporaryStore()
          A TemporaryStore that can scale-up.
TemporaryStore(int offsetBits)
          A TemporaryStore provisioned with the specified offsetBits.
TemporaryStore(int offsetBits, File file)
          A TemporaryStore provisioned with the specified offsetBits and backed by the specified file.
 
Method Summary
 ScheduledFuture<?> addScheduledTask(Runnable task, long initialDelay, long delay, TimeUnit unit)
          Not supported, returns null.
 void close()
          Close the store and delete the associated file, if any.
 void dropIndex(String name)
          Drops the named index.
 boolean getCollectPlatformStatistics()
          Not supported, returns false.
 boolean getCollectQueueStatistics()
          Not supported, returns false.
 ExecutorService getExecutorService()
          A ExecutorService that may be used to parallelize operations.
 BigdataFileSystem getGlobalFileSystem()
          Return the global file system used to store block-structured files and their metadata and as a source and sink for map/reduce processing.
 SparseRowStore getGlobalRowStore()
          Return an unisolated view of the global SparseRowStore used to store named property sets.
 SparseRowStore getGlobalRowStore(long timestamp)
          Return a view of the global SparseRowStore used to store named property sets as of the specified timestamp.
 HTree getHTree(String name)
          Return an ITx.UNISOLATED view of the named index -or- null if there is no registered index by that name.
 int getHttpdPort()
          Not supported, returns false.
 BTree getIndex(String name)
          Return an ITx.UNISOLATED view of the named index -or- null if there is no registered index by that name.
 BTree getIndex(String name, long timestamp)
          Historical reads and transactions are not supported.
 long getLastCommitTime()
          Always returns ZERO (0L) since you can not perform a commit on a TemporaryRawStore (it supports checkpoints but not commits).
 DefaultResourceLocator getResourceLocator()
          Return the default locator for resources that are logical index containers (relations and relation containers).
 IResourceLockService getResourceLockService()
          The service that may be used to acquire synchronous distributed locks without deadlock detection.
 TemporaryStore getTempStore()
          Always returns this TemporaryStore.
 void register(String name, ICheckpointProtocol ndx)
          Register a named persistence capable data structure (core impl).
 ICheckpointProtocol register(String name, IndexMetadata metadata)
          Variant method creates and registered a named persistence capable data structure but does not assume that the data structure will be a BTree.
 void registerIndex(IndexMetadata metadata)
          Register a named index.
 BTree registerIndex(String name, BTree btree)
          Register a named index.
 BTree registerIndex(String name, IndexMetadata metadata)
          Register a named index.
 
Methods inherited from class com.bigdata.journal.TemporaryRawStore
assertOpen, delete, deleteResources, destroy, finalize, force, getBufferStrategy, getCounters, getFile, getMaxRecordSize, getResourceMetadata, getTempFile, getTempFile, getUUID, isFullyBuffered, isOpen, isReadOnly, isStable, read, size, toString, write
 
Methods inherited from class com.bigdata.rawstore.AbstractRawWormStore
getAddressManager, getByteCount, getOffset, getOffsetBits, getPhysicalAddress, toAddr, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.journal.IIndexStore
destroy
 

Constructor Detail

TemporaryStore

public TemporaryStore()
A TemporaryStore that can scale-up. The backing file will be created using the Java temporary file mechanism.

See Also:
WormAddressManager.SCALE_UP_OFFSET_BITS, TemporaryRawStore.getTempFile()

TemporaryStore

public TemporaryStore(int offsetBits)
A TemporaryStore provisioned with the specified offsetBits. The backing file will be created using the Java temporary file mechanism.

Parameters:
offsetBits - This determines the capacity of the store file and the maximum length of a record. The value is passed through to WormAddressManager.WormAddressManager(int).

TemporaryStore

public TemporaryStore(int offsetBits,
                      File file)
A TemporaryStore provisioned with the specified offsetBits and backed by the specified file.

Parameters:
offsetBits - This determines the capacity of the store file and the maximum length of a record. The value is passed through to WormAddressManager.WormAddressManager(int).
file - The backing file (may exist, but must be empty if it exists).
Method Detail

registerIndex

public void registerIndex(IndexMetadata metadata)
Description copied from interface: IIndexManager
Register a named index.

Note: The name property MUST be set on the IndexMetadata and the index will be registered under that name.

Specified by:
registerIndex in interface IIndexManager
Parameters:
metadata - The metadata describing the index.

registerIndex

public BTree registerIndex(String name,
                           IndexMetadata metadata)
Description copied from interface: IBTreeManager
Register a named index.

This variant allows you to register an index under a name other than the value returned by IndexMetadata.getName().

Note: This variant is generally by the IMetadataService when it needs to register a index partition of some scale-out index on a IDataService. In this case the name is the name of the index partition while the value reported by IndexMetadata.getName() is the name of the scale-out index. In nearly all other cases you can use IIndexManager.registerIndex(IndexMetadata) instead. The same method signature is also declared by IDataService.registerIndex(String, IndexMetadata) in order to support registration of index partitions.

Note: Due to the method signature, this method CAN NOT be used to create and register persistence capable data structures other than an IIndex (aka B+Tree).

Specified by:
registerIndex in interface IBTreeManager
Parameters:
name - The name that can be used to recover the index.
metadata - The metadata describing the index.
Returns:
The object that would be returned by IBTreeManager.getIndex(String).
See Also:
#register(String, IndexMetadata)

register

public ICheckpointProtocol register(String name,
                                    IndexMetadata metadata)
Variant method creates and registered a named persistence capable data structure but does not assume that the data structure will be a BTree.

Parameters:
store - The backing store.
metadata - The metadata that describes the data structure to be created.
Returns:
The persistence capable data structure.
See Also:
Checkpoint.create(IRawStore, IndexMetadata)

registerIndex

public final BTree registerIndex(String name,
                                 BTree btree)
Description copied from interface: IBTreeManager
Register a named index.

Specified by:
registerIndex in interface IBTreeManager
Parameters:
name - The name that can be used to recover the index.
btree - The btree.
Returns:
The object that would be returned by IBTreeManager.getIndex(String).

register

public final void register(String name,
                           ICheckpointProtocol ndx)
Register a named persistence capable data structure (core impl).

Parameters:
name - The name.
ndx - The data structure.

dropIndex

public void dropIndex(String name)
Description copied from interface: IIndexManager
Drops the named index.

Note: Whether or not and when index resources are reclaimed is dependent on the store. For example, an immortal store will retain all historical states for all indices. Likewise, a store that uses index partitions may be able to delete index segments immediately.

Specified by:
dropIndex in interface IIndexManager
Parameters:
name - The name of the index to be dropped.

getIndex

public BTree getIndex(String name)
Return an ITx.UNISOLATED view of the named index -or- null if there is no registered index by that name.

Specified by:
getIndex in interface IBTreeManager
Parameters:
name - The name of the index.
Returns:
The unisolated view named index or null iff there is no index registered with that name.

getHTree

public HTree getHTree(String name)
Return an ITx.UNISOLATED view of the named index -or- null if there is no registered index by that name.


getIndex

public BTree getIndex(String name,
                      long timestamp)
Historical reads and transactions are not supported.

Specified by:
getIndex in interface IIndexStore
Parameters:
name -
timestamp -
Returns:
The index or null iff there is no index registered with that name for that timestamp.
Throws:
UnsupportedOperationException - unless the timestamp is ITx.UNISOLATED.

getGlobalRowStore

public SparseRowStore getGlobalRowStore()
Description copied from interface: IIndexStore
Return an unisolated view of the global SparseRowStore used to store named property sets.

Specified by:
getGlobalRowStore in interface IIndexStore
See Also:
GlobalRowStoreSchema

getGlobalRowStore

public SparseRowStore getGlobalRowStore(long timestamp)
Description copied from interface: IIndexStore
Return a view of the global SparseRowStore used to store named property sets as of the specified timestamp.

The SparseRowStore only permits ITx.UNISOLATED writes, so you MUST specify ITx.UNISOLATED as the timestamp if you intend to write on the global row store!

You can request the most recent committed state of the global row store by specifying ITx.READ_COMMITTED.

Specified by:
getGlobalRowStore in interface IIndexStore
Parameters:
timestamp - The timestamp of the view.
Returns:
The global row store view -or- null if no view exists as of that timestamp.

getGlobalFileSystem

public BigdataFileSystem getGlobalFileSystem()
Description copied from interface: IIndexStore
Return the global file system used to store block-structured files and their metadata and as a source and sink for map/reduce processing.

Specified by:
getGlobalFileSystem in interface IIndexStore
See Also:
BigdataFileSystem

getResourceLocator

public DefaultResourceLocator getResourceLocator()
Description copied from interface: IIndexStore
Return the default locator for resources that are logical index containers (relations and relation containers).

Specified by:
getResourceLocator in interface IIndexStore

getExecutorService

public ExecutorService getExecutorService()
Description copied from interface: IIndexStore
A ExecutorService that may be used to parallelize operations. This service is automatically used when materializing located resources. While the service does not impose concurrency controls, tasks run on this service may submit operations to a ConcurrencyManager.

Specified by:
getExecutorService in interface IIndexStore

getResourceLockService

public final IResourceLockService getResourceLockService()
Description copied from interface: IIndexStore
The service that may be used to acquire synchronous distributed locks without deadlock detection.

Specified by:
getResourceLockService in interface IIndexStore

close

public void close()
Description copied from class: TemporaryRawStore
Close the store and delete the associated file, if any.

Specified by:
close in interface IRawStore
Overrides:
close in class TemporaryRawStore

getLastCommitTime

public long getLastCommitTime()
Always returns ZERO (0L) since you can not perform a commit on a TemporaryRawStore (it supports checkpoints but not commits).

Specified by:
getLastCommitTime in interface IIndexStore
Returns:
The timestamp of the most recent commit on the store or 0L iff there have been no commits.
See Also:
IRootBlockView.getLastCommitTime()

getTempStore

public TemporaryStore getTempStore()
Always returns this TemporaryStore.

Specified by:
getTempStore in interface IIndexStore
Returns:
A TemporaryStore.

addScheduledTask

public ScheduledFuture<?> addScheduledTask(Runnable task,
                                           long initialDelay,
                                           long delay,
                                           TimeUnit unit)
Not supported, returns null.

Specified by:
addScheduledTask in interface IIndexStore
Parameters:
task - The task.
initialDelay - The initial delay.
delay - The delay between invocations.
unit - The units for the delay parameters.
Returns:
The ScheduledFuture for that task.

getCollectPlatformStatistics

public boolean getCollectPlatformStatistics()
Not supported, returns false.

Specified by:
getCollectPlatformStatistics in interface IIndexStore

getCollectQueueStatistics

public boolean getCollectQueueStatistics()
Not supported, returns false.

Specified by:
getCollectQueueStatistics in interface IIndexStore

getHttpdPort

public int getHttpdPort()
Not supported, returns false.

Specified by:
getHttpdPort in interface IIndexStore


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.