42 : active(true), complete(false), comm(comm), app_queue(app_queue), shared_mutator(shared_mutator) {
47 uint32_t first_interval;
52 memcpy(&first_interval, unique_hash, 4);
68 std::lock_guard<std::mutex> lock(
mutex);
76 std::lock_guard<std::mutex> lock(
mutex);
Declarations for TableMutatorIntervalHandler.
Timer handler for periodically flushing a shared mutator.
virtual void handle(EventPtr &event)
Handles the timer interrupt.
bool active
Set to false to deactivate and prevent further timer interrupts.
Po::typed_value< String > * str(String *v=0)
void start()
Starts interval timer.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Comm * comm
Pointer to AsyncComm subsystem.
String generate_guid()
Generates a new GUID.
std::mutex mutex
Mutex for serializing access to members
Compatibility Macros for C/C++.
std::condition_variable cond
Condition variable signalled when complete is set to true
void md5_string(const char *input, char output[33])
Calculates the hex string of MD5 of null terminated input.
TableMutatorIntervalHandler(Comm *comm, ApplicationQueueInterface *app_queue, TableMutatorShared *shared_mutator)
Constructor.
void interval_flush()
Flush if necessary considering the flush interval.
TableMutatorShared * shared_mutator
Shared mutator to be periodically flushed.
bool complete
Indicates if final timer interrupt has completed.
Entry point to AsyncComm service.
void flush()
Flushes shared mutator shared_mutator.
uint32_t flush_interval()
int set_timer(uint32_t duration_millis, const DispatchHandlerPtr &handler)
Sets a timer for duration_millis milliseconds in the future.
A TableMutator that can be shared from multiple threads and incidentally has an option to do periodic...
virtual void add(ApplicationHandler *app_handler)=0
Adds an application handler to queue.
Abstract interface for application queue.
ApplicationQueueInterface * app_queue
Pointer to application queue.
std::shared_ptr< TableMutatorIntervalHandler > TableMutatorIntervalHandlerPtr
Smart pointer to TableMutatorIntervalHandler.