RSharedDataClient Class Reference

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(); ------------------------------------------------------------------------------

Inherits from

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 Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RSessionBase::CreateSession(RServer2,const TVersion &)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *)
RSessionBase::Open(RMessagePtr2,TInt,TOwnerType)
RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Open(TInt,TOwnerType)
RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Send(TInt)const
RSessionBase::Send(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt)const
RSessionBase::SendReceive(TInt,TRequestStatus &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSessionBase::SetReturnedHandle(TInt)
RSessionBase::SetReturnedHandle(TInt,RHandleBase &)
RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &)
RSessionBase::ShareAuto()
RSessionBase::ShareProtected()
Inherited Enumerations
RHandleBase:TAttributes
RSessionBase:TAttachMode
Private Attributes
CDosWrapper * iDosWrapper
Inherited Attributes
RHandleBase::iHandle

Constructor & Destructor Documentation

RSharedDataClient()

IMPORT_C RSharedDataClient ( )

Constructor.

Use this constructor if you don't use notify methods. User implemented notify handler is set to NULL.

Member Functions Documentation

CancelFreeDiskSpaceRequest()

IMPORT_C void CancelFreeDiskSpaceRequest ( ) const

Cancels the request made by calling RequestFreeDiskSpace() . In case of RequestFreeDiskSpaceLC() , CleanupStack will handle calling this function.

CleanupFreeDiskSpaceRequest(TAny *)

void CleanupFreeDiskSpaceRequest ( TAny * aAny ) [private, static]

Cleanup function

Parameters

TAny * aAny

Close()

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.

Connect()

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.

RequestFreeDiskSpace(const TInt)

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.

Parameters

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.

RequestFreeDiskSpaceLC(const TInt)

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.

Parameters

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.

Member Data Documentation

CDosWrapper * iDosWrapper

CDosWrapper * iDosWrapper [private]