Class ShadowingStore
java.lang.Object
com.arjuna.ats.arjuna.objectstore.ObjectStore
com.arjuna.ats.internal.arjuna.objectstore.FileSystemStore
com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore
- All Implemented Interfaces:
BaseStore
,ObjectStoreAPI
,ParticipantStore
,RecoveryStore
,TxLog
- Direct Known Subclasses:
ShadowNoFileLockStore
A shadowing file store implementation. Each version of the object's state is
maintained in a separate file. So, the original is stored in one file, and
the shadow (the updated state) is stored in another. When the transaction
commits, the shadow is made the original. If the transaction rolls back then
the shadow is simply removed from the object store.
- Since:
- 1.0
- Version:
- $Id: ShadowingStore.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
-
Field Summary
Fields inherited from class com.arjuna.ats.internal.arjuna.objectstore.FileSystemStore
doSync, scanZeroLengthFiles, syncWrites
Fields inherited from class com.arjuna.ats.arjuna.objectstore.ObjectStore
_objectStoreRoot, shareStatus
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
commit_state
(Uid objUid, String tName) Commit a previous write_state operation which was made with the SHADOW StateType argument.int
currentState
(Uid objUid, String tName) protected String
genPathName
(Uid objUid, String tName, int ft) boolean
hide_state
(Uid objUid, String tName) Hide/reveal an object regardless of state.protected InputObjectState
read_state
(Uid objUid, String tName, int ft) protected boolean
remove_state
(Uid objUid, String name, int ft) boolean
reveal_state
(Uid objUid, String tName) Reveal a hidden object's state.protected String
revealedId
(String name) Given a type id which is possibly hidden (e.g., has a ! at the end), make it a valid Uid so we can return it.protected boolean
write_state
(Uid objUid, String tName, OutputObjectState state, int ft) write_state saves the ObjectState in a file named by the type and Uid of the ObjectState.Methods inherited from class com.arjuna.ats.internal.arjuna.objectstore.FileSystemStore
addToCache, allObjUids, allTypes, allTypes, closeAndUnlock, createHierarchy, exists, getStoreName, lock, openAndLock, read_committed, read_uncommitted, remove_committed, remove_uncommitted, removeFromCache, removeFromCache, renameFromTo, renameFromToInternal, supressEntry, synchronousWrites, truncate, unlock, write_committed, write_uncommitted
Methods inherited from class com.arjuna.ats.arjuna.objectstore.ObjectStore
allObjUids, fullCommitNeeded, initialise, isType, locateStore, shareState, start, stop, storeDir, storeRoot, sync
-
Field Details
-
HIDDINGCHAR
public static final char HIDDINGCHAR- See Also:
-
SHADOWCHAR
public static final char SHADOWCHAR- See Also:
-
-
Constructor Details
-
ShadowingStore
public ShadowingStore(ObjectStoreEnvironmentBean objectStoreEnvironmentBean) throws ObjectStoreException - Throws:
ObjectStoreException
-
-
Method Details
-
currentState
- Parameters:
objUid
- The object to query.tName
- The type of the object to query.- Returns:
- current state of object. Assumes that genPathName allocates enough extra space to allow extra chars to be added. State search is ordered OS_SHADOW, OS_UNCOMMITTED_HIDDEN, OS_ORIGINAL, OS_COMMITTED_HIDDEN.
- Throws:
ObjectStoreException
-
commit_state
Commit a previous write_state operation which was made with the SHADOW StateType argument. This is achieved by renaming the shadow and removing the hidden version.- Parameters:
objUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
hide_state
Hide/reveal an object regardless of state. Hidden objects cannot be read but they can be written (Crash recovery needs this).- Parameters:
objUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
reveal_state
Description copied from interface:RecoveryStore
Reveal a hidden object's state.- Parameters:
objUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
genPathName
- Overrides:
genPathName
in classFileSystemStore
- Returns:
- the file name for the state of the object identified by the Uid and TypeName. If the StateType argument is OS_SHADOW then the Uid part of the name includes # characters. Builds on lower level genPathName which allocates enough slop to accomodate the extra chars.
- Throws:
ObjectStoreException
-
revealedId
Description copied from class:ObjectStore
Given a type id which is possibly hidden (e.g., has a ! at the end), make it a valid Uid so we can return it.- Overrides:
revealedId
in classObjectStore
-
read_state
- Specified by:
read_state
in classFileSystemStore
- Throws:
ObjectStoreException
-
remove_state
- Specified by:
remove_state
in classFileSystemStore
- Throws:
ObjectStoreException
-
write_state
protected boolean write_state(Uid objUid, String tName, OutputObjectState state, int ft) throws ObjectStoreException write_state saves the ObjectState in a file named by the type and Uid of the ObjectState. If the second argument is SHADOW, then the file name is different so that a subsequent commit_state invocation will rename the file.- Specified by:
write_state
in classFileSystemStore
- Throws:
ObjectStoreException
-