RockDbCell.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_FS_ROCK_DB_CELL_H
10#define SQUID_FS_ROCK_DB_CELL_H
11
12#include "store/forward.h"
13
14namespace Rock
15{
16
23{
24public:
26
28 bool empty() const { return !firstSlot && !nextSlot && !payloadSize; }
29
30 /* members below are not meaningful if empty() */
31
33 bool sane(const size_t slotSize, int slotLimit) const {
34 return
35 0 <= firstSlot && firstSlot < slotLimit &&
36 -1 <= nextSlot && nextSlot < slotLimit &&
37 version > 0 &&
38 0 < payloadSize && payloadSize <= slotSize - sizeof(DbCellHeader);
39 }
40
41 uint64_t key[2];
42 uint64_t entrySize;
43 uint32_t payloadSize;
44 uint32_t version;
47};
48
49} // namespace Rock
50
51#endif /* SQUID_FS_ROCK_DB_CELL_H */
52
uint64_t key[2]
StoreEntry key.
Definition: RockDbCell.h:41
uint64_t entrySize
total entry content size or zero if still unknown
Definition: RockDbCell.h:42
uint32_t version
detects conflicts among same-key entries
Definition: RockDbCell.h:44
bool sane(const size_t slotSize, int slotLimit) const
whether this slot is not corrupted
Definition: RockDbCell.h:33
bool empty() const
true iff no entry occupies this slot
Definition: RockDbCell.h:28
uint32_t payloadSize
slot contents size, always positive
Definition: RockDbCell.h:43
sfileno firstSlot
slot ID of the first slot occupied by the entry
Definition: RockDbCell.h:45
sfileno nextSlot
slot ID of the next slot occupied by the entry
Definition: RockDbCell.h:46
Definition: forward.h:28
signed_int32_t sfileno
Definition: forward.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors