~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/adaptation/History.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2009-09-24 14:51:06 UTC
  • mfrom: (1.1.12 upstream)
  • mto: (20.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090924145106-38jgrzmj0d73pha5
Tags: 3.1.0.13-1
* Upload to experimental

* New upstream release
  - Fixes Follow-X-Forwarded-For support (Closes: #523943)
  - Adds IPv6 support (Closes: #432351)

* debian/rules
  - Removed obsolete configuration options
  - Enable db and radius basic authentication modules

* debian/patches/01-cf.data.debian
  - Adapted to new upstream version

* debian/patches/02-makefile-defaults
  - Adapted to new upstream version

* debian/{squid.postinst,squid.rc,README.Debian,watch}
  - Updated references to squid 3.1

* debian/squid3.install
  - Install CSS file for error pages
  - Install manual pages for new authentication modules

* debian/squid3-common.install
  - Install documented version of configuration file in /usr/share/doc/squid3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SQUID_ADAPT_HISTORY_H
 
2
#define SQUID_ADAPT_HISTORY_H
 
3
 
 
4
#include "RefCount.h"
 
5
#include "Array.h"
 
6
#include "SquidString.h"
 
7
 
 
8
namespace Adaptation {
 
9
 
 
10
 
 
11
/// collects information about adaptations related to a master transaction
 
12
class History: public RefCountable {
 
13
public:
 
14
    typedef RefCount<Adaptation::History> Pointer;
 
15
 
 
16
    History();
 
17
 
 
18
    /// record the start of a xact, return xact history ID
 
19
    int recordXactStart(const String &serviceId, const timeval &when, bool retrying);
 
20
 
 
21
    /// record the end of a xact identified by its history ID
 
22
    void recordXactFinish(int hid);
 
23
 
 
24
    /// dump individual xaction times to a string
 
25
    void allLogString(const char *serviceId, String &buf);
 
26
 
 
27
    /// dump xaction times, merging retried and retry times together
 
28
    void sumLogString(const char *serviceId, String &buf);
 
29
 
 
30
    /// sets or resets a cross-transactional database record
 
31
    void updateXxRecord(const char *name, const String &value);
 
32
 
 
33
    /// returns true and fills the record fields iff there is a db record
 
34
    bool getXxRecord(String &name, String &value) const;
 
35
 
 
36
    /// sets or resets next services for the Adaptation::Iterator to notice
 
37
    void updateNextServices(const String &services);
 
38
 
 
39
    /// returns true, fills the value, and resets iff next services were set
 
40
    bool extractNextServices(String &value);
 
41
 
 
42
private:
 
43
    /// single Xaction stats (i.e., a historical record entry)
 
44
    class Entry {
 
45
    public:
 
46
        Entry(const String &serviceId, const timeval &when);
 
47
        Entry(); // required by Vector<>
 
48
 
 
49
        void stop(); ///< updates stats on transaction end
 
50
        int rptm(); ///< returns response time [msec], calculates it if needed
 
51
 
 
52
        String service; ///< adaptation service ID
 
53
        timeval start; ///< when the xaction was started
 
54
 
 
55
    private:
 
56
        int theRptm; ///< calculated and cached response time value in msec
 
57
 
 
58
    public:
 
59
        bool retried; ///< whether the xaction was replaced by another
 
60
    };
 
61
    
 
62
    typedef Vector<Entry> Entries;  
 
63
    Entries theEntries; ///< historical record, in the order of xact starts
 
64
 
 
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
 
68
 
 
69
    String theNextServices; ///< services Adaptation::Iterator must use next
 
70
};
 
71
 
 
72
} // namespace Adaptation
 
73
 
 
74
#endif