]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fs/rock/RockDbCell.h
2 * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_FS_ROCK_DB_CELL_H
10 #define SQUID_FS_ROCK_DB_CELL_H
12 #include "store/forward.h"
18 * Meta-information at the beginning of every db cell.
19 * Links multiple map slots belonging to the same entry into an entry chain.
20 * Stored on disk and used as sizeof() argument so it must remain POD.
27 /// true iff no entry occupies this slot
28 bool empty() const { return !firstSlot
&& !nextSlot
&& !payloadSize
; }
30 /* members below are not meaningful if empty() */
32 /// whether this slot is not corrupted
33 bool sane(const size_t slotSize
, int slotLimit
) const {
35 0 <= firstSlot
&& firstSlot
< slotLimit
&&
36 -1 <= nextSlot
&& nextSlot
< slotLimit
&&
38 0 < payloadSize
&& payloadSize
<= slotSize
- sizeof(DbCellHeader
);
41 uint64_t key
[2]; ///< StoreEntry key
42 uint64_t entrySize
; ///< total entry content size or zero if still unknown
43 uint32_t payloadSize
; ///< slot contents size, always positive
44 uint32_t version
; ///< detects conflicts among same-key entries
45 sfileno firstSlot
; ///< slot ID of the first slot occupied by the entry
46 sfileno nextSlot
; ///< slot ID of the next slot occupied by the entry
51 #endif /* SQUID_FS_ROCK_DB_CELL_H */