1
#ifndef SQUID_ADAPT_HISTORY_H
2
#define SQUID_ADAPT_HISTORY_H
6
#include "SquidString.h"
11
/// collects information about adaptations related to a master transaction
12
class History: public RefCountable {
14
typedef RefCount<Adaptation::History> Pointer;
18
/// record the start of a xact, return xact history ID
19
int recordXactStart(const String &serviceId, const timeval &when, bool retrying);
21
/// record the end of a xact identified by its history ID
22
void recordXactFinish(int hid);
24
/// dump individual xaction times to a string
25
void allLogString(const char *serviceId, String &buf);
27
/// dump xaction times, merging retried and retry times together
28
void sumLogString(const char *serviceId, String &buf);
30
/// sets or resets a cross-transactional database record
31
void updateXxRecord(const char *name, const String &value);
33
/// returns true and fills the record fields iff there is a db record
34
bool getXxRecord(String &name, String &value) const;
36
/// sets or resets next services for the Adaptation::Iterator to notice
37
void updateNextServices(const String &services);
39
/// returns true, fills the value, and resets iff next services were set
40
bool extractNextServices(String &value);
43
/// single Xaction stats (i.e., a historical record entry)
46
Entry(const String &serviceId, const timeval &when);
47
Entry(); // required by Vector<>
49
void stop(); ///< updates stats on transaction end
50
int rptm(); ///< returns response time [msec], calculates it if needed
52
String service; ///< adaptation service ID
53
timeval start; ///< when the xaction was started
56
int theRptm; ///< calculated and cached response time value in msec
59
bool retried; ///< whether the xaction was replaced by another
62
typedef Vector<Entry> Entries;
63
Entries theEntries; ///< historical record, in the order of xact starts
65
// theXx* will become a map<string,string>, but we only support one record
66
String theXxName; ///< name part of the cross-transactional database record
67
String theXxValue; ///< value part of the cross-xactional database record
69
String theNextServices; ///< services Adaptation::Iterator must use next
72
} // namespace Adaptation