class RSharedDataClient : public RSessionBase |
RSharedDataClient API ----------------------------------------------------------------------------- Applications use the subsystem via RSharedDataClient class. First, they need to connect to the server by calling Connect() member function.
------------------------------------------------------------------------------ RESERVE FILE SUPPORT ------------------------------------------------------------------------------
This functionality has nothing to do with the rest of SharedData, but is implemented in SharedData server because it is one of the most commonly used servers. The idea is to support transaction-based delete operations to succeed in a full disk situation. SharedData server checks if the free disk space is below the given minimum treshold and if so, reduces the size of a reserve file to free up some disk space. No overhead is caused if there is enough free disk space already. Thus, unless the reserve file is somehow exhausted, the free disk space is guaranteed to be above the given parameter after this call. Of course, the parameter is limited to the maximum size of the reserve file that will be about 140kB.
There are two correct usage patterns represented below, other for synchronous delete operations and other for asynchronous ones.
Note! When the SharedData connection is closed, the server will always assume that the reserve space is no longer required by the corresponding client.
Usage pattern (synchronous delete operation): ------------------------------------------------------------------------------ // iSharedDataClient is connected to the server here.
iSharedDataClient.RequestFreeDiskSpaceLC( KDiskSpaceNeededForDelete );
// Do the delete operation here, the code may leave.
// Do NOT close the SharedData connection here nor delete the // RSharedDataClient object.
CleanupStack::PopAndDestroy() ; // cancels free disk space request ------------------------------------------------------------------------------
Usage pattern (asynchronous delete operation): ------------------------------------------------------------------------------ // iSharedDataClient is connected to the server here.
iSharedDataClient.RequestFreeDiskSpace( KDiskSpaceNeededForDelete );
// Start the asynchronous delete operation here
// Do NOT close the SharedData connection here nor delete the // RSharedDataClient object.
// When the asynchronous request has completed:
iSharedDataClient.CancelFreeDiskSpaceRequest(); ------------------------------------------------------------------------------
Public Member Functions | |
---|---|
RSharedDataClient () | |
IMPORT_C void | CancelFreeDiskSpaceRequest () |
IMPORT_C void | Close () |
IMPORT_C TInt | Connect () |
IMPORT_C void | RequestFreeDiskSpace (const TInt ) |
IMPORT_C void | RequestFreeDiskSpaceLC (const TInt ) |
Private Member Functions | |
---|---|
void | CleanupFreeDiskSpaceRequest ( TAny *) |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes | |
RSessionBase:TAttachMode |
Private Attributes | |
---|---|
CDosWrapper * | iDosWrapper |
Inherited Attributes | |
---|---|
RHandleBase::iHandle |
IMPORT_C | RSharedDataClient | ( | ) |
Constructor.
Use this constructor if you don't use notify methods. User implemented notify handler is set to NULL.
IMPORT_C void | CancelFreeDiskSpaceRequest | ( | ) | const |
Cancels the request made by calling RequestFreeDiskSpace() . In case of RequestFreeDiskSpaceLC() , CleanupStack will handle calling this function.
void | CleanupFreeDiskSpaceRequest | ( | TAny * | aAny | ) | [private, static] |
Cleanup function
TAny * aAny |
IMPORT_C void | Close | ( | ) |
Closes the session. Cancels all notify requests, signals and incoming notifications. Saves the changes if the shared data file was modified. Remember to call this to a connected session in some point.
If the UID is handled by a plugin instead of file, client might need to call Flush() explicitly before Close. Check plugin documentation.
IMPORT_C TInt | Connect | ( | ) |
Starts the server if it's not already running. Creates a new session. If a session is already established by the client, does nothing.
IMPORT_C void | RequestFreeDiskSpace | ( | const TInt | aAmount | ) | const |
Full disk support for asynchronous transactional delete operations. If needed, frees up disk space so that it'll be above the given minimum treshold.
The user is responsible for calling CancelFreeDiskSpaceRequest() after the asynchronous delete operation has been finished.
const TInt aAmount | Requested minimum amount of free disk space in bytes. The max size of the reserve file will be around 64k so there is no use to request higher amounts than that. |
IMPORT_C void | RequestFreeDiskSpaceLC | ( | const TInt | aAmount | ) | const |
Full disk support for synchronous transactional delete operations. If needed, frees up disk space so that it'll be above the given minimum treshold.
Use CleanupStack::PopAndDestroy() to cancel the request after the delete operation.
This method can leave only if CleanupStack::PushL() leaves.
const TInt aAmount | Requested minimum amount of free disk space in bytes. The max size of the reserve file will be around 64k so there is no use to request higher amounts than that. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.