Writing a CSBEClient for Restore

This section describes the recommended conn::CSBEClient function calls for a partial and incremental restore.

Context

A partial restore restores the data of specified data owners. The Security IDs (SIDs) of the specified data owners must be passed to the Backup Engine.

An incremental restore restores files that are saved in the previous incremental backup. After each incremental backup, a snapshot, which saves the file list and details of each data owner, is saved. Before each incremental restore, the previously saved backup snapshots must be provided to the Backup Engine.

Steps

  1. The user application must instantiate conn::CSBEClient to connect to the Backup Engine.

    iRestoreClient = CSBEClient::NewL();
  2. Supply the list of data owners got from the host PC to the Backup Engine.

    To restore the data of specified data owners, pass the array of the SID of these data owners to the Backup Engine.

    iRestoreClient->SetSIDListForPartialBURL(RSIDArray& aSIDs);
  3. Set the Back Engine to the restore mode which signals the start of a restore.

    The Backup Engine then publishes the mode to the subscribed data owners. This gives the data owners some time to prepare for the restore, for example they can release resources in case of file lock or data conflict.

    The mode contains the restore types: full or partial, base or incremental.

    iRestoreClient->SetBURModeL (
                                  const TDriveList& aDriveList,
                                 
                                  //Specify partial restore,
                                  //defined in epoc32/include/connect/sbdefs.h
                                  TBURPartType aBURType,      
    
                                  //Specifiy incremental restore,
                                  //defined in epoc32/include/connect/sbdefs.h
                                  TBackupIncType aBackupIncType
                                );
    
  4. Supply system files to the Backup Engine for restore.

    iRestoreClient ->SupplyDataL(
                                  CSBGenericTransferType& aGenericTransferType,
                                  TBool aFinished
                                 );
  5. Signal that all system files have been restored.

    This step must be invoked to ensure that system files have been released for data owners to use. It triggers the Backup Engine to start data owners for the restore.

    iRestoreClient->AllSystemFilesRestored();
  6. Request the state of active data owners.

    This step ensures that the data owners are ready to supply the data, for example file locks are released.

    iRestoreClient->SIDStatusL(RSIDStatusArray& aSIDStatus);
  7. Supply passive private data and its snapshot to the Backup Engine for restore.

    iRestoreClient->SupplyDataL(
                                 CSBGenericTransferType& aGenericTransferType,
                                 TBool aFinished
                                );

    Note: For more information about creating snapshot transfer types, refer to the Creating transfer types section.

  8. The backup server restores the public files.

    Similar to a backup, the Backup Engine does not restore public files. Device creators must get the public files from the host PC and restore them to the device in their backup server implementations.

  9. Supply active private data to the Backup Engine for restore.

    iRestoreClient->SupplyDataL(
                                 CSBGenericTransferType& aGenericTransferType,
                                 TBool aFinished
                                );
  10. Set the Backup Engine into the normal mode.

    After the data is restored on the device, set the Backup Engine to the normal mode. The subscribed data owners respond to the signal and resume the state before the backup. For example resume file locks or a GUI application recovers to the state and view prior to the restore.

    iRestoreClient->SetBURModeL(
                                 const TDriveList& aDriveList,
                                 TBURPartType aBURType,
                                 TBackupIncType aBackupIncType
                                );