RStoreReclaim Class Reference

#include <s32stor.h>

class RStoreReclaim
Public Member Functions
RStoreReclaim()
TInt Available()
voidClose()
IMPORT_C voidCompactL(CStreamStore &, TInt &)
IMPORT_C voidCompactLC(CStreamStore &, TInt &)
IMPORT_C voidNext(TPckgBuf< TInt > &, TRequestStatus &)
IMPORT_C TIntNext(TInt &)
IMPORT_C voidNextL(TInt &)
IMPORT_C voidNextL(TPckgBuf< TInt > &, TRequestStatus &)
IMPORT_C voidOpenL(CStreamStore &, TInt &)
IMPORT_C voidOpenLC(CStreamStore &, TInt &)
IMPORT_C voidRelease()
IMPORT_C voidResetL(TInt &)

Detailed Description

Performs space reclamation or compaction on a permanent file store in incremental steps.

Reclaiming unused space makes it available for re-use by the store. Compacting makes unused space available for re-use by the relevant system pool for example, the filing system in the case of file-based stores.

Once compaction is complete, the store must be committed.

Notes:

Space reclamation and compaction are only supported by the file store CPermanentFileStore and are not supported by embedded or direct file stores.

Use active objects when implementing space reclamation or compaction asynchronously.

This class performs incremental compaction/reclamation. These operations can be performed in a possibly long running single step using CStreamStore functions.

Constructor & Destructor Documentation

RStoreReclaim ( )

RStoreReclaim()[inline]

Member Function Documentation

Available ( )

TInt Available()const [inline]

Returns the amount of free space currently available within the store. The function may be called at any time during space reclamation or compaction.

Returns: The amount of free space currently available within the store.

Close ( )

voidClose()[inline]

Stops space reclamation or compaction. All allocated resources are freed.

Notes:

If a cleanup item was placed on the cleanup stack when the RStoreReclaim object was prepared for space reclamation or compaction (i.e. by a call to OpenLC() or CompactLC()), then this function need not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy().

The ResetL() member function can be used to restart abandoned space reclamation or compaction activity.

CompactL ( CStreamStore &, TInt & )

IMPORT_C voidCompactL(CStreamStore &aStore,
TInt &aCount
)

Prepares the object to perform compaction.

Streams must be closed before calling this function.

ParameterDescription
aStoreA reference to the store on which space reclamation or compaction is to be performed.
aCountA reference to a control value set by these functions. This value is required by all variants of Next() and NextL() (and ResetL(), if used).

CompactLC ( CStreamStore &, TInt & )

IMPORT_C voidCompactLC(CStreamStore &aStore,
TInt &aCount
)

Prepares the object to perform compaction, putting a cleanup item onto the cleanup stack.

P lacing a cleanup item for the object onto the cleanup stack allows allocated resources to be cleaned up if a subsequent leave occurs.

Streams must be closed before calling this function.

ParameterDescription
aStoreA reference to the store on which space reclamation or compaction is to be performed.
aCountA reference to a control value set by these functions. This value is required by all variants of Next() and NextL() (and ResetL(), if used).

Next ( TPckgBuf< TInt > &, TRequestStatus & )

IMPORT_C voidNext(TPckgBuf< TInt > &aStep,
TRequestStatus &aStatus
)

Initiates the next space reclamation or compaction step asynchronous, non-leaving. The function updates the value in aStep, and should only be called while aStep is non-zero. Once this value is zero, no further calls should be made.

The step itself is performed asynchronously.

Note:

The RStoreReclaim object should be made part of an active object to simplify the handling of the step completion event.

ParameterDescription
aStepA reference to a control value constructed from a TInt value originally set by OpenL(), OpenLC(), CompactL() or CompactLC().aStep is updated by calls to Next() or NextL().
aStatusOn completion, contains the request status. If successful contains KErrNone. If the function fails during the initiation phase, the failure is reported as if the step had started successfully but completed with that error.

Next ( TInt & )

IMPORT_C TIntNext(TInt &aStep)

Performs the next space reclamation or compaction step synchronous, non-leaving. The function updates the value in aStep, and should only be called while aStep is non-zero. Once this value is zero, no further calls should be made.

The step is performed synchronously, i.e. the function does not return until the step is complete.

ParameterDescription
aStepA reference to a control value originally set by OpenL(), OpenLC(), CompactL() or CompactLC() and updated by calls to Next() or NextL().

Returns: KErrNone if successful, otherwise another of the system-wide error codes.

NextL ( TInt & )

IMPORT_C voidNextL(TInt &aStep)

Performs the next space reclamation or compaction step synchronous, leaves. The function updates the value in aStep, and should only be called while aStep is non-zero. Once this value is zero, no further calls should be made.

The step is performed synchronously, i.e. the function does not return until the step is complete.

ParameterDescription
aStepA reference to a control value originally set by OpenL(), OpenLC(), CompactL() or CompactLC() and updated by calls to Next() or NextL().

NextL ( TPckgBuf< TInt > &, TRequestStatus & )

IMPORT_C voidNextL(TPckgBuf< TInt > &aStep,
TRequestStatus &aStatus
)

Initiates the next space reclamation or compaction step asynchronous, leaving. The function updates the value in aStep, and should only be called while aStep is non-zero. Once this value is zero, no further calls should be made.

The step itself is performed asynchronously.

Note:

The RStoreReclaim object should be made part of an active object to simplify the handling of the step completion event.

ParameterDescription
aStepA reference to a control value constructed from a TInt value originally set by OpenL(), OpenLC(), CompactL() or CompactLC().aStep is updated by calls to Next() or NextL().
aStatusOn completion, contains the request status. If successful contains KErrNone. If the function fails during the initiation phase, the failure is reported as if the step had started successfully but completed with that error.

OpenL ( CStreamStore &, TInt & )

IMPORT_C voidOpenL(CStreamStore &aStore,
TInt &aCount
)

Prepares the object to perform space reclamation.

ParameterDescription
aStoreA reference to the store on which space reclamation or compaction is to be performed.
aCountA reference to a control value set by these functions. This value is required by all variants of Next() and NextL() (and ResetL(), if used).

OpenLC ( CStreamStore &, TInt & )

IMPORT_C voidOpenLC(CStreamStore &aStore,
TInt &aCount
)

Prepares the object to perform space reclamation and puts a pointer onto the cleanup stack.

Placing a cleanup item for the object onto the cleanup stack allows allocated resources to be cleaned up if a subsequent leave occurs.

ParameterDescription
aStoreA reference to the store on which space reclamation or compaction is to be performed.
aCountA reference to a control value set by these functions. This value is required by all variants of Next() and NextL() (and ResetL(), if used).

Release ( )

IMPORT_C voidRelease()

Releases allocated resources. Any space reclamation or compaction in progress is abandoned.

Notes:

If a cleanup item was placed on the cleanup stack when the RStoreReclaim object was prepared for space reclamation or compaction (i.e. by a call to OpenLC() or CompactLC()), then this function need not be called explicitly; clean up is implicitly done by CleanupStack::PopAndDestroy().

The ResetL() member function can be used to restart abandoned space reclamation or compaction activity.

ResetL ( TInt & )

IMPORT_C voidResetL(TInt &aCount)

Restarts space reclamation or compaction.

The value in aCount must be:

that which was set by the most recent call to Next() or NextL(), if space reclamation or compaction had been started.

that which was set by OpenL(), OpenLC(), CompactL() or CompactLC(), if space reclamation or compaction had not been started.

ParameterDescription
aCountA reference to a control value originally set by OpenL(), OpenLC(), CompactL() or CompactLC() and updated by subsequent calls to Next() or NextL().