|
1 /* |
|
2 * Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: data struct for all volumes |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_RSFWVOLUMETABLE_H |
|
19 #define C_RSFWVOLUMETABLE_H |
|
20 |
|
21 #include <e32property.h> |
|
22 #include <f32file.h> |
|
23 |
|
24 #include "rsfwlruprioritylist.h" |
|
25 |
|
26 class CRsfwRfeServer; |
|
27 class CRsfwConfig; |
|
28 class TRsfwMountInfo; |
|
29 class TRsfwMountConfig; |
|
30 class TRsfwMountStatus; |
|
31 class CRsfwVolume; |
|
32 class TTime; |
|
33 class CRsfwMountStateMachine; |
|
34 class CRsfwWaitNoteManager; |
|
35 class CRsfwMountStore; |
|
36 class CRsfwDormantMountLoader; |
|
37 |
|
38 /** caching mode */ |
|
39 enum TCachingMode |
|
40 { |
|
41 EWholeFileCaching, |
|
42 EMetadataIfa, |
|
43 EFullIfa |
|
44 }; |
|
45 |
|
46 /** theoretical maximum number of volumes - A to Z */ |
|
47 const TInt KMaxVolumes = 26; |
|
48 |
|
49 |
|
50 /** Shutdown after all mounts have become dormant/disconnected */ |
|
51 const TInt KRsfwDormantShutdownTimeout = 120; |
|
52 |
|
53 class CRsfwVolumeTable: public CBase |
|
54 { |
|
55 public: |
|
56 static CRsfwVolumeTable* NewL(CRsfwRfeServer* aRfeServer, |
|
57 CRsfwConfig* aRsfwConfig); |
|
58 ~CRsfwVolumeTable(); |
|
59 |
|
60 void DispatchL(TAny* aIp, TAny* aOp); |
|
61 TInt VolumeIdByDriveLetter(TChar aDriveLetter); |
|
62 CRsfwVolume* VolumeByVolumeId(TInt aVolumeId); |
|
63 CRsfwVolume* VolumeByDriveLetter(TChar aDriveLetter); |
|
64 void RestoreDormantMountsL(); |
|
65 TUint RecoverVolumeL(const TRsfwMountConfig& aMountConfig, |
|
66 CRsfwMountStateMachine* aCaller); |
|
67 TInt MountState(TChar aDriveLetter); |
|
68 TInt GetMountConfigL(TRsfwMountConfig& aMountConfig); |
|
69 void RestoreVolumesL(); |
|
70 void DismountByVolumeIdL(TInt aVolumeId, TBool aDiscardPermanentData); |
|
71 void DismountByDriveLetterL(TChar aDriveLetter, |
|
72 TBool aDiscardPermanentData); |
|
73 void GetMountList(TDriveList& aMountList); |
|
74 TInt GetMountInfo(TRsfwMountInfo& aMountInfo); |
|
75 void GetMimeTypeSpecificLimits(); |
|
76 |
|
77 // Cache management functions |
|
78 TBool EnsureCacheCanBeAddedL(TInt aBytes); |
|
79 TBool EnsureMetadataCanBeAddedL(CRsfwFileEntry* aParent); |
|
80 TBool IsRoot(const CRsfwFileEntry* aEntry); |
|
81 TInt TotalCachedSize(); |
|
82 TInt TotalEntryCount(); |
|
83 void AddToLRUPriorityListL(CRsfwFileEntry *aFe, TInt aPriority); |
|
84 void RemoveFromLRUPriorityList(CRsfwFileEntry *aFe); |
|
85 void AddToMetadataLRUPriorityListL(CRsfwFileEntry *aFe, TInt aPriority); |
|
86 void RemoveFromMetadataLRUPriorityList(CRsfwFileEntry *aFe); |
|
87 void MoveToTheBackOfMetadataLRUPriorityListL(CRsfwFileEntry *aFe); |
|
88 void WillLRUPriorityListBeInternalized(); |
|
89 TBool CheckAndAddProcessStartMarker(); |
|
90 void DeleteTheMarker(); |
|
91 void CleanupCorruptedCacheL(); |
|
92 void OperationCompleted(CRsfwVolume* aVolume); |
|
93 void VolumeStateChanged(CRsfwVolume* aVolume); |
|
94 CRsfwWaitNoteManager* WaitNoteManager(); |
|
95 TBool IsCachedDataStillValid(TTime aCachedTime); |
|
96 TBool IsCachedAttrStillValid(TTime aCachedTime); |
|
97 |
|
98 // removes from cache all the data for certain path |
|
99 // this is "refresh", i.e to ensure that next readdir fetches the data |
|
100 // form server |
|
101 TInt PurgeFromCache(TDesC& aCachePath); |
|
102 |
|
103 TInt CancelTransferL(TDesC& aFilePath); |
|
104 |
|
105 void MountDormantL(const TRsfwMountConfig& aMountConfig, TInt aVolumeId); |
|
106 |
|
107 void PublishConnectionStatus(CRsfwVolume* aVolume); |
|
108 |
|
109 private: |
|
110 void ConstructL(CRsfwRfeServer* aRfeServer, CRsfwConfig* aRsfwConfig); |
|
111 TBool IsCacheStillValid(TTime aCachedTime, TTimeIntervalSeconds aValidity); |
|
112 void ExternalizeLRUPriorityList(); |
|
113 void ExternalizeLRUPriorityListL(); |
|
114 void InternalizeLRUPriorityListL(); |
|
115 TBool IsMountIdle(TRsfwMountStatus& aMountStatus); |
|
116 |
|
117 public: |
|
118 // configuration parameters read from the configuration file |
|
119 TInt iMaxCacheSize; // maximum allowed cache size (global) |
|
120 TInt iMaxEntryCount; // maximum number of cached entries (global) |
|
121 |
|
122 TCachingMode iCachingMode; |
|
123 TInt iRecognizerLimit; |
|
124 TInt iImageJpegLimit; |
|
125 TInt iAudioMpegLimit; |
|
126 TInt iInactivityTimeout; |
|
127 |
|
128 public: |
|
129 CRsfwVolume* iVolumes[KMaxVolumes]; // alphabet |
|
130 TInt iLastVolumeId; |
|
131 CRsfwConfig* iRsfwConfig; // RSC configuration |
|
132 |
|
133 TBool iPermanence; // use permanent meta data |
|
134 CRsfwMountStore* iMountStore; // mount configuration repository |
|
135 CRsfwLruPriorityList iLRUPriorityList; |
|
136 CRsfwLruPriorityList iMetadataLRUPriorityList; |
|
137 CRsfwRfeServer* iRfeServer; |
|
138 TBool iUseExternalizedLRUList; // whether to use externalized LRU list data or not |
|
139 TBool iDormantMountRestorePending; // true when, after server startup, we start to restore mounts |
|
140 |
|
141 private: |
|
142 CRsfwDormantMountLoader* iDormantMountLoader; // loads dormant mounts asynchronously shortly after server start |
|
143 CRsfwWaitNoteManager* iWaitNoteManager; // Implements handling of global wait notes |
|
144 // associated with this class because when we come to Connect(), not much else is available |
|
145 |
|
146 TBool iAllEnginesIdle; // are all the engines idle |
|
147 RProperty iMountStateProperty; // property for connection state signaling |
|
148 TInt iFileCacheTimeout; // how long cached files are assumed to be valid |
|
149 TInt iDirCacheTimeout; // how long cached dirs are assumed to be valid |
|
150 |
|
151 // these are also available from TRfeEnv, but they are used so many times |
|
152 // by this class that an own pointer is justified |
|
153 RFs iFs; // handle to RFs session, owned by RfeServer |
|
154 TFileName* iCacheRoot; // pointer to cacheroot, owned by RfeServer |
|
155 }; |
|
156 |
|
157 |
|
158 #endif |