|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.raw.data.BaseContainer
org.apache.derby.impl.store.raw.data.FileContainer
org.apache.derby.impl.store.raw.data.RAFContainer
RAFContainer (short for RandomAccessFileContainer) is a concrete subclass of FileContainer for FileContainers which are implemented on java.io.RandomAccessFile.
Field Summary | |
private int |
actionCode
|
private boolean |
actionErrorOK
|
private StorageFile |
actionFile
|
private ContainerKey |
actionIdentity
|
private LogInstant |
actionInstant
|
private boolean |
actionStub
|
private boolean |
actionTryAlternatePath
|
private static int |
CREATE_CONTAINER_ACTION
|
protected StorageRandomAccessFile |
fileData
|
private static int |
GET_FILE_NAME_ACTION
|
protected boolean |
needsSync
|
private static int |
OPEN_CONTAINER_ACTION
|
private static int |
REMOVE_FILE_ACTION
|
private static int |
STUBBIFY_ACTION
|
Fields inherited from class org.apache.derby.impl.store.raw.data.FileContainer |
ALLOC_PAGE_ARG_NUM, allocCache, canUpdate, CHECKSUM_SIZE, CONTAINER_INFO_SIZE, containerCache, containerInfo, containerVersion, dataFactory, estimatedRowCount, FIRST_ALLOC_PAGE_NUMBER, FIRST_ALLOC_PAGE_OFFSET, firstAllocPageNumber, firstAllocPageOffset, formatIdInteger, initialPages, isDirty, lastLogInstant, minimumRecordSize, pageCache, pageSize, preDirty, SPACE_TRACE, spareSpace, STORED_PAGE_ARG_NUM |
Fields inherited from class org.apache.derby.impl.store.raw.data.BaseContainer |
identity, isCommittedDrop, isDropped, isReusableRecordId |
Constructor Summary | |
protected |
RAFContainer(BaseDataFileFactory factory)
|
Method Summary | |
void |
clean(boolean forRemove)
Clean the object. |
private void |
clearDirty()
|
protected void |
closeContainer()
|
protected void |
createContainer(ContainerKey newIdentity)
Create a new container. |
Cacheable |
createIdentity(java.lang.Object key,
java.lang.Object createParameter)
Create a new item. |
protected void |
flushAll()
flush the cache to ensure all of my pages are written to disk |
protected StorageFile |
getFileName(ContainerKey identity,
boolean stub,
boolean errorOK,
boolean tryAlternatePath)
|
boolean |
isDirty()
We treat this container as dirty if it has the container file open. |
protected boolean |
openContainer(ContainerKey newIdentity)
Open a container. |
private boolean |
padFile(StorageRandomAccessFile file,
long pageOffset)
Pad the file upto the passed in page offset. |
protected int |
preAllocate(long lastPreallocPagenum,
int preAllocSize)
Preallocate some pages if need be |
protected StorageFile |
privGetFileName(ContainerKey identity,
boolean stub,
boolean errorOK,
boolean tryAlternatePath)
|
private boolean |
privRemoveFile(StorageFile file)
|
protected void |
readPage(long pageNumber,
byte[] pageData)
Read a page into the supplied array. |
protected void |
removeContainer(LogInstant instant,
boolean leaveStub)
Remove the container |
protected boolean |
removeFile(StorageFile file)
|
java.lang.Object |
run()
|
Cacheable |
setIdentity(java.lang.Object key)
Set container's identity |
protected void |
stubbify(LogInstant instant)
|
protected void |
truncatePages(long lastValidPagenum)
Truncate pages of a container. |
protected void |
writePage(long pageNumber,
byte[] pageData,
boolean syncPage)
Write a page from the supplied array. |
private void |
writeRAFHeader(StorageRandomAccessFile file,
boolean create,
boolean syncFile)
|
Methods inherited from class org.apache.derby.impl.store.raw.data.BaseContainer |
addPage, compressContainer, fillInIdentity, getAllocPage, getAnyPage, getCommittedDropState, getContainerId, getContainerStatus, getDeallocLock, getDroppedState, getFirstPage, getIdentity, getNextPage, getSegmentId, isReusableRecordId, lockAttributes, lockerAlwaysCompatible, lockEvent, removePage, requestCompatible, setCommittedDropState, setDroppedState, setReusableRecordIdState, truncate, unlockEvent, use |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.services.cache.Cacheable |
getIdentity |
Field Detail |
protected StorageRandomAccessFile fileData
protected boolean needsSync
private int actionCode
private static final int GET_FILE_NAME_ACTION
private static final int CREATE_CONTAINER_ACTION
private static final int REMOVE_FILE_ACTION
private static final int OPEN_CONTAINER_ACTION
private static final int STUBBIFY_ACTION
private ContainerKey actionIdentity
private boolean actionStub
private boolean actionErrorOK
private boolean actionTryAlternatePath
private StorageFile actionFile
private LogInstant actionInstant
Constructor Detail |
protected RAFContainer(BaseDataFileFactory factory)
Method Detail |
public boolean isDirty()
FileContainer
isDirty
in interface Cacheable
isDirty
in class FileContainer
Cacheable.isDirty()
public Cacheable setIdentity(java.lang.Object key) throws StandardException
setIdentity
in interface Cacheable
setIdentity
in class FileContainer
StandardException
- Standard Cloudscape error policyCacheable.setIdentity(java.lang.Object)
public Cacheable createIdentity(java.lang.Object key, java.lang.Object createParameter) throws StandardException
Cacheable
Create a new item and set the identity of the object to represent it.
The object will be in the No Identity state,
ie. it will have just been created or clearIdentity() was just called.
The object must copy the information out of key, not just store a reference to key
if the key is not immutable.
After this call the expression getIdentity().equals(key) must return true.
If the class of the object needs to change (e.g. to support a different format)
then the object should create a new object, call its initParameter() with the parameters
the original object was called with, set its identity and return a reference to it. The cache
manager will discard the reference to the old object.
If an exception is thrown the object must be left in the no-identity state.
MT - single thread required - Method must only be called be cache manager
and the cache manager will guarantee only one thread can be calling it.
createIdentity
in interface Cacheable
createIdentity
in class FileContainer
StandardException
- Standard Cloudscape error policyprotected void removeContainer(LogInstant instant, boolean leaveStub) throws StandardException
removeContainer
in class BaseContainer
leaveStub
- if true, leave a stub. If false, remove everything
StandardException
- Standard Cloudscape error policyRawContainerHandle.removeContainer(org.apache.derby.iapi.store.raw.log.LogInstant)
protected final void closeContainer()
closeContainer
in class FileContainer
protected void readPage(long pageNumber, byte[] pageData) throws java.io.IOException, StandardException
readPage
in class FileContainer
java.io.IOException
- exception reading page
StandardException
- Standard Cloudscape error policyprotected void writePage(long pageNumber, byte[] pageData, boolean syncPage) throws java.io.IOException, StandardException
writePage
in class FileContainer
StandardException
- Standard Cloudscape error policy
java.io.IOException
- IO error accessing pageprivate boolean padFile(StorageRandomAccessFile file, long pageOffset) throws java.io.IOException, StandardException
java.io.IOException
StandardException
public void clean(boolean forRemove) throws StandardException
Cacheable
clean
in interface Cacheable
StandardException
- Standard Cloudscape error policyprivate void clearDirty()
protected int preAllocate(long lastPreallocPagenum, int preAllocSize)
preAllocate
in class FileContainer
lastPreallocPagenum
- the last preallocated page number as known
by the allocation pagepreAllocSize
- try to preallocate this page number of pages.
Since only the container knows how many pages are actually on
disk, it may determine that certain number of pages that the
allocation page thinks need to be preallocated is already
allocated, in those case, act as if the preallocation is
successful.
protected void truncatePages(long lastValidPagenum) throws StandardException
Truncate all pages from lastValidPagenum+1 through the end of the file.
truncatePages
in class BaseContainer
lastValidPagenum
- The page number of the last valid page of the
file. All pages after this one are truncated.
StandardException
- Standard exception policy.private void writeRAFHeader(StorageRandomAccessFile file, boolean create, boolean syncFile) throws java.io.IOException, StandardException
java.io.IOException
StandardException
protected void flushAll() throws StandardException
flushAll
in class BaseContainer
StandardException
- Standard Cloudscape error policyprotected StorageFile getFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) throws StandardException
StandardException
protected StorageFile privGetFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) throws StandardException
StandardException
protected void createContainer(ContainerKey newIdentity) throws StandardException
FileContainer
Create a new container, all references to identity must be through the passed in identity, this object will no identity until after this method returns.
createContainer
in class FileContainer
StandardException
- Cloudscape Standard error policyprotected boolean removeFile(StorageFile file) throws java.lang.SecurityException, StandardException
java.lang.SecurityException
StandardException
private boolean privRemoveFile(StorageFile file) throws StandardException
StandardException
protected boolean openContainer(ContainerKey newIdentity) throws StandardException
FileContainer
Longer descrption of routine.
Open a container. Open the file that maps to this container, if the
file does not exist then we assume the container was never created.
If the file exists but we have trouble opening it then we throw some
exception.
MT - single thread required - Enforced by cache manager.
openContainer
in class FileContainer
StandardException
- Standard exception policy.protected void stubbify(LogInstant instant) throws StandardException
StandardException
public java.lang.Object run() throws StandardException
run
in interface java.security.PrivilegedExceptionAction
StandardException
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |