mmappcomponents/harvester/filehandler/inc/mpxharvesterdbmanager.h
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 23 4740b34b83ce
equal deleted inserted replaced
4:d45095c2f4f3 9:bee149131e4b
   120     
   120     
   121     /**
   121     /**
   122      * Checks if the spefified drive is a remove drive
   122      * Checks if the spefified drive is a remove drive
   123      */      
   123      */      
   124     TBool IsRemoteDrive(TDriveNumber aDrive);
   124     TBool IsRemoteDrive(TDriveNumber aDrive);
   125       
   125 
       
   126 #ifdef __RAMDISK_PERF_ENABLE
       
   127     /**
       
   128     * Copy all databases from RAM disk back to normal drive, E, F,...
       
   129     * 
       
   130     * @return none
       
   131     * Leaves if DB is not usable after the operation
       
   132     */
       
   133     void CopyDBsFromRamL(); 
       
   134 
       
   135     /**
       
   136     * Copy all databases to RAM disk from normal drive, E, F,...
       
   137     * 
       
   138     * @return none
       
   139     * Leaves if DB is not usable after the operation
       
   140     */
       
   141     void CopyDBsToRamL(TBool aMtpMode = EFalse);
       
   142 
       
   143     /**
       
   144      * Update all databases from RAM drive
       
   145      */
       
   146     //void UpdateDBsFromRamL( TInt aCount );
       
   147 
       
   148     /**
       
   149      * If Ram disk is low, copy dbs from ram.
       
   150      */
       
   151     void EnsureRamSpaceL();
       
   152 #endif //__RAMDISK_PERF_ENABLE
       
   153 
       
   154 private: // new functions
       
   155     
       
   156 #ifdef __RAMDISK_PERF_ENABLE
       
   157     /**
       
   158     * Find available RAMDISK
       
   159     */
       
   160     TInt GetRAMDiskPath();
       
   161 
       
   162     /**
       
   163     * Check if disk is available to copy.
       
   164     *
       
   165     * @return ETrue if there is enough space, EFalse otherwise
       
   166     */
       
   167     TBool IsRamDiskSpaceAvailable();
       
   168     
       
   169     /**
       
   170      * Copy database to ram drive
       
   171      */
       
   172     void DoCopyDBToRamL(TDriveUnit aDriveUnit);
       
   173     
       
   174     /**
       
   175     * Copy database from RAM disk
       
   176     */
       
   177     void DoCopyDBFromRamL(TDriveUnit aDriveUnit); 
       
   178 
       
   179     /**
       
   180     * To block a disk space so that it can gurantee for a write back from RAM disk
       
   181     *
       
   182     * @return KErrNone if the dummy file is created successfully
       
   183     */
       
   184     TInt BlockDiskSpaceL( TDriveUnit aDrive, TInt aOrigDbSize );
       
   185 
       
   186     /**
       
   187     * To calculate necessary file size of the dummy file
       
   188     *
       
   189     * @return TInt64 estimated file size
       
   190     */
       
   191     TInt64 CalculateInitalDummyDBSizeL( TVolumeInfo aVol, TInt aOrigDbSize );
       
   192 
       
   193     /**
       
   194     * Remove dummy file
       
   195     *
       
   196     * @return TInt index to the database handler
       
   197     */
       
   198     void RemoveDummyFile( TInt aIndex );
       
   199     
       
   200     /**
       
   201      * Update the database from ram drive.
       
   202      */
       
   203     //void DoUpdateDBFromRamL( TDriveUnit aDriveUnit );
       
   204     
       
   205     /**
       
   206      * Generate the harvester db path and name.
       
   207      */
       
   208     TFileName GenerateHarvesterDbName( TDriveUnit aDriveUnit, TBool aForRamDrive = EFalse );
       
   209     
       
   210     /**
       
   211      * Generate the dummy db path and name.
       
   212      */
       
   213     TFileName GenerateDummyDbName( TDriveUnit aDriveUnit );
       
   214 
       
   215     /**
       
   216      * Check if Ram disk is low.
       
   217      */
       
   218     TBool IsRamDiskLow();
       
   219     
       
   220     /**
       
   221      * Sum up the total size in bytes of the databases.
       
   222      * 
       
   223      * @param aSize - On return, the total size of the databases.
       
   224      * @param aRamDrive - if True, will sum up dbs on Ram Drive, if False, will sum up dbs on other drives.
       
   225      * @return TInt System error.
       
   226      */
       
   227     TInt GetTotalDatabasesSize(TInt& aSize, TBool aRamDrive);
       
   228 
       
   229 #endif  // __RAMDISK_PERF_ENABLE
       
   230 
   126 private:
   231 private:
   127 
   232 
   128     /**
   233     /**
   129     * Private constructor
   234     * Private constructor
   130     */
   235     */
   138 private: // data
   243 private: // data
   139     RDbs                             iDBSession;
   244     RDbs                             iDBSession;
   140     RPointerArray<CMPXHarvesterDB>   iDatabases;
   245     RPointerArray<CMPXHarvesterDB>   iDatabases;
   141 
   246 
   142     RFs&                             iFs;   // Not Owned
   247     RFs&                             iFs;   // Not Owned
       
   248 
       
   249 #ifdef __RAMDISK_PERF_ENABLE
       
   250     // Defined for RAM disk performance
       
   251     TBool                   iRAMDiskPerfEnabled;  // flag to indicate RAM disk feature is enabled from cenrep.
       
   252     TUint64                 iMaximumAllowedRAMDiskSpaceToCopy; // max size in megabytes allowed for RAM copying.
       
   253     TFileName               iRAMFolder;
       
   254     TDriveNumber            iRAMDrive;
       
   255     //TInt                    iUpdateCount;
       
   256     TBool                   iMtpMode;
       
   257     //TInt                    iMtpAddCount;
       
   258 #endif //__RAMDISK_PERF_ENABLE
   143     };
   259     };
   144 
   260 
   145 
   261 
   146 #endif // CMPXHARVESTERDBMANAGER_H
   262 #endif // CMPXHARVESTERDBMANAGER_H