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.
- Mark Little (email@example.com)
- $Id: ShadowingStore.java 2342 2006-03-30 13:06:17Z $
- 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,
tsLogger.logger.trace("ShadowingStore.currentState("+objUid+", "+tName+") - returning "+
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.
tsLogger.logger.trace("ShadowingStore.commit_state(" + objUid + ", " + tName + ")");
File originalState = new File(filename);
"ShadowStore::commit_state - "
Hide/reveal an object regardless of state. Hidden objects cannot be read
but they can be written (Crash recovery needs this).
tsLogger.logger.trace("ShadowingStore.hide_state(" + objUid + ", " + tName + ")");
tsLogger.logger.trace("ShadowingStore.reveal_state(" + objUid + ", " + tName + ")");
boolean revealedOk = true;
- 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
int imageSize = (int) fd.length();
byte buffer = new byte[imageSize];
"ShadowingStore::read_state error: " + e, e);
&& (ifile.read(buffer, 0, imageSize) == imageSize))
"ShadowingStore::read_state failed: " + e, e);
"ShadowStore::read_state - "
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
int imageSize = (int) state.length();
"ShadowingStore::write_state() - write failed to sync for "
"ShadowingStore::write_state() - write failed to locate file "
"ShadowingStore::write_state() - write failed for "
"ShadowStore::write_state - "