History.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_ADAPT_HISTORY_H
10 #define SQUID_ADAPT_HISTORY_H
11 
13 #include "base/RefCount.h"
14 #include "HttpHeader.h"
15 #include "Notes.h"
16 #include "sbuf/SBuf.h"
17 #include "SquidString.h"
18 
19 namespace Adaptation
20 {
21 
23 class History: public RefCountable
24 {
25 public:
27 
28  History();
29 
31  int recordXactStart(const String &serviceId, const timeval &when, bool retrying);
32 
34  void recordXactFinish(int hid);
35 
37  void allLogString(const char *serviceId, SBuf &);
38 
40  void sumLogString(const char *serviceId, SBuf &);
41 
43  void updateXxRecord(const char *name, const String &value);
44 
46  bool getXxRecord(String &name, String &value) const;
47 
49  void updateNextServices(const String &services);
50 
52  bool extractNextServices(String &value);
53 
55  void recordMeta(const HttpHeader *lm);
56 
57  void recordAdaptationService(SBuf &srvId);
58 public:
66 
67  typedef std::vector<SBuf> AdaptationServices;
69 
71  void setFutureServices(const DynamicGroupCfg &services);
72 
74  bool extractFutureServices(DynamicGroupCfg &services);
75 
76 private:
78  class Entry
79  {
80  public:
81  Entry(const String &serviceId, const timeval &when);
82  Entry(); // required by Vector<>
83 
84  void stop();
85  int rptm();
86 
88  timeval start;
89 
90  private:
91  int theRptm;
92 
93  public:
94  bool retried;
95  };
96 
97  typedef std::vector<Entry> Entries;
99 
100  // theXx* will become a map<string,string>, but we only support one record
103 
106 };
107 
108 } // namespace Adaptation
109 
110 #endif
111 
RefCount< Adaptation::History > Pointer
Definition: History.h:26
collects information about adaptations related to a master transaction
Definition: History.h:23
DynamicGroupCfg theFutureServices
services AccessCheck must use
Definition: History.h:105
Entries theEntries
historical record, in the order of xact starts
Definition: History.h:98
HttpHeader lastMeta
Last received meta header (REQMOD or RESPMOD, whichever comes last).
Definition: History.h:60
void recordXactFinish(int hid)
record the end of a xact identified by its history ID
Definition: History.cc:60
void recordAdaptationService(SBuf &srvId)
Definition: History.cc:149
bool extractNextServices(String &value)
returns true, fills the value, and resets iff next services were set
Definition: History.cc:129
int rptm()
returns response time [msec], calculates it if needed
Definition: History.cc:36
Definition: SBuf.h:86
bool getXxRecord(String &name, String &value) const
returns true and fills the record fields iff there is a db record
Definition: History.cc:110
single Xaction stats (i.e., a historical record entry)
Definition: History.h:78
timeval start
when the xaction was started
Definition: History.h:88
void recordMeta(const HttpHeader *lm)
store the last meta header fields received from the adaptation service
Definition: History.cc:139
AdaptationServices theAdaptationServices
The service groups used.
Definition: History.h:68
DynamicServiceGroup configuration to remember future dynamic chains.
String theXxName
name part of the cross-transactional database record
Definition: History.h:101
NotePairs::Pointer metaHeaders
Definition: History.h:65
String theNextServices
services Adaptation::Iterator must use next
Definition: History.h:104
void allLogString(const char *serviceId, SBuf &)
dump individual xaction times to a string
Definition: History.cc:66
HttpHeader allMeta
All REQMOD and RESPMOD meta headers merged. Last field wins conflicts.
Definition: History.h:62
String theXxValue
value part of the cross-xactional database record
Definition: History.h:102
std::vector< Entry > Entries
Definition: History.h:97
std::vector< SBuf > AdaptationServices
Definition: History.h:67
void stop()
updates stats on transaction end
Definition: History.cc:30
int recordXactStart(const String &serviceId, const timeval &when, bool retrying)
record the start of a xact, return xact history ID
Definition: History.cc:50
String service
adaptation service ID
Definition: History.h:87
int theRptm
calculated and cached response time value in msec
Definition: History.h:91
bool retried
whether the xaction was replaced by another
Definition: History.h:94
void updateXxRecord(const char *name, const String &value)
sets or resets a cross-transactional database record
Definition: History.cc:104
void sumLogString(const char *serviceId, SBuf &)
dump xaction times, merging retried and retry times together
Definition: History.cc:82
void setFutureServices(const DynamicGroupCfg &services)
sets future services for the Adaptation::AccessCheck to notice
Definition: History.cc:155
void updateNextServices(const String &services)
sets or resets next services for the Adaptation::Iterator to notice
Definition: History.cc:120
bool extractFutureServices(DynamicGroupCfg &services)
returns true, fills the value, and resets iff future services were set
Definition: History.cc:163

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors