@@ -38,6 +38,13 @@ namespace api
38
38
// ! are that a lot of memory is being used by the temporary
39
39
// ! copy of the data to be persisted.
40
40
// !
41
+ // ! Persistence happens in a background thread and further
42
+ // ! persistence requests via the startBackgroundPersist*() methods
43
+ // ! will be rejected if the background thread is executing.
44
+ // ! However, calls to startBackgroundPersist() and
45
+ // ! startBackgroundPersistIfAppropriate() are not thread safe and
46
+ // ! must not be made concurrently.
47
+ // !
41
48
// ! IMPLEMENTATION DECISIONS:\n
42
49
// ! This class expects to call a persistence function taking
43
50
// ! just the data adder as an argument. It's easy to wrap up
@@ -98,9 +105,15 @@ class API_EXPORT CBackgroundPersister : private core::CNonCopyable
98
105
// ! called.
99
106
bool firstProcessorPeriodicPersistFunc (const TFirstProcessorPeriodicPersistFunc &firstProcessorPeriodicPersistFunc);
100
107
101
- // ! Check whether a background persist is appropriate now, and if it is
102
- // ! then start it by calling the first processor periodic persist
103
- // ! function.
108
+ // ! Start a background persist is one is not running.
109
+ // ! Calls the first processor periodic persist function first.
110
+ // ! Concurrent calls to this method are not threadsafe.
111
+ bool startBackgroundPersist (void );
112
+
113
+ // ! If the periodic persist interval has passed since the last persist
114
+ // ! then it is appropriate to persist now. Start it by calling the
115
+ // ! first processor periodic persist function.
116
+ // ! Concurrent calls to this method are not threadsafe.
104
117
bool startBackgroundPersistIfAppropriate (void );
105
118
106
119
private:
@@ -121,6 +134,10 @@ class API_EXPORT CBackgroundPersister : private core::CNonCopyable
121
134
};
122
135
123
136
private:
137
+ // ! Persist in the background setting the last persist time
138
+ // ! to timeOfPersistence
139
+ bool startBackgroundPersist (core_t ::TTime timeOfPersistence);
140
+
124
141
// ! When this function is called a background persistence will be
125
142
// ! triggered unless there is already one in progress.
126
143
bool startPersist (void );
0 commit comments