store.cc
Go to the documentation of this file.
293 debugs(20,7, mem_obj << " lo: " << mem_obj->inmem_lo << " hi: " << mem_obj->endOffset() << " size: " << mem_obj->object_sz);
426 debugs(20, 3, "StoreEntry::hashInsert: Inserting Entry " << *this << " key '" << storeKeyText(someKey) << "'");
510 storeGetPublicByRequestMethod(HttpRequest * req, const HttpRequestMethod& method, const KeyScope keyScope)
679 if (!request->vary_headers.isEmpty() && request->vary_headers.cmp(mem_obj->vary_headers) != 0) {
697 StoreEntry *pe = storeCreateEntry(mem_obj->storeId(), mem_obj->logUri(), request->flags, request->method);
708 rep->setHeaders(Http::scOkay, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
759 storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod& method)
789 debugs(20, 5, "storeWrite: writing " << writeBuffer.length << " bytes for '" << getMD5Text() << "'");
794 debugs(20, 3, "allow Store clients to get entry content after buffering too much for " << *this);
1241 debugs(20, 3, "storeEntryValidLength: " << (diff < 0 ? -diff : diff) << " bytes too " << (diff < 0 ? "big" : "small") <<"; '" << getMD5Text() << "'" );
1250 Mgr::RegisterAction("store_io", "Store IO Interface Stats", &Mgr::StoreIoAction::Create, 0, 1);
1582 StoreEntry::createMemObject(const char *aUrl, const char *aLogUrl, const HttpRequestMethod &aMethod)
1589 StoreEntry::ensureMemObject(const char *aUrl, const char *aLogUrl, const HttpRequestMethod &aMethod)
1652 debugs(20, DBG_IMPORTANT, "WARNING: Trying to load store replacement policy " << type << " twice.");
1658 storerepl_list = static_cast<storerepl_entry_t *>(xrealloc(storerepl_list, (i + 2) * sizeof(storerepl_entry_t)));
void memoryDisconnect(StoreEntry &)
disassociates the entry from the memory cache, preserving cached data
Definition: Controller.cc:609
void noteStoppedSharedWriting(StoreEntry &)
adjust shared state after this worker stopped changing the entry
Definition: Controller.cc:617
Definition: store.cc:105
HASHCMP storeKeyHashCmp
AllocedBuf PackSwapMeta(const StoreEntry &, size_t &size)
Definition: SwapMetaOut.cc:77
const cache_key * storeKeyPublicByRequest(HttpRequest *request, const KeyScope keyScope)
Definition: store_key_md5.cc:110
void storeReplAdd(const char *type, REMOVALPOLICYCREATE *create)
Definition: store.cc:1645
bool updateOnNotModified(const StoreEntry &e304)
Definition: store.cc:1452
void ensureMemObject(const char *storeId, const char *logUri, const HttpRequestMethod &aMethod)
initialize mem_obj (if needed) and set URIs/method (if missing)
Definition: store.cc:1589
void unregisterAbortCallback(const char *reason)
Definition: store.cc:1489
Definition: Store.h:349
void checkDisk() const
does nothing except throwing if disk-associated data members are inconsistent
Definition: store.cc:1961
static bool Enabled()
whether Squid is correctly configured to use a shared memory cache
Definition: MemStore.h:68
Definition: RemovalPolicy.h:19
const cache_key * storeKeyPublic(const char *url, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store_key_md5.cc:95
int mostBytesWanted(int max, bool ignoreDelayPools) const
Definition: MemObject.cc:415
void append(char const *, int) override
Appends a c-string to existing packed data.
Definition: store.cc:803
void setPrivateKey(const bool shareable, const bool permanent)
Definition: store.cc:548
static std::ostream & operator<<(std::ostream &os, const Store::IoStatus &io)
Definition: store.cc:2025
bool setPublicKey(const KeyScope keyScope=ksDefault)
Definition: store.cc:575
bool etagIsStrongEqual(const ETag &tag1, const ETag &tag2)
whether etags are strong-equal
Definition: ETag.cc:49
struct SquidConfig::@97 onoff
struct _store_check_cachable_hist store_check_cachable_hist
bool etagIsWeakEqual(const ETag &tag1, const ETag &tag2)
whether etags are weak-equal
Definition: ETag.cc:55
int hot_obj_count
Definition: PackableStream.h:75
static void storeRegisterWithCacheManager(void)
Definition: store.cc:1247
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
Definition: store.cc:1705
struct _store_check_cachable_hist::@128 yes
int store_open_disk_fd
Definition: Allocator.h:21
StoreEntry * storeGetPublicByRequest(HttpRequest *req, const KeyScope keyScope)
Definition: store.cc:516
SBuf httpMakeVaryMark(HttpRequest *request, HttpReply const *reply)
Definition: http.cc:589
StoreEntry * storeGetPublicByRequestMethod(HttpRequest *req, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store.cc:510
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:63
void replaceBaseReply(const HttpReplyPointer &r)
Definition: MemObject.cc:128
void storeReplSetup(void)
const char * getSerialisedMetaData(size_t &length) const
Definition: store.cc:1750
void addWriting(StoreEntry *, const cache_key *)
Definition: Controller.cc:753
const char * logUri() const
client request URI used for logging; storeId() by default
Definition: MemObject.cc:64
Definition: Range.h:18
enum _mem_status_t mem_status_t
int getInUseCount() const
the difference between the number of alloc() and freeOne() calls
Definition: Allocator.h:59
Definition: HttpRequest.h:48
void transientsDisconnect(StoreEntry &)
disassociates the entry from the intransit table
Definition: Controller.cc:631
virtual void disconnect(StoreEntry &)
called when the entry is about to forget its association with cache_dir
Definition: Disk.h:71
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:18
struct timeval store_complete_stop
Definition: HierarchyLogEntry.h:56
Definition: StoreIOBuffer.h:15
int strListIsMember(const String *list, const SBuf &m, char del)
Definition: StrList.cc:46
bool hasIfNoneMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-None-Match etags
Definition: store.cc:1880
Definition: RequestFlags.h:22
static void StatQueues(StoreEntry *e)
reports the current state of Store-related queues
Definition: store.cc:134
bool hasOneOfEtags(const String &reqETags, const bool allowWeakMatch) const
whether at least one of the request ETags matches entity ETag
Definition: store.cc:1891
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition: store.cc:1929
AsyncCallPointer abortCallback
used for notifying StoreEntry writers about 3rd-party initiated aborts
Definition: MemObject.h:212
void setCollapsingRequirement(const bool required)
allow or forbid collapsed requests feeding
Definition: store.cc:2012
Definition: RequestMethod.h:26
Definition: store.cc:870
AsHex< Integer > asHex(const Integer n)
a helper to ease AsHex object creation
Definition: IoManip.h:169
bool hasMemStore() const
whether there is a corresponding locked shared memory table entry
Definition: Store.h:212
bool peerResponseTime(struct timeval &responseTime)
Definition: access_log.cc:239
static void StatQueue(std::ostream &)
prints IPC message queue state; suitable for cache manager reports
Definition: CollapsedForwarding.cc:165
struct SquidConfig::@95 Store
int neighbors_do_private_keys
Definition: SquidString.h:25
Definition: RemovalPolicy.h:38
void swapOutDecision(const MemObject::SwapOut::Decision &decision)
Definition: store.cc:1800
RemovalPolicy * createRemovalPolicy(RemovalPolicySettings *settings)
Definition: store.cc:1671
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
SBuf vary_headers
The variant second-stage cache key. Generated from Vary header pattern for this request.
Definition: HttpRequest.h:170
void(* Remove)(RemovalPolicy *policy, StoreEntry *entry, RemovalPolicyNode *node)
Definition: RemovalPolicy.h:47
hash_table * store_table
AsyncCall::Pointer deferredProducer
producer callback registered with deferProducer
Definition: Store.h:331
void unlockAndReset(const char *resetContext=nullptr)
Definition: Store.h:376
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
Definition: Controller.h:133
size_t bytesWanted(Range< size_t > const aRange, bool ignoreDelayPool=false) const
Definition: store.cc:213
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:759
int64_t store_maxobjsize
void completeSuccessfully(const char *whyWeAreSureWeStoredTheWholeReply)
Definition: store.cc:1017
Definition: MemObject.h:33
Definition: HttpReply.h:24
void markEndOfReplyHeaders()
sets baseReply().hdr_sz (i.e. written reply headers size) to endOffset()
Definition: MemObject.cc:220
Definition: Store.h:37
void(* Add)(RemovalPolicy *policy, StoreEntry *entry, RemovalPolicyNode *node)
Definition: RemovalPolicy.h:46
Decision
Decision states for StoreEntry::swapoutPossible() and related code.
Definition: MemObject.h:165
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:279
const cache_key * calcPublicKey(const KeyScope keyScope)
Definition: store.cc:652
void storeAppendVPrintf(StoreEntry *e, const char *fmt, va_list vargs)
Definition: store.cc:865
void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
Definition: Controller.cc:87
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
Definition: Registration.cc:54
void handleIdleEntry(StoreEntry &)
called when the entry is no longer needed by any transaction
Definition: Controller.cc:638
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
int RESERVED_FD
bool hasTransients() const
whether there is a corresponding locked transients table entry
Definition: Store.h:210
StoreEntry * storeGetPublic(const char *uri, const HttpRequestMethod &method)
Definition: store.cc:504
static void StatQueue(std::ostream &)
prints IPC message queue state; suitable for cache manager reports
Definition: IpcIoFile.cc:548
const cache_key * storeKeyPublicByRequestMethod(HttpRequest *request, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store_key_md5.cc:116
Store::Disk & disk() const
the disk this entry is [being] cached on; asserts for entries w/o a disk
Definition: store.cc:1920
static Pointer Create(const CommandPointer &cmd)
Definition: StoreIoAction.cc:36
StoreEntry * storeCreatePureEntry(const char *url, const char *log_url, const HttpRequestMethod &method)
Definition: store.cc:741
void freeMemorySpace(const int spaceRequired)
Definition: Controller.cc:522
void attachToDisk(const sdirno, const sfileno, const swap_status_t)
Definition: store.cc:1940
void deferProducer(const AsyncCall::Pointer &producer)
call back producer when more buffer space is available
Definition: store.cc:366
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
Definition: HttpReply.cc:170
bool hittingRequiresCollapsing() const
whether this entry can feed collapsed requests and only them
Definition: Store.h:215
RemovalPolicy * REMOVALPOLICYCREATE(wordlist *args)
Definition: RemovalPolicy.h:80
bool hasParsedReplyHeader() const
whether this entry has access to [deserialized] [HTTP] response headers
Definition: store.cc:231
void lengthWentBad(const char *reason)
flags [truncated or too big] entry with ENTRY_BAD_LENGTH and releases it
Definition: store.cc:1009
void registerAbortCallback(const AsyncCall::Pointer &)
notify the StoreEntry writer of a 3rd-party initiated StoreEntry abort
Definition: store.cc:1481
bool swappingOut() const
whether we are in the process of writing this entry to disk
Definition: Store.h:133
bool swappedOut() const
whether the entire entry is now on disk (possibly marked for deletion)
Definition: Store.h:135
bool modifiedSince(const time_t ims, const int imslen=-1) const
Definition: store.cc:1836
void storeWriterDone()
called when a store writer ends its work (successfully or not)
Definition: store.cc:1808
bool hasIfMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-Match etags
Definition: store.cc:1873
bool hasEtag(ETag &etag) const
whether this entry has an ETag; if yes, puts ETag value into parameter
Definition: store.cc:1862
void setUris(char const *aStoreId, char const *aLogUri, const HttpRequestMethod &aMethod)
Definition: MemObject.cc:76
void completeTruncated(const char *whyWeConsiderTheReplyTruncated)
Definition: store.cc:1024
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
void storeErrorResponse(HttpReply *reply)
Store a prepared error response. MemObject locks the reply object.
Definition: store.cc:1688
int strListGetItem(const String *str, char del, const char **item, int *ilen, const char **pos)
Definition: StrList.cc:78
struct _store_check_cachable_hist::@127 no
sfileno swap_filen
unique ID inside a cache_dir for swapped out entries; -1 for others
Definition: Store.h:235
Pointer recreateOnNotModified(const HttpReply &reply304) const
Definition: HttpReply.cc:265
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products