9#ifndef SQUID_SRC_STORE_H
10#define SQUID_SRC_STORE_H
121 void setPrivateKey(
const bool shareable,
const bool permanent);
139 const char *
url()
const;
159 void dump(
int debug_lvl)
const;
184 bool modifiedSince(
const time_t ims,
const int imslen = -1)
const;
250 void *
operator new(
size_t byteCount);
251 void operator delete(
void *address);
258 void lock(
const char *context);
262 int unlock(
const char *context);
274 void release(
const bool shareable =
false);
296 void append(
char const *,
int)
override;
297 void vappendf(
const char *, va_list)
override;
299 void flush()
override;
RemovalPolicy * REMOVALPOLICYCREATE(wordlist *args)
void storeHeapPositionUpdate(StoreEntry *, SwapDir *)
void storeEntryReplaceObject(StoreEntry *, HttpReply *)
StoreIoStats store_io_stats
void storeSwapFileNumberSet(StoreEntry *e, sfileno filn)
void(* STOREGETCLIENT)(StoreEntry *, void *cbdata)
std::ostream & operator<<(std::ostream &os, const StoreEntry &e)
int32_t index
entry position inside the memory cache
Decision
Decision states for StoreEntry::swapoutPossible() and related code.
int32_t index
entry position inside the in-transit table
XitTable xitTable
current [shared] memory caching state for the entry
const HttpReply & freshestReply() const
MemCache memCache
current [shared] memory caching state for the entry
int64_t endOffset() const
const HttpReply & baseReply() const
void storeWritingCheckpoint()
int locks() const
returns a local concurrent use counter, for debugging
void completeSuccessfully(const char *whyWeAreSureWeStoredTheWholeReply)
void hashInsert(const cache_key *)
void doAbandon(const char *context)
size_t bytesWanted(Range< size_t > const aRange, bool ignoreDelayPool=false) const
void unregisterAbortCallback(const char *reason)
const cache_key * calcPublicKey(const KeyScope keyScope)
bool swappedOut() const
whether the entire entry is now on disk (possibly marked for deletion)
bool shareableWhenPrivate
StoreEntry * adjustVary()
unsigned short lock_count
bool hasIfMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-Match etags
void setCollapsingRequirement(const bool required)
allow or forbid collapsed requests feeding
const char * getSerialisedMetaData(size_t &length) const
void ensureMemObject(const char *storeId, const char *logUri, const HttpRequestMethod &aMethod)
initialize mem_obj (if needed) and set URIs/method (if missing)
bool hasIfNoneMatchEtag(const HttpRequest &request) const
has ETag matching at least one of the If-None-Match etags
void dump(int debug_lvl) const
void checkDisk() const
does nothing except throwing if disk-associated data members are inconsistent
void completeTruncated(const char *whyWeConsiderTheReplyTruncated)
int unlock(const char *context)
bool hasMemStore() const
whether there is a corresponding locked shared memory table entry
time_t lastModified() const
Store::EntryGuard EntryGuard
bool hasEtag(ETag &etag) const
whether this entry has an ETag; if yes, puts ETag value into parameter
void lastModified(const time_t when)
void release(const bool shareable=false)
bool memoryCachable()
checkCachable() and can be cached in memory
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
swap_status_t swap_status
bool hasParsedReplyHeader() const
whether this entry has access to [deserialized] [HTTP] response headers
void write(StoreIOBuffer)
void lock(const char *context)
bool checkDeferRead(int fd) const
void swapOutDecision(const MemObject::SwapOut::Decision &decision)
bool makePublic(const KeyScope keyScope=ksDefault)
void clearPublicKeyScope()
const cache_key * publicKey() const
void memOutDecision(const bool willCacheInRam)
void abandon(const char *context)
bool swappingOut() const
whether we are in the process of writing this entry to disk
void lengthWentBad(const char *reason)
flags [truncated or too big] entry with ENTRY_BAD_LENGTH and releases it
bool updateOnNotModified(const StoreEntry &e304)
time_t lastModified_
received Last-Modified value or -1; use lastModified()
void registerAbortCallback(const AsyncCall::Pointer &)
notify the StoreEntry writer of a 3rd-party initiated StoreEntry abort
const char * describeTimestamps() const
Store::Disk & disk() const
the disk this entry is [being] cached on; asserts for entries w/o a disk
bool mayStartSwapOut()
whether we may start writing to disk (now or in the future)
friend std::ostream & operator<<(std::ostream &os, const StoreEntry &e)
void forcePublicKey(const cache_key *newkey)
void storeErrorResponse(HttpReply *reply)
Store a prepared error response. MemObject locks the reply object.
bool mayStartHitting() const
const char * getMD5Text() const
const MemObject & mem() const
sfileno swap_filen
unique ID inside a cache_dir for swapped out entries; -1 for others
void storeWriterDone()
called when a store writer ends its work (successfully or not)
void setPrivateKey(const bool shareable, const bool permanent)
void makePrivate(const bool shareable)
int checkNegativeHit() const
void attachToDisk(const sdirno, const sfileno, const swap_status_t)
void kickProducer()
calls back producer registered with deferProducer
AsyncCall::Pointer deferredProducer
producer callback registered with deferProducer
static size_t inUseCount()
void replaceHttpReply(const HttpReplyPointer &, const bool andStartWriting=true)
bool hasOneOfEtags(const String &reqETags, const bool allowWeakMatch) const
whether at least one of the request ETags matches entity ETag
void vappendf(const char *, va_list) override
ping_status_t ping_status
void setNoDelay(bool const)
void cacheInMemory()
start or continue storing in memory cache
bool modifiedSince(const time_t ims, const int imslen=-1) const
void append(char const *, int) override
Appends a c-string to existing packed data.
void trimMemory(const bool preserveSwappable)
int64_t objectLen() const
store_status_t store_status
void releaseRequest(const bool shareable=false)
store_client_t storeClientType() const
static Mem::Allocator * pool
void touch()
update last reference timestamp and related Store metadata
int64_t contentLen() const
bool swapoutFailed() const
whether we failed to write this entry to disk
bool setPublicKey(const KeyScope keyScope=ksDefault)
void deferProducer(const AsyncCall::Pointer &producer)
call back producer when more buffer space is available
const HttpReply * hasFreshestReply() const
bool hasTransients() const
whether there is a corresponding locked transients table entry
void swapOutFileClose(int how)
bool hittingRequiresCollapsing() const
whether this entry can feed collapsed requests and only them
void setMemStatus(mem_status_t)
Store statistics related to low-level I/O.
manages a single cache_dir
Entry * entry_
the guarded Entry or nil
const char * context_
default unlock() message
EntryGuard(EntryGuard &&)=delete
EntryGuard(Entry *entry, const char *context)
void onException() noexcept
void unlockAndReset(const char *resetContext=nullptr)
#define PRINTF_FORMAT_ARG2
#define EBIT_TEST(flag, bit)
@ ENTRY_REQUIRES_COLLAPSING
enum _mem_status_t mem_status_t
swap_status_t
StoreEntry relationship with a disk cache.
void Maintain(void *unused)
void Stats(StoreEntry *output)
const char * storeEntryFlags(const StoreEntry *entry)
unsigned char cache_key
Store key.
int expiresMoreThan(time_t expires, time_t when)
void storeGetMemSpace(int size)
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
void storeConfigure(void)
void storeAppendVPrintf(StoreEntry *e, const char *fmt, va_list vargs)
int storeTooManyDiskFilesOpen(void)
StoreEntry * storeGetPublicByRequestMethod(HttpRequest *req, const HttpRequestMethod &method, const KeyScope keyScope)
StoreEntry * storeGetPublicByRequest(HttpRequest *req, const KeyScope keyScope)
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
StoreEntry * storeGetPublic(const char *uri, const HttpRequestMethod &method)
StoreEntry * storeCreatePureEntry(const char *url, const char *log_url, const HttpRequestMethod &method)
void storeReplAdd(const char *type, REMOVALPOLICYCREATE *create)
static const char * storeId(const int i)