]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/store/Storage.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / store / Storage.h
index 00aa4abd0bce73e3bd6a40f504cdc4c48995a2af..909f7f03ecfedd1e6b7ba4a4194dd9bbfbee7167 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -10,7 +10,9 @@
 #define SQUID_STORE_STORAGE_H
 
 #include "base/RefCount.h"
+#include "http/RequestMethod.h"
 #include "store/forward.h"
+#include "store_key_md5.h"
 
 class StoreInfoStats;
 
@@ -21,7 +23,7 @@ namespace Store {
 class Storage: public RefCountable
 {
 public:
-    virtual ~Storage() {}
+    ~Storage() override {}
 
     /// create system resources needed for this store to operate in the future
     virtual void create() = 0;
@@ -30,9 +32,6 @@ public:
     /// use readable() and writable() methods.
     virtual void init() = 0;
 
-    /// Retrieve a store entry from the store (blocking)
-    virtual StoreEntry *get(const cache_key *) = 0;
-
     /**
      * The maximum size the store will support in normal use. Inaccuracy is
      * permitted, but may throw estimates for memory etc out of whack.
@@ -56,15 +55,18 @@ public:
 
     /**
      * Output stats to the provided store entry.
-     \todo make these calls asynchronous
+     * TODO: make these calls asynchronous
      */
     virtual void stat(StoreEntry &e) const = 0;
 
-    /// expect an unlink() call after the entry becomes idle
-    virtual void markForUnlink(StoreEntry &e) = 0;
+    /// Prevent new get() calls from returning the matching entry.
+    /// If the matching entry is unused, it may be removed from the store now.
+    /// The store entry is matched using either `e` attachment info or `e.key`.
+    virtual void evictCached(StoreEntry &e) = 0;
 
-    /// remove the entry from the store
-    virtual void unlink(StoreEntry &e) = 0;
+    /// An evictCached() equivalent for callers that did not get() a StoreEntry.
+    /// Callers with StoreEntry objects must use evictCached() instead.
+    virtual void evictIfFound(const cache_key *) = 0;
 
     /// called once every main loop iteration; TODO: Move to UFS code.
     virtual int callback() { return 0; }
@@ -74,11 +76,6 @@ public:
 
     /// prepare for shutdown
     virtual void sync() {}
-
-    /// whether this storage is capable of serving multiple workers;
-    /// a true result does not imply [lack of] non-SMP support because
-    /// [only] some SMP-aware storages also support non-SMP configss
-    virtual bool smpAware() const = 0;
 };
 
 } // namespace Store