]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/adaptation/History.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / History.h
index 93614d75725af9cd4a799289be46dbee5ad1e264..d295c33ff75371c375e8d30f3bd9a234006186cb 100644 (file)
@@ -1,14 +1,24 @@
+/*
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #ifndef SQUID_ADAPT_HISTORY_H
 #define SQUID_ADAPT_HISTORY_H
 
-#include "RefCount.h"
-#include "Array.h"
+#include "adaptation/DynamicGroupCfg.h"
+#include "base/RefCount.h"
+#include "HttpHeader.h"
+#include "Notes.h"
+#include "sbuf/SBuf.h"
 #include "SquidString.h"
 
 namespace Adaptation
 {
 
-
 /// collects information about adaptations related to a master transaction
 class History: public RefCountable
 {
@@ -41,6 +51,28 @@ public:
     /// returns true, fills the value, and resets iff next services were set
     bool extractNextServices(String &value);
 
+    /// store the last meta header fields received from the adaptation service
+    void recordMeta(const HttpHeader *lm);
+
+    void recordAdaptationService(SBuf &srvId);
+public:
+    /// Last received meta header (REQMOD or RESPMOD, whichever comes last).
+    HttpHeader lastMeta;
+    /// All REQMOD and RESPMOD meta headers merged. Last field wins conflicts.
+    HttpHeader allMeta;
+    /// key:value pairs set by adaptation_meta, to be added to
+    /// AccessLogEntry::notes when ALE becomes available
+    NotePairs::Pointer metaHeaders;
+
+    typedef std::vector<SBuf> AdaptationServices;
+    AdaptationServices theAdaptationServices; ///< The service groups used
+
+    /// sets future services for the Adaptation::AccessCheck to notice
+    void setFutureServices(const DynamicGroupCfg &services);
+
+    /// returns true, fills the value, and resets iff future services were set
+    bool extractFutureServices(DynamicGroupCfg &services);
+
 private:
     /// single Xaction stats (i.e., a historical record entry)
     class Entry
@@ -62,7 +94,7 @@ private:
         bool retried; ///< whether the xaction was replaced by another
     };
 
-    typedef Vector<Entry> Entries;
+    typedef std::vector<Entry> Entries;
     Entries theEntries; ///< historical record, in the order of xact starts
 
     // theXx* will become a map<string,string>, but we only support one record
@@ -70,8 +102,10 @@ private:
     String theXxValue; ///< value part of the cross-xactional database record
 
     String theNextServices; ///< services Adaptation::Iterator must use next
+    DynamicGroupCfg theFutureServices; ///< services AccessCheck must use
 };
 
 } // namespace Adaptation
 
 #endif
+