org.apache.derby.iapi.store.raw.data
Interface DataFactory

All Superinterfaces:
Corruptable
All Known Implementing Classes:
BaseDataFileFactory

public interface DataFactory
extends Corruptable


Field Summary
static java.lang.String DB_EX_LOCKFILE_NAME
           
static java.lang.String DB_LOCKFILE_NAME
          The database lock
static java.lang.String MODULE
           
static java.lang.String TEMP_SEGMENT_NAME
          The temporary segment is called "tmp"
 
Method Summary
 long addAndLoadStreamContainer(RawTransaction t, long segmentId, java.util.Properties tableProperties, RowSource rowSource)
          Create and load a stream container.
 long addContainer(RawTransaction t, long segmentId, long containerid, int mode, java.util.Properties tableProperties, int temporaryFlag)
          Add a container.
 void checkpoint()
           
 void createFinished()
          Database creation finished
 int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset)
          Decrypt cleartext from ciphertext.
 void dropContainer(RawTransaction t, ContainerKey containerId)
           
 void dropStreamContainer(RawTransaction t, long segmentId, long containerId)
          Drop and remove a stream container.
 int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset)
          Encrypt cleartext into ciphertext.
 void freezePersistentStore()
          Backup restore - stop writing dirty pages or container to disk
 long[] getCacheStats(java.lang.String cacheName)
          Get cache statistics for the specified cache
 int getEncryptionBlockSize()
          Return the encryption block size used by the algorithm at time of encrypted database creation
 FileResource getFileHandler()
          Get an object to handle non-transactional files.
 UUID getIdentifier()
          Return the identifier that uniquely identifies this raw store at runtime.
 long getMaxContainerId()
          Return an id which can be used to create a container.
 StorageFactory getStorageFactory()
           
 void idle()
           
 boolean isReadOnly()
          Is the store read-only.
 ContainerHandle openContainer(RawTransaction t, ContainerKey containerId, LockingPolicy locking, int mode)
          Open a container that is not droped.
 RawContainerHandle openDroppedContainer(RawTransaction t, ContainerKey containerId, LockingPolicy locking, int mode)
          Open a container that may have been dropped.
 StreamContainerHandle openStreamContainer(RawTransaction t, long segmentId, long containerId, boolean hold)
          Open a stream container.
 void postRecovery()
          Called after recovery is performed.
 int reclaimSpace(Serviceable work, ContextManager contextMgr)
          Reclaim space used by this factory.
 void reCreateContainerForLoadTran(RawTransaction t, long segmentId, long containerId, ByteArray containerInfo)
          re-Create a container during recovery load tran.
 void removeDroppedContainerFileStubs(LogInstant redoLWM)
          This function is called after a checkpoint to remove the stub files thar are not required during recovery.
 void removeStubsOK()
          Tell the data factory it is OK to remove committed deleted containers when the data factory shuts down.
 void resetCacheStats(java.lang.String cacheName)
          Reset the cache statistics for the specified cache
 void setRawStoreFactory(RawStoreFactory rsf, boolean create, java.util.Properties properties)
          make data factory aware of which raw store factory it belongs to Also need to boot the LogFactory
 void stop()
           
 void unfreezePersistentStore()
          Backup restore - start writing dirty pages or container to disk
 void writeFinished()
          Backup restore - write finished, if this is the last writer, allow the persistent store to proceed.
 void writeInProgress()
          Backup restore - don't allow the persistent store to be frozen - or if it is already frozen, block.
 
Methods inherited from interface org.apache.derby.iapi.store.raw.Corruptable
markCorrupt
 

Field Detail

MODULE

public static final java.lang.String MODULE
See Also:
Constant Field Values

TEMP_SEGMENT_NAME

public static final java.lang.String TEMP_SEGMENT_NAME
The temporary segment is called "tmp"

See Also:
Constant Field Values

DB_LOCKFILE_NAME

public static final java.lang.String DB_LOCKFILE_NAME
The database lock

See Also:
Constant Field Values

DB_EX_LOCKFILE_NAME

public static final java.lang.String DB_EX_LOCKFILE_NAME
See Also:
Constant Field Values
Method Detail

isReadOnly

public boolean isReadOnly()
Is the store read-only.


openContainer

public ContainerHandle openContainer(RawTransaction t,
                                     ContainerKey containerId,
                                     LockingPolicy locking,
                                     int mode)
                              throws StandardException
Open a container that is not droped.

Parameters:
t - the raw transaction that is opening the container
containerId - the container's identity
locking - the locking policy
mode - see the different mode in @see ContainerHandle
Returns:
the handle to the opened container
Throws:
StandardException - Standard Cloudscape error policy

openDroppedContainer

public RawContainerHandle openDroppedContainer(RawTransaction t,
                                               ContainerKey containerId,
                                               LockingPolicy locking,
                                               int mode)
                                        throws StandardException
Open a container that may have been dropped. Only internal raw store code should call this, e.g. recovery.

Throws:
StandardException - Standard Cloudscape error policy
See Also:
openContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.store.raw.ContainerKey, org.apache.derby.iapi.store.raw.LockingPolicy, int)

addContainer

public long addContainer(RawTransaction t,
                         long segmentId,
                         long containerid,
                         int mode,
                         java.util.Properties tableProperties,
                         int temporaryFlag)
                  throws StandardException
Add a container.

Parameters:
t - the transaction that is creating the container
segmentId - the segment where the container is to go
mode - whether or not to LOGGED or not. The effect of this mode is only for this addContainer call, not persisently stored throughout the lifetime of the container
Returns:
the containerId of the newly created container
Throws:
StandardException - Standard Cloudscape Error policy

addAndLoadStreamContainer

public long addAndLoadStreamContainer(RawTransaction t,
                                      long segmentId,
                                      java.util.Properties tableProperties,
                                      RowSource rowSource)
                               throws StandardException
Create and load a stream container.

Parameters:
t - the transaction that is creating the container
segmentId - the segment where the container is to go
rowSource - the data to load the container with
Returns:
the containerId of the newly created stream container
Throws:
StandardException - Standard Cloudscape Error policy

openStreamContainer

public StreamContainerHandle openStreamContainer(RawTransaction t,
                                                 long segmentId,
                                                 long containerId,
                                                 boolean hold)
                                          throws StandardException
Open a stream container.

Returns:
a valid StreamContainerHandle or null if the container does not exist.
Throws:
StandardException - Standard cloudscape exception policy

dropStreamContainer

public void dropStreamContainer(RawTransaction t,
                                long segmentId,
                                long containerId)
                         throws StandardException
Drop and remove a stream container.

Throws:
StandardException - Standard cloudscape exception policy

reCreateContainerForLoadTran

public void reCreateContainerForLoadTran(RawTransaction t,
                                         long segmentId,
                                         long containerId,
                                         ByteArray containerInfo)
                                  throws StandardException
re-Create a container during recovery load tran.

Throws:
StandardException - Standard Cloudscape Error policy

dropContainer

public void dropContainer(RawTransaction t,
                          ContainerKey containerId)
                   throws StandardException
Throws:
StandardException

checkpoint

public void checkpoint()
                throws StandardException
Throws:
StandardException

idle

public void idle()
          throws StandardException
Throws:
StandardException

getIdentifier

public UUID getIdentifier()
Return the identifier that uniquely identifies this raw store at runtime. This identifier is to be used as part of the lokcing key for objects locked in the raw store by value (e.g. Containers).


setRawStoreFactory

public void setRawStoreFactory(RawStoreFactory rsf,
                               boolean create,
                               java.util.Properties properties)
                        throws StandardException
make data factory aware of which raw store factory it belongs to Also need to boot the LogFactory

Throws:
StandardException - cannot boot the log factory

createFinished

public void createFinished()
                    throws StandardException
Database creation finished

Throws:
StandardException - Standard cloudscape exception policy.

getFileHandler

public FileResource getFileHandler()
Get an object to handle non-transactional files.


removeStubsOK

public void removeStubsOK()
Tell the data factory it is OK to remove committed deleted containers when the data factory shuts down.


getCacheStats

public long[] getCacheStats(java.lang.String cacheName)
Get cache statistics for the specified cache


resetCacheStats

public void resetCacheStats(java.lang.String cacheName)
Reset the cache statistics for the specified cache


reclaimSpace

public int reclaimSpace(Serviceable work,
                        ContextManager contextMgr)
                 throws StandardException
Reclaim space used by this factory. Called by post commit daemon.

Throws:
StandardException - Standard cloudscape exception policy

postRecovery

public void postRecovery()
                  throws StandardException
Called after recovery is performed.

Throws:
StandardException - Standard Cloudscape Error Policy

encrypt

public int encrypt(byte[] cleartext,
                   int offset,
                   int length,
                   byte[] ciphertext,
                   int outputOffset)
            throws StandardException
Encrypt cleartext into ciphertext.

Throws:
StandardException - Standard Cloudscape Error Policy
See Also:
CipherProvider.encrypt(byte[], int, int, byte[], int)

decrypt

public int decrypt(byte[] ciphertext,
                   int offset,
                   int length,
                   byte[] cleartext,
                   int outputOffset)
            throws StandardException
Decrypt cleartext from ciphertext.

Throws:
StandardException - Standard Cloudscape Error Policy
See Also:
CipherProvider.decrypt(byte[], int, int, byte[], int)

getEncryptionBlockSize

public int getEncryptionBlockSize()
Return the encryption block size used by the algorithm at time of encrypted database creation


freezePersistentStore

public void freezePersistentStore()
                           throws StandardException
Backup restore - stop writing dirty pages or container to disk

Throws:
StandardException - Standard Cloudscape error policy

unfreezePersistentStore

public void unfreezePersistentStore()
Backup restore - start writing dirty pages or container to disk


writeInProgress

public void writeInProgress()
                     throws StandardException
Backup restore - don't allow the persistent store to be frozen - or if it is already frozen, block. A write is about to commence.

Throws:
StandardException - Standard Cloudscape error policy

writeFinished

public void writeFinished()
Backup restore - write finished, if this is the last writer, allow the persistent store to proceed.


getMaxContainerId

public long getMaxContainerId()
                       throws StandardException
Return an id which can be used to create a container.

Return an id number with is greater than any existing container in the current database. Caller will use this to allocate future container numbers - most likely caching the value and then incrementing it as it is used.

Returns:
The an id which can be used to create a container.
Throws:
StandardException - Standard exception policy.

removeDroppedContainerFileStubs

public void removeDroppedContainerFileStubs(LogInstant redoLWM)
                                     throws StandardException
This function is called after a checkpoint to remove the stub files thar are not required during recovery. Crash recovery uses these files to identify the dropped containers. Stub files(d*.dat) gets creates when a table/index(containers) dropped.

Throws:
StandardException - Standard Cloudscape error policy

getStorageFactory

public StorageFactory getStorageFactory()
Returns:
The StorageFactory used by this dataFactory

stop

public void stop()

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.