store.cc
Go to the documentation of this file.
279 debugs(20,7, mem_obj << " lo: " << mem_obj->inmem_lo << " hi: " << mem_obj->endOffset() << " size: " << mem_obj->object_sz);
341{
412 debugs(20, 3, "StoreEntry::hashInsert: Inserting Entry " << *this << " key '" << storeKeyText(someKey) << "'");
496storeGetPublicByRequestMethod(HttpRequest * req, const HttpRequestMethod& method, const KeyScope keyScope)
665 if (!request->vary_headers.isEmpty() && request->vary_headers.cmp(mem_obj->vary_headers) != 0) {
683 StoreEntry *pe = storeCreateEntry(mem_obj->storeId(), mem_obj->logUri(), request->flags, request->method);
694 rep->setHeaders(Http::scOkay, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
745storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod& method)
775 debugs(20, 5, "storeWrite: writing " << writeBuffer.length << " bytes for '" << getMD5Text() << "'");
780 debugs(20, 3, "allow Store clients to get entry content after buffering too much for " << *this);
1227 debugs(20, 3, "storeEntryValidLength: " << (diff < 0 ? -diff : diff) << " bytes too " << (diff < 0 ? "big" : "small") <<"; '" << getMD5Text() << "'" );
1236 Mgr::RegisterAction("store_io", "Store IO Interface Stats", &Mgr::StoreIoAction::Create, 0, 1);
1568StoreEntry::createMemObject(const char *aUrl, const char *aLogUrl, const HttpRequestMethod &aMethod)
1575StoreEntry::ensureMemObject(const char *aUrl, const char *aLogUrl, const HttpRequestMethod &aMethod)
1638 debugs(20, DBG_IMPORTANT, "WARNING: Trying to load store replacement policy " << type << " twice.");
1644 storerepl_list = static_cast<storerepl_entry_t *>(xrealloc(storerepl_list, (i + 2) * sizeof(storerepl_entry_t)));
bool etagIsWeakEqual(const ETag &tag1, const ETag &tag2)
whether etags are weak-equal
Definition: ETag.cc:55
bool etagIsStrongEqual(const ETag &tag1, const ETag &tag2)
whether etags are strong-equal
Definition: ETag.cc:49
RemovalPolicy * REMOVALPOLICYCREATE(wordlist *args)
Definition: RemovalPolicy.h:80
int strListGetItem(const String *str, char del, const char **item, int *ilen, const char **pos)
Definition: StrList.cc:86
int strListIsMember(const String *list, const SBuf &m, char del)
Definition: StrList.cc:46
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:63
static void StatQueue(std::ostream &)
prints IPC message queue state; suitable for cache manager reports
Definition: CollapsedForwarding.cc:165
struct timeval store_complete_stop
Definition: HierarchyLogEntry.h:67
bool peerResponseTime(struct timeval &responseTime)
Definition: access_log.cc:265
Definition: HttpReply.h:25
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
Definition: HttpReply.cc:170
Pointer recreateOnNotModified(const HttpReply &reply304) const
Definition: HttpReply.cc:265
Definition: RequestMethod.h:27
Definition: HttpRequest.h:49
SBuf vary_headers
The variant second-stage cache key. Generated from Vary header pattern for this request.
Definition: HttpRequest.h:170
static void StatQueue(std::ostream &)
prints IPC message queue state; suitable for cache manager reports
Definition: IpcIoFile.cc:548
Decision
Decision states for StoreEntry::swapoutPossible() and related code.
Definition: MemObject.h:165
Definition: MemObject.h:34
void replaceBaseReply(const HttpReplyPointer &r)
Definition: MemObject.cc:128
AsyncCallPointer abortCallback
used for notifying StoreEntry writers about 3rd-party initiated aborts
Definition: MemObject.h:219
void markEndOfReplyHeaders()
sets baseReply().hdr_sz (i.e. written reply headers size) to endOffset()
Definition: MemObject.cc:220
int mostBytesWanted(int max, bool ignoreDelayPools) const
Definition: MemObject.cc:415
void setUris(char const *aStoreId, char const *aLogUri, const HttpRequestMethod &aMethod)
Definition: MemObject.cc:76
const char * logUri() const
client request URI used for logging; storeId() by default
Definition: MemObject.cc:64
static bool Enabled()
whether Squid is correctly configured to use a shared memory cache
Definition: MemStore.h:68
Definition: Allocator.h:22
int getInUseCount() const
the difference between the number of alloc() and freeOne() calls
Definition: Allocator.h:59
static Pointer Create(const CommandPointer &cmd)
Definition: StoreIoAction.cc:36
Definition: PackableStream.h:76
Definition: Range.h:19
Definition: RemovalPolicy.h:20
Definition: RemovalPolicy.h:39
void(* Add)(RemovalPolicy *policy, StoreEntry *entry, RemovalPolicyNode *node)
Definition: RemovalPolicy.h:46
void(* Remove)(RemovalPolicy *policy, StoreEntry *entry, RemovalPolicyNode *node)
Definition: RemovalPolicy.h:47
Definition: RequestFlags.h:23
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:275
struct SquidConfig::@106 onoff
struct SquidConfig::@104 Store
Definition: Store.h:42
void completeSuccessfully(const char *whyWeAreSureWeStoredTheWholeReply)
Definition: store.cc:1003
size_t bytesWanted(Range< size_t > const aRange, bool ignoreDelayPool=false) const
Definition: store.cc:212
void unregisterAbortCallback(const char *reason)
Definition: store.cc:1475
const cache_key * calcPublicKey(const KeyScope keyScope)
Definition: store.cc:638
bool swappedOut() const
whether the entire entry is now on disk (possibly marked for deletion)
Definition: Store.h:136
bool hasIfMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-Match etags
Definition: store.cc:1859
void setCollapsingRequirement(const bool required)
allow or forbid collapsed requests feeding
Definition: store.cc:1999
const char * getSerialisedMetaData(size_t &length) const
Definition: store.cc:1736
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:1575
bool hasIfNoneMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-None-Match etags
Definition: store.cc:1866
void checkDisk() const
does nothing except throwing if disk-associated data members are inconsistent
Definition: store.cc:1948
void completeTruncated(const char *whyWeConsiderTheReplyTruncated)
Definition: store.cc:1010
bool hasMemStore() const
whether there is a corresponding locked shared memory table entry
Definition: Store.h:213
bool hasEtag(ETag &etag) const
whether this entry has an ETag; if yes, puts ETag value into parameter
Definition: store.cc:1848
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition: store.cc:1915
void swapOutDecision(const MemObject::SwapOut::Decision &decision)
Definition: store.cc:1786
bool swappingOut() const
whether we are in the process of writing this entry to disk
Definition: Store.h:134
void lengthWentBad(const char *reason)
flags [truncated or too big] entry with ENTRY_BAD_LENGTH and releases it
Definition: store.cc:995
bool updateOnNotModified(const StoreEntry &e304)
Definition: store.cc:1438
void registerAbortCallback(const AsyncCall::Pointer &)
notify the StoreEntry writer of a 3rd-party initiated StoreEntry abort
Definition: store.cc:1467
Store::Disk & disk() const
the disk this entry is [being] cached on; asserts for entries w/o a disk
Definition: store.cc:1906
void storeErrorResponse(HttpReply *reply)
Store a prepared error response. MemObject locks the reply object.
Definition: store.cc:1674
sfileno swap_filen
unique ID inside a cache_dir for swapped out entries; -1 for others
Definition: Store.h:236
void storeWriterDone()
called when a store writer ends its work (successfully or not)
Definition: store.cc:1794
void setPrivateKey(const bool shareable, const bool permanent)
Definition: store.cc:534
void attachToDisk(const sdirno, const sfileno, const swap_status_t)
Definition: store.cc:1926
AsyncCall::Pointer deferredProducer
producer callback registered with deferProducer
Definition: Store.h:335
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
Definition: store.cc:1691
bool hasOneOfEtags(const String &reqETags, const bool allowWeakMatch) const
whether at least one of the request ETags matches entity ETag
Definition: store.cc:1877
bool modifiedSince(const time_t ims, const int imslen=-1) const
Definition: store.cc:1822
void append(char const *, int) override
Appends a c-string to existing packed data.
Definition: store.cc:789
bool setPublicKey(const KeyScope keyScope=ksDefault)
Definition: store.cc:561
void deferProducer(const AsyncCall::Pointer &producer)
call back producer when more buffer space is available
Definition: store.cc:352
bool hasTransients() const
whether there is a corresponding locked transients table entry
Definition: Store.h:211
bool hittingRequiresCollapsing() const
whether this entry can feed collapsed requests and only them
Definition: Store.h:216
Definition: StoreIOBuffer.h:16
void noteStoppedSharedWriting(StoreEntry &)
adjust shared state after this worker stopped changing the entry
Definition: Controller.cc:625
void addWriting(StoreEntry *, const cache_key *)
Definition: Controller.cc:761
void handleIdleEntry(StoreEntry &)
called when the entry is no longer needed by any transaction
Definition: Controller.cc:646
void freeMemorySpace(const int spaceRequired)
Definition: Controller.cc:530
void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
Definition: Controller.cc:92
void memoryDisconnect(StoreEntry &)
disassociates the entry from the memory cache, preserving cached data
Definition: Controller.cc:617
void transientsDisconnect(StoreEntry &)
disassociates the entry from the intransit table
Definition: Controller.cc:639
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
Definition: Controller.h:134
virtual void disconnect(StoreEntry &)
called when the entry is about to forget its association with cache_dir
Definition: Disk.h:71
Definition: Store.h:353
void unlockAndReset(const char *resetContext=nullptr)
Definition: Store.h:380
Definition: SquidString.h:26
enum _mem_status_t mem_status_t
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
hash_table * store_table
int store_open_disk_fd
int neighbors_do_private_keys
int hot_obj_count
int64_t store_maxobjsize
int RESERVED_FD
SQUIDCEXTERN void hash_remove_link(hash_table *, hash_link *)
Definition: hash.cc:220
SBuf httpMakeVaryMark(HttpRequest *request, HttpReply const *reply)
Definition: http.cc:588
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
AllocedBuf PackSwapMeta(const StoreEntry &, size_t &size)
Definition: SwapMetaOut.cc:77
void storeReplSetup(void)
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
static std::ostream & operator<<(std::ostream &os, const Store::IoStatus &io)
Definition: store.cc:2012
static void StatQueues(StoreEntry *e)
reports the current state of Store-related queues
Definition: store.cc:133
struct _store_check_cachable_hist store_check_cachable_hist
void storeAppendVPrintf(StoreEntry *e, const char *fmt, va_list vargs)
Definition: store.cc:851
StoreEntry * storeGetPublicByRequestMethod(HttpRequest *req, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store.cc:496
StoreEntry * storeGetPublicByRequest(HttpRequest *req, const KeyScope keyScope)
Definition: store.cc:502
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:745
StoreEntry * storeGetPublic(const char *uri, const HttpRequestMethod &method)
Definition: store.cc:490
StoreEntry * storeCreatePureEntry(const char *url, const char *log_url, const HttpRequestMethod &method)
Definition: store.cc:727
RemovalPolicy * createRemovalPolicy(RemovalPolicySettings *settings)
Definition: store.cc:1657
void storeReplAdd(const char *type, REMOVALPOLICYCREATE *create)
Definition: store.cc:1631
static void storeRegisterWithCacheManager(void)
Definition: store.cc:1233
const cache_key * storeKeyPublicByRequest(HttpRequest *request, const KeyScope keyScope)
Definition: store_key_md5.cc:110
const cache_key * storeKeyPublic(const char *url, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store_key_md5.cc:95
const cache_key * storeKeyPublicByRequestMethod(HttpRequest *request, const HttpRequestMethod &method, const KeyScope keyScope)
Definition: store_key_md5.cc:116
HASHCMP storeKeyHashCmp
Definition: store.cc:856
struct _store_check_cachable_hist::@137 yes
struct _store_check_cachable_hist::@136 no
Definition: store.cc:104
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17