MemMap.h
Go to the documentation of this file.
API for adjusting external state when dirty map slot is being freed.
Definition: MemMap.h:143
virtual void noteFreeMapSlot(const sfileno slotId)=0
adjust slot-linked state before a locked Readable slot is erased
a MemMap basic element, holding basic shareable memory block info
Definition: MemMap.h:34
void set(const unsigned char *aKey, const void *block, size_t blockSize, time_t expire=0)
Definition: MemMap.cc:300
A map of MemMapSlots indexed by their keys, with read/write slot locking.
Definition: MemMap.h:57
void free(const sfileno fileno)
mark the slot as waiting to be freed and, if possible, free it
Definition: MemMap.cc:138
void updateStats(ReadWriteLockStats &stats) const
adds approximate current stats to the supplied ones
Definition: MemMap.cc:236
void abortWriting(const sfileno fileno)
terminate writing the entry, freeing its slot for others to use
Definition: MemMap.cc:114
int slotIndexByKey(const cache_key *const key) const
Definition: MemMap.cc:262
void freeLocked(Slot &s, bool keepLocked)
unconditionally frees the already exclusively locked slot and releases lock
Definition: MemMap.cc:276
Slot * openForReading(Slot &s)
void closeForReading(const sfileno fileno)
close slot after reading, decrements read level
Definition: MemMap.cc:207
void freeIfNeeded(Slot &s)
const Slot * openForReading(const cache_key *const key, sfileno &fileno)
open slot for reading, increments read level
Definition: MemMap.cc:153
void switchWritingToReading(const sfileno fileno)
stop writing the locked entry and start reading it
Definition: MemMap.cc:102
const Slot * openForReadingAt(const sfileno fileno)
open slot for reading, increments read level
Definition: MemMap.cc:174
Slot * openForWriting(const cache_key *const key, sfileno &fileno)
Definition: MemMap.cc:42
static Owner * Init(const char *const path, const int limit)
initialize shared memory
Definition: MemMap.cc:36
void closeForWriting(const sfileno fileno)
successfully finish writing the entry
Definition: MemMap.cc:91
const Slot * peekAtReader(const sfileno fileno) const
only works on locked entries; returns nil unless the slot is readable
Definition: MemMap.cc:125
Slot * openForWritingAt(sfileno fileno, bool overwriteExisting=true)
Definition: MemMap.cc:57
Definition: FlexibleArray.h:27
Definition: Pointer.h:26
Definition: Pointer.h:83
Definition: ReadWriteLock.h:27
std::atomic< bool > writing
there is a writing user (there can be at most 1)
Definition: ReadWriteLock.h:55
Definition: IpcIoFile.h:24
class Ping::pingStats_ stats