com.faunos.skwish.sys.mgr
Class Store

java.lang.Object
  extended by com.faunos.skwish.SegmentStore
      extended by com.faunos.skwish.sys.mgr.Store
All Implemented Interfaces:
Closeable, Channel

public class Store
extends SegmentStore

The SegmentStore implementation.

Author:
Babak Farhang

Field Summary
protected static ChannelUtil<SegmentStoreException> channelHelper
           
static Version VERSION
           
 
Fields inherited from class com.faunos.skwish.SegmentStore
validator
 
Constructor Summary
  Store(File rootDir)
          Reads the given root directory and creates a new instance.
protected Store(File rootDir, boolean create)
           
 
Method Summary
 void close()
          Closes the instance.
 Version getFileVersion()
           
static Provider getProvider()
           
 Segment getReadOnlySegment()
          Returns the live read-only view of the committed segments.
 File getRootDirectory()
           
 long getTxnCommitIdGap(long txnId)
          Returns the transaction commit id gap recorded on commit for the specified transaction, or -1, if the transaction is pending or discarded.
 String getUri()
          Returns the URI used to load this instance.
 boolean isOpen()
           
 TxnSegment newTransaction()
          Returns a new transaction [segment].
 
Methods inherited from class com.faunos.skwish.SegmentStore
loadInstance, setProvider, writeNewInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final Version VERSION

channelHelper

protected static final ChannelUtil<SegmentStoreException> channelHelper
Constructor Detail

Store

public Store(File rootDir)
      throws IOException
Reads the given root directory and creates a new instance.

Throws:
IOException

Store

protected Store(File rootDir,
                boolean create)
         throws IOException
Throws:
IOException
Method Detail

getProvider

public static Provider getProvider()

getFileVersion

public Version getFileVersion()
                       throws IOException
Throws:
IOException

getRootDirectory

public File getRootDirectory()

getUri

public String getUri()
Description copied from class: SegmentStore
Returns the URI used to load this instance.

Specified by:
getUri in class SegmentStore

getReadOnlySegment

public Segment getReadOnlySegment()
                           throws IOException
Description copied from class: SegmentStore
Returns the live read-only view of the committed segments. Transactions are immediately visible on commit.

Specified by:
getReadOnlySegment in class SegmentStore
Throws:
IOException

isOpen

public boolean isOpen()

newTransaction

public TxnSegment newTransaction()
                          throws IOException
Description copied from class: SegmentStore
Returns a new transaction [segment]. Transactions allow changes to be committed in all-or-nothing fashion. There is no architectural limit on the number of transactions that can be concurrently open (pending). Also, while transactions (TxnSegments) are not individually thread-safe, each transaction may be run concurrently in its own thread.

Specified by:
newTransaction in class SegmentStore
Throws:
IOException

getTxnCommitIdGap

public long getTxnCommitIdGap(long txnId)
                       throws IOException,
                              NotFoundException
Description copied from class: SegmentStore
Returns the transaction commit id gap recorded on commit for the specified transaction, or -1, if the transaction is pending or discarded.

Specified by:
getTxnCommitIdGap in class SegmentStore
Parameters:
txnId - the transaction id (from TxnSegment.getTxnId())
Throws:
NotFoundException - If txnId does not specify a known transaction
IOException

close

public void close()
           throws IOException
Description copied from class: SegmentStore
Closes the instance. All Segments opened by this instance are implicitly closed, and any uncommitted TxnSegments are discarded.

Specified by:
close in interface Closeable
Specified by:
close in interface Channel
Specified by:
close in class SegmentStore
Throws:
IOException


SourceForge.net Logo