31 static const auto label =
new SBuf(
"transients_map");
63#if TRANSIENT_STATS_SUPPORTED
113 return std::numeric_limits<uint64_t>::max();
134 return std::numeric_limits<uint64_t>::max();
166 debugs(20, 3,
"not joining private " << *oldE);
187 debugs(20, 5,
"found " << *oldE <<
" at " << index <<
" in " <<
MapLabel());
188 assert(oldE->mem_obj && oldE->mem_obj->xitTable.index == index);
205 if (
const auto old =
locals->at(index)) {
284 const auto &anchor =
isWriter(entry) ?
286 entryStatus.
hasWriter = anchor.writing();
354 locals->at(xitTable.index) =
nullptr;
#define Here()
source code location of the caller
static const auto MapLabel
shared memory segment path to use for MemStore maps
#define DefineRunnerRegistrator(ClassName)
static const auto & MapLabel()
shared memory segment path to use for Transients map
Ipc::StoreMap TransientsMap
static void Broadcast(const StoreEntry &e, const bool includingThisWorker=false)
notify other workers about changes in entry state (e.g., new data)
void useConfig() override
std::atomic< uint32_t > readers
number of reading users
ReadWriteLock lock
protects slot data below
aggregates anchor and slice owners for Init() caller convenience
Anchor * openForWriting(const cache_key *const key, sfileno &fileno)
bool markedForDeletion(const cache_key *const)
Anchor & writeableEntry(const AnchorId anchorId)
writeable anchor for the entry created by openForWriting()
const Anchor & readableEntry(const AnchorId anchorId) const
readable anchor for the entry created by openForReading()
int entryCount() const
number of writeable and readable entries
static Owner * Init(const SBuf &path, const int slotLimit)
initialize shared memory
void closeForWriting(const sfileno fileno)
successfully finish creating or updating the entry at fileno pos
const Anchor * openOrCreateForReading(const cache_key *, sfileno &)
openForReading() but creates a new entry if there is no old one
StoreMapCleaner * cleaner
notified before a readable entry is freed
const Anchor * openForReading(const cache_key *const key, sfileno &fileno)
opens entry (identified by key) for reading, increments read level
bool freeEntry(const sfileno)
const Anchor * peekAtWriter(const sfileno fileno) const
void closeForReadingAndFreeIdle(const sfileno fileno)
same as closeForReading() but also frees the entry if it is unlocked
void startAppending(const sfileno fileno)
restrict opened for writing entry to appending operations; allow reads
sfileno fileNoByKey(const cache_key *const key) const
computes map entry anchor position for a given entry key
const Anchor & peekAtEntry(const sfileno fileno) const
void switchWritingToReading(const sfileno fileno)
stop writing (or updating) the locked entry and start reading it
void disableHitValidation()
int entryLimit() const
maximum entryCount() possible
int32_t index
entry position inside the in-transit table
void open(const int32_t anIndex, const Store::IoStatus anIo)
associate our StoreEntry with a Transients entry at the given index
Store::IoStatus io
current I/O state
XitTable xitTable
current [shared] memory caching state for the entry
int64_t shared_transient_entries_limit
YesNoNone memShared
whether the memory cache is shared among workers
bool hasTransients() const
whether there is a corresponding locked transients table entry
bool shared
whether memory cache is shared among workers
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!
Mem mem
all cache_dirs stats
static bool SmpAware()
whether there are any SMP-aware storages
an std::runtime_error with thrower location info
initializes shared memory segment used by Transients
void useConfig() override
TransientsMap::Owner * mapOwner
void create() override
called when the runner should create a new memory segment
shared entry metadata, used for synchronization
bool waitingToBeFreed
whether the entry was marked for deletion
bool hasWriter
whether some worker is storing the entry
int readers(const StoreEntry &e) const
number of entry readers some time ago
StoreEntry * get(const cache_key *) override
bool hasWriter(const StoreEntry &)
whether we or somebody else is in the "writing to Transients" I/O state
void monitorIo(StoreEntry *, const cache_key *, const Store::IoStatus)
void addReaderEntry(StoreEntry &, const cache_key *)
void noteFreeMapSlice(const Ipc::StoreMapSliceId sliceId) override
adjust slice-linked state before a locked Readable slice is erased
TransientsMap * map
shared packed info indexed by Store keys, for creating new StoreEntries
void addWriterEntry(StoreEntry &, const cache_key *)
addEntry() helper used for cache entry creators/writers
bool isWriter(const StoreEntry &) const
whether the entry is in "writing to Transients" I/O state
void disconnect(StoreEntry &)
the caller is done writing or reading the given entry
StoreEntry * findCollapsed(const sfileno xitIndex)
return a local, previously collapsed entry
void getStats(StoreInfoStats &stats) const override
collect statistics
int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
void stat(StoreEntry &e) const override
void addEntry(StoreEntry *, const cache_key *, const Store::IoStatus)
creates a new Transients entry
bool markedForDeletion(const cache_key *) const
void evictCached(StoreEntry &) override
void status(const StoreEntry &e, EntryStatus &entryStatus) const
copies current shared entry metadata into entryStatus
uint64_t minSize() const override
the minimum size the store will shrink to via normal housekeeping
void reference(StoreEntry &e) override
somebody needs this entry (many cache replacement policies need to know)
uint64_t maxSize() const override
bool dereference(StoreEntry &e) override
void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
static int64_t EntryLimit()
calculates maximum number of entries we need to store and map
bool isReader(const StoreEntry &) const
whether the entry is in "reading from Transients" I/O state
uint64_t currentSize() const override
current size
void completeWriting(const StoreEntry &e)
called when the in-transit entry has been successfully cached
uint64_t currentCount() const override
the total number of objects stored right now
std::vector< StoreEntry * > Locals
void evictIfFound(const cache_key *) override
static bool Enabled()
Can we create and initialize Transients?
#define debugs(SECTION, LEVEL, CONTENT)
#define EBIT_TEST(flag, bit)
size_t PageLevel()
approximate total number of shared memory pages used now
size_t PageSize()
returns page size in bytes; all pages are assumed to be the same size
size_t PageLimit()
the total number of shared memory pages that can be in use at any time
double doublePercent(const double, const double)
IoStatus
cache "I/O" direction and status
unsigned char cache_key
Store key.
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)