@@ -47,6 +47,13 @@ namespace api
47
47
// ! are that a lot of memory is being used by the temporary
48
48
// ! copy of the data to be persisted.
49
49
// !
50
+ // ! Persistence happens in a background thread and further
51
+ // ! persistence requests via the startBackgroundPersist*() methods
52
+ // ! will be rejected if the background thread is executing.
53
+ // ! However, calls to startBackgroundPersist() and
54
+ // ! startBackgroundPersistIfAppropriate() are not thread safe and
55
+ // ! must not be made concurrently.
56
+ // !
50
57
// ! IMPLEMENTATION DECISIONS:\n
51
58
// ! This class expects to call a persistence function taking
52
59
// ! just the data adder as an argument. It's easy to wrap up
@@ -107,9 +114,15 @@ class API_EXPORT CBackgroundPersister : private core::CNonCopyable
107
114
// ! called.
108
115
bool firstProcessorPeriodicPersistFunc (const TFirstProcessorPeriodicPersistFunc &firstProcessorPeriodicPersistFunc);
109
116
110
- // ! Check whether a background persist is appropriate now, and if it is
111
- // ! then start it by calling the first processor periodic persist
112
- // ! function.
117
+ // ! Start a background persist is one is not running.
118
+ // ! Calls the first processor periodic persist function first.
119
+ // ! Concurrent calls to this method are not threadsafe.
120
+ bool startBackgroundPersist (void );
121
+
122
+ // ! If the periodic persist interval has passed since the last persist
123
+ // ! then it is appropriate to persist now. Start it by calling the
124
+ // ! first processor periodic persist function.
125
+ // ! Concurrent calls to this method are not threadsafe.
113
126
bool startBackgroundPersistIfAppropriate (void );
114
127
115
128
private:
@@ -130,6 +143,10 @@ class API_EXPORT CBackgroundPersister : private core::CNonCopyable
130
143
};
131
144
132
145
private:
146
+ // ! Persist in the background setting the last persist time
147
+ // ! to timeOfPersistence
148
+ bool startBackgroundPersist (core_t ::TTime timeOfPersistence);
149
+
133
150
// ! When this function is called a background persistence will be
134
151
// ! triggered unless there is already one in progress.
135
152
bool startPersist (void );
0 commit comments