Class LogStore
java.lang.Object
com.arjuna.ats.arjuna.objectstore.ObjectStore
com.arjuna.ats.internal.arjuna.objectstore.FileSystemStore
com.arjuna.ats.internal.arjuna.objectstore.LogStore
- All Implemented Interfaces:
BaseStore
,ObjectStoreAPI
,ParticipantStore
,RecoveryStore
,TxLog
-
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
allLogUids
(String tName, InputObjectState state, int match) boolean
allObjUids
(String tName, InputObjectState state, int match) This is a recovery-only method and should not be called during normal execution.boolean
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) Normally returns the current state of the log entry.protected String
genPathName
(Uid objUid, String tName, int ft) boolean
hide_state
(Uid u, String tn) Hide the object's state in the object store.protected boolean
Lock the file in the object store.protected InputObjectState
read_state
(Uid u, String tn, int s) Shouldn't be called during normal execution only during recovery.read_uncommitted
(Uid u, String tn) Read the object's shadowed state.protected boolean
remove_state
(Uid u, String tn, int s) Does nothing except indicate that this thread is finished with the log on behalf of this transaction.boolean
remove_uncommitted
(Uid u, String tn) Remove the object's uncommitted state.boolean
reveal_state
(Uid u, String tn) Reveal a hidden object's state.protected boolean
Unlock the file in the object store.protected boolean
unlockAndClose
(File fd, RandomAccessFile rf) Unlock and close the file.boolean
write_committed
(Uid storeUid, String tName, OutputObjectState state) Write a new copy of the object's committed state.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.boolean
write_uncommitted
(Uid u, String tn, OutputObjectState s) Write a copy of the object's uncommitted state.Methods inherited from class com.arjuna.ats.internal.arjuna.objectstore.FileSystemStore
addToCache, allTypes, allTypes, closeAndUnlock, createHierarchy, exists, getStoreName, openAndLock, read_committed, remove_committed, removeFromCache, removeFromCache, renameFromTo, renameFromToInternal, supressEntry, synchronousWrites, truncate
Methods inherited from class com.arjuna.ats.arjuna.objectstore.ObjectStore
allObjUids, fullCommitNeeded, initialise, isType, locateStore, revealedId, shareState, start, stop, storeDir, storeRoot, sync
-
Field Details
-
LOG_SIZE
public static final long LOG_SIZE- See Also:
-
-
Constructor Details
-
LogStore
- Throws:
ObjectStoreException
-
-
Method Details
-
currentState
Normally returns the current state of the log entry. However, this is never called during normal (non-recovery) execution. Therefore, the overhead of having to scan all of the logs (if it's not one we're using) is minimal.- Parameters:
objUid
- The object to query.tName
- The type of the object to query.- Returns:
- the current state of the object's state (e.g., shadowed, committed ...) [StateStatus]
- 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
Description copied from interface:RecoveryStore
Hide the object's state in the object store. Used by crash recovery.- Parameters:
u
- The object to work on.tn
- 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:
u
- The object to work on.tn
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
read_uncommitted
Description copied from interface:ParticipantStore
Read the object's shadowed state.- Specified by:
read_uncommitted
in interfaceParticipantStore
- Overrides:
read_uncommitted
in classFileSystemStore
- Parameters:
u
- The object to work on.tn
- The type of the object to work on.- Returns:
- the state of the object.
- Throws:
ObjectStoreException
-
remove_uncommitted
Description copied from interface:ParticipantStore
Remove the object's uncommitted state.- Specified by:
remove_uncommitted
in interfaceParticipantStore
- Overrides:
remove_uncommitted
in classFileSystemStore
- Parameters:
u
- The object to work on.tn
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
write_committed
public boolean write_committed(Uid storeUid, String tName, OutputObjectState state) throws ObjectStoreException Description copied from interface:TxLog
Write a new copy of the object's committed state.- Specified by:
write_committed
in interfaceTxLog
- Overrides:
write_committed
in classFileSystemStore
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.state
- The state to write.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
write_uncommitted
Description copied from interface:ParticipantStore
Write a copy of the object's uncommitted state.- Specified by:
write_uncommitted
in interfaceParticipantStore
- Overrides:
write_uncommitted
in classFileSystemStore
- Parameters:
u
- The object to work on.tn
- The type of the object to work on.s
- The state to write.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
allLogUids
public boolean allLogUids(String tName, InputObjectState state, int match) throws ObjectStoreException - Throws:
ObjectStoreException
-
allObjUids
public boolean allObjUids(String tName, InputObjectState state, int match) throws ObjectStoreException This is a recovery-only method and should not be called during normal execution. As such we need to load in all of the logs we can find that aren't already loaded (or activated).- Specified by:
allObjUids
in interfaceRecoveryStore
- Overrides:
allObjUids
in classFileSystemStore
- Parameters:
tName
- The type to scan for.state
- The object state in which to store the Uidsmatch
- The file type to look for (e.g., committed, shadowed). [StateStatus] Note: m=OS_UNKNOWN matches any state.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
unlockAndClose
Unlock and close the file. Note that if the unlock fails we set the return value to false to indicate an error but rely on the close to really do the unlock. -
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. We need to make sure that each entry is written to the next empty location in the log even if there's already an entry for this tx.- Specified by:
write_state
in classFileSystemStore
- Throws:
ObjectStoreException
-
read_state
Shouldn't be called during normal execution only during recovery.- Specified by:
read_state
in classFileSystemStore
- Throws:
ObjectStoreException
-
remove_state
Does nothing except indicate that this thread is finished with the log on behalf of this transaction.- Specified by:
remove_state
in classFileSystemStore
- Throws:
ObjectStoreException
-
lock
Description copied from class:FileSystemStore
Lock the file in the object store.- Overrides:
lock
in classFileSystemStore
-
unlock
Description copied from class:FileSystemStore
Unlock the file in the object store.- Overrides:
unlock
in classFileSystemStore
-
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. The magic number SLOP below is the number of extra characters needed to make up the entire path.
- Throws:
ObjectStoreException
-