26 const auto rawType = NaturalCast<RawSwapMetaType>(type);
33 const auto rawLength = NaturalCast<RawSwapMetaLength>(length);
37 if (!os.write(&rawType,
sizeof(rawType)) ||
38 !os.write(
reinterpret_cast<const char*
>(&rawLength),
sizeof(rawLength)) ||
39 (length && !os.write(
static_cast<const char*
>(value), length)))
47 const auto &emem = entry.
mem();
52 url = emem.request->storeId();
56 debugs(20, 3, entry <<
" URL: " << url);
69 const auto &vary = emem.vary_headers;
81 const auto metas = os.
buf();
85 AllocedBuf buf(
xmalloc(bufSize));
86 const auto bufStart =
static_cast<char*
>(buf.get());
93 const auto metaSize = NaturalCast<RawSwapMetaLength>(bufSize);
94 memcpy(pos, &metaSize,
sizeof(metaSize));
95 pos +=
sizeof(metaSize);
97 Assure(pos + metas.length() == bufStart + bufSize);
98 memcpy(pos, metas.rawContent(), metas.length());
99 pos += metas.length();
101 totalLength = bufSize;
#define Assure(condition)
#define Here()
source code location of the caller
int64_t expectedReplySize() const
SBuf buf()
bytes written so far
size_type length() const
Returns the number of bytes stored in SBuf.
an std::runtime_error with thrower location info
#define debugs(SECTION, LEVEL, CONTENT)
#define SQUID_MD5_DIGEST_LENGTH
const size_t SwapMetaFieldValueLengthMax
static void PackField(std::ostream &os, const SwapMetaType type, const size_t length, const void *value)
writes a single swap meta field to the given stream
@ STORE_META_VARY_HEADERS
Stores Vary request headers.
void CheckSwapMetaSerialization(RawSwapMetaType, RawSwapMetaLength, const void *)
AllocedBuf PackSwapMeta(const StoreEntry &, size_t &size)
const char SwapMetaMagic
the start of the swap meta section
static void PackFields(const StoreEntry &entry, std::ostream &os)
writes all swap meta fields of the given Store entry to the given stream
const auto STORE_HDR_METASIZE
int RawSwapMetaPrefixLength