First public contribution.
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef SQLCOMPACTTIMER_H
17 #define SQLCOMPACTTIMER_H
21 //Forward declarations
22 class CSqlCompactTestActive;
23 class CSqlCompactEntry;
26 #define SQLCOMPACTTIMER_INVARIANT() Invariant()
28 #define SQLCOMPACTTIMER_INVARIANT() void(0)
32 A CTimer derived class that performs the background compaction.
33 The CSqlCompactTimer class maintains a queue of CSqlCompactEntry objects waiting to be compacted
35 The class offers methods for adding/removing CSqlCompactEntry objects to/from the queue and a Restart()
36 method that can be used to delay the next compaction step, improving this way the SQL server responsiveness to
39 The CSqlCompactEntry objects needing compaction will be added at the front of the queue.
40 Every time when timer's RunL() method gets executed, the last element from the queue will be picked-up and one
41 compaction step will be performed. When the CSqlCompactEntry object completes the compaction, it will remove
42 itself from the queue.
48 NONSHARABLE_CLASS(CSqlCompactTimer) : protected CTimer
50 friend class CSqlCompactTestActive;
53 static CSqlCompactTimer* NewL(TInt aIntervalMs);
54 virtual ~CSqlCompactTimer();
56 void Queue(CSqlCompactEntry& aEntry);
57 void DeQueue(CSqlCompactEntry& aEntry);
58 void Invariant() const;
61 CSqlCompactTimer(TInt aIntervalMs);
66 TInt iIntervalMicroSec;
67 TSglQue<CSqlCompactEntry> iQueue;
71 #endif//SQLCOMPACTTIMER_H