9#ifndef SQUID_SRC_FS_ROCK_ROCKREBUILD_H
10#define SQUID_SRC_FS_ROCK_ROCKREBUILD_H
39 static SBuf Path(
const char *dirPath);
69 void start()
override;
87 void failure(
const char *msg,
int errNo = 0);
102 template <
class SlotIdType>
131 static void Steps(
void *data);
A RegisteredRunner with lifetime determined by forces outside the Registry.
smart StoreEntry-level info pointer (hides anti-padding LoadingParts arrays)
smart db slot-level info pointer (hides anti-padding LoadingParts arrays)
cache_dir indexing statistics shared across same-kid process restarts
static size_t SharedMemorySize()
size_t sharedMemorySize() const
static SBuf Path(const char *dirPath)
static Ipc::Mem::Owner< Stats > * Init(const SwapDir &)
bool completed(const SwapDir &) const
whether the rebuild is finished already
void freeBadEntry(const sfileno fileno, const char *eDescription)
bool doneAll() const override
whether positive goal has been reached
void validateOneSlot(const SlotId slotId)
StoreRebuildData & counts
a reference to the shared memory counters
static void Steps(void *data)
void finalizeOrThrow(const sfileno fileNo, LoadingEntry &le)
void freeSlot(const SlotId slotId, const bool invalid)
adds slot to the free slot index
void primeNewEntry(Ipc::StoreMapAnchor &anchor, const sfileno fileno, const DbCellHeader &header)
initialize housekeeping information for a newly accepted entry
int64_t validationPos
index of the loaded db slot being validated now
void addSlotToEntry(const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
static bool Start(SwapDir &dir)
void mapSlot(const SlotId slotId, const DbCellHeader &header)
adds slot to the entry chain in the map
LoadingEntry loadingEntry(const sfileno fileNo)
virtual void callException(const std::exception &) override
called when the job throws during an async call
LoadingSlot loadingSlot(const SlotId slotId)
void start() override
prepares and initiates entry loading sequence
int64_t dbSlotLimit
total number of db cells
int64_t loadingPos
index of the db slot being loaded from disk now
int64_t dbEntryLimit
maximum number of entries that can be stored in db
void checkpoint()
continues after a pause if not done
MemBuf buf
space to load current db slot (and entry metadata) into
int dbSlotSize
the size of a db cell, including the cell header
void chainSlots(SlotIdType &from, const SlotId to)
void validateOneEntry(const sfileno fileNo)
bool doneValidating() const
bool importEntry(Ipc::StoreMapAnchor &anchor, const sfileno slotId, const DbCellHeader &header)
parse StoreEntry basics and add them to the map, returning true on success
void startNewEntry(const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
handle a slot from an entry that we have not seen before
void failure(const char *msg, int errNo=0)
a helper to handle rebuild-killing I/O errors
LoadingParts * parts
parts of store entries being loaded from disk
SBuf progressDescription() const
static bool IsResponsible(const SwapDir &)
whether the current kid is responsible for rebuilding the given cache_dir
void useNewSlot(const SlotId slotId, const DbCellHeader &header)
handle freshly loaded (and validated) db slot header
bool sameEntry(const sfileno fileno, const DbCellHeader &header) const
does the header belong to the fileno entry being loaded?
Ipc::Mem::Pointer< Stats > stats
indexing statistics in shared memory
void freeUnusedSlot(const SlotId slotId, const bool invalid)
freeSlot() for never-been-mapped slots
void finalizeOrFree(const sfileno fileNo, LoadingEntry &le)
void startShutdown() override
cache_dir(s) indexing statistics
sfileno SlotId
db cell number, starting with cell 0 (always occupied by the db header)