25 max_size(0), min_objsize(-1), max_objsize (-1),
26 path(nullptr), index(-1), disker(-1),
27 repl(nullptr), removals(0), scanned(0),
78 repl->Stats(repl, &output);
106 if (max_objsize > -1)
125 if (
static_cast<uint64_t
>(newMax) > maxSize()) {
127 " which is larger than total cache_dir size of " << maxSize() <<
" bytes.");
128 max_objsize = maxSize();
132 max_objsize = newMax;
147 if (currentSize() >= maxSize())
150 max_size = currentSize();
152 debugs(20,
DBG_IMPORTANT,
"WARNING: Shrinking cache_dir #" << index <<
" to " << currentSize() / 1024.0 <<
" KB");
160 return minObjectSize() <= objsize && objsize <= maxObjectSize();
166 debugs(47,8,
"cache_dir[" << index <<
"]: needs " <<
167 diskSpaceNeeded <<
" <? " << max_objsize);
172 if (!objectSizeIsAcceptable(diskSpaceNeeded))
178 if (currentSize() > maxSize())
269 const bool old_read_only = flags.read_only;
275 value = strchr(name,
'=');
282 debugs(3,2,
"cache_dir " << name <<
'=' << (value ? value :
""));
285 if (!newOption->
parse(name, value, isaReconfig)) {
300 if (old_read_only != flags.read_only) {
301 debugs(3,
DBG_IMPORTANT,
"Cache dir '" << path <<
"' now " << (flags.read_only ?
"No-Store" :
"Read-Write"));
312 newOption->
dump(entry);
320 if (strcmp(option,
"no-store") != 0 && strcmp(option,
"read-only") != 0)
323 if (strcmp(option,
"read-only") == 0) {
324 debugs(3,
DBG_PARSE_NOTE(3),
"UPGRADE WARNING: Replace cache_dir option 'read-only' with 'no-store'.");
330 read_only = (
xatoi(value) != 0);
334 flags.read_only = read_only;
350 if (strcmp(option,
"max-size") == 0) {
352 }
else if (strcmp(option,
"min-size") == 0) {
364 if (isaReconfig && *val !=
size) {
365 if (allowOptionReconfigure(option)) {
367 option <<
" now " <<
size <<
" Bytes");
370 "object " << option <<
" cannot be changed dynamically, " <<
371 "value left unchanged (" << *val <<
" Bytes)");
384 if (min_objsize != -1)
387 if (max_objsize != -1)
int xatoi(const char *token)
std::vector< ConfigOption * > options
virtual void dump(StoreEntry *e) const =0
virtual bool parse(char const *option, const char *value, int reconfiguring)=0
static char * NextToken()
struct SquidConfig::@75 Swap
struct SquidConfig::@88 Store
bool swappedOut() const
whether the entire entry is now on disk (possibly marked for deletion)
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
double capacity
the size limit
double count
number of cached objects
double size
bytes currently in use
High-level store statistics used by mgr:info action. Used inside PODs!
manages a single cache_dir
virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const =0
check whether we can store the entry; if we can, report current load
bool canLog(StoreEntry const &e) const
virtual bool active() const
void create() override
create system resources needed for this store to operate in the future
virtual bool doubleCheck(StoreEntry &)
virtual bool needsDiskStrand() const
needs a dedicated kid process
void parseOptions(int reconfiguring)
bool objectSizeIsAcceptable(int64_t objSize) const
virtual void writeCleanDone()
int64_t minObjectSize() const
the size of the smallest entry this cache_dir can store
char const * type() const
virtual int writeCleanStart()
void dumpOptions(StoreEntry *e) const
virtual void statfs(StoreEntry &) const
void optionReadOnlyDump(StoreEntry *e) const
uint64_t minSize() const override
the minimum size the store will shrink to via normal housekeeping
virtual void logEntry(const StoreEntry &e, int op) const
bool optionObjectSizeParse(char const *option, const char *value, int reconfiguring)
int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
void stat(StoreEntry &) const override
StoreEntry * get(const cache_key *) override
virtual void dump(StoreEntry &) const
virtual ConfigOption * getOptionTree() const
void reference(StoreEntry &e) override
somebody needs this entry (many cache replacement policies need to know)
bool dereference(StoreEntry &e) override
void getStats(StoreInfoStats &stats) const override
collect statistics
struct Store::Disk::@118 fs
void optionObjectSizeDump(StoreEntry *e) const
bool optionReadOnlyParse(char const *option, const char *value, int reconfiguring)
void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
A const & min(A const &lhs, A const &rhs)
#define DBG_PARSE_NOTE(x)
#define debugs(SECTION, LEVEL, CONTENT)
#define EBIT_TEST(flag, bit)
@ RELEASE_REQUEST
prohibits making the key public
unsigned char cache_key
Store key.
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
int64_t strtoll(const char *nptr, char **endptr, int base)