History.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_ADAPTATION_HISTORY_H
10 #define SQUID_SRC_ADAPTATION_HISTORY_H
11 
13 #include "adaptation/forward.h"
14 #include "base/RefCount.h"
15 #include "HttpHeader.h"
16 #include "Notes.h"
17 #include "sbuf/SBuf.h"
18 #include "SquidString.h"
19 
20 namespace Adaptation
21 {
22 
24 class History: public RefCountable
25 {
26 public:
28 
29  History();
30 
32  int recordXactStart(const String &serviceId, const timeval &when, bool retrying);
33 
35  void recordXactFinish(int hid);
36 
38  void allLogString(const char *serviceId, SBuf &);
39 
41  void sumLogString(const char *serviceId, SBuf &);
42 
44  void updateXxRecord(const char *name, const String &value);
45 
47  bool getXxRecord(String &name, String &value) const;
48 
50  void updateNextServices(const String &services);
51 
53  bool extractNextServices(String &value);
54 
56  void recordMeta(const HttpHeader *lm);
57 
58  void recordAdaptationService(SBuf &srvId);
59 public:
67 
68  typedef std::vector<SBuf> AdaptationServices;
70 
72  void setFutureServices(const DynamicGroupCfg &services);
73 
76 
77 private:
79  class Entry
80  {
81  public:
82  Entry(const String &serviceId, const timeval &when);
83  Entry(); // required by Vector<>
84 
85  void stop();
86  int rptm();
87 
89  timeval start;
90 
91  private:
92  int theRptm;
93 
94  public:
95  bool retried;
96  };
97 
98  typedef std::vector<Entry> Entries;
100 
101  // theXx* will become a map<string,string>, but we only support one record
104 
107 };
108 
109 } // namespace Adaptation
110 
111 #endif /* SQUID_SRC_ADAPTATION_HISTORY_H */
112 
timeval start
when the xaction was started
Definition: History.h:89
int theRptm
calculated and cached response time value in msec
Definition: History.h:92
DynamicGroupCfg extractCurrentServices(const ServiceFilter &)
returns and forgets planned/future services matching the given filter
Definition: History.cc:165
HttpHeader allMeta
All REQMOD and RESPMOD meta headers merged. Last field wins conflicts.
Definition: History.h:63
information used to search for adaptation services
Definition: ServiceFilter.h:22
void updateXxRecord(const char *name, const String &value)
sets or resets a cross-transactional database record
Definition: History.cc:105
String theXxName
name part of the cross-transactional database record
Definition: History.h:102
void updateNextServices(const String &services)
sets or resets next services for the Adaptation::Iterator to notice
Definition: History.cc:121
Definition: SBuf.h:93
bool getXxRecord(String &name, String &value) const
returns true and fills the record fields iff there is a db record
Definition: History.cc:111
DynamicServiceGroup configuration to remember future dynamic chains.
AdaptationServices theAdaptationServices
The service groups used.
Definition: History.h:69
void recordXactFinish(int hid)
record the end of a xact identified by its history ID
Definition: History.cc:61
bool extractNextServices(String &value)
returns true, fills the value, and resets iff next services were set
Definition: History.cc:130
void stop()
updates stats on transaction end
Definition: History.cc:31
String service
adaptation service ID
Definition: History.h:88
NotePairs::Pointer metaHeaders
Definition: History.h:66
void allLogString(const char *serviceId, SBuf &)
dump individual xaction times to a string
Definition: History.cc:67
RefCount< Adaptation::History > Pointer
Definition: History.h:27
String theXxValue
value part of the cross-xactional database record
Definition: History.h:103
void sumLogString(const char *serviceId, SBuf &)
dump xaction times, merging retried and retry times together
Definition: History.cc:83
String theNextServices
services Adaptation::Iterator must use next
Definition: History.h:105
Entries theEntries
historical record, in the order of xact starts
Definition: History.h:99
bool retried
whether the xaction was replaced by another
Definition: History.h:95
int rptm()
returns response time [msec], calculates it if needed
Definition: History.cc:37
void recordAdaptationService(SBuf &srvId)
Definition: History.cc:150
collects information about adaptations related to a master transaction
Definition: History.h:24
std::vector< Entry > Entries
Definition: History.h:98
void recordMeta(const HttpHeader *lm)
store the last meta header fields received from the adaptation service
Definition: History.cc:140
int recordXactStart(const String &serviceId, const timeval &when, bool retrying)
record the start of a xact, return xact history ID
Definition: History.cc:51
DynamicGroupCfg theFutureServices
services AccessCheck must use
Definition: History.h:106
single Xaction stats (i.e., a historical record entry)
Definition: History.h:79
HttpHeader lastMeta
Last received meta header (REQMOD or RESPMOD, whichever comes last).
Definition: History.h:61
void setFutureServices(const DynamicGroupCfg &services)
sets future services for the Adaptation::AccessCheck to notice
Definition: History.cc:156
std::vector< SBuf > AdaptationServices
Definition: History.h:68

 

Introduction

Documentation

Support

Miscellaneous