/*
- * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
-#ifndef SQUID_MEMOBJECT_H
-#define SQUID_MEMOBJECT_H
+#ifndef SQUID_SRC_MEMOBJECT_H
+#define SQUID_SRC_MEMOBJECT_H
-#include "CommRead.h"
+#include "base/DelayedAsyncCalls.h"
#include "dlink.h"
#include "http/RequestMethod.h"
+#include "HttpReply.h"
#include "RemovalPolicy.h"
-#include "SquidString.h"
+#include "sbuf/SBuf.h"
#include "stmem.h"
#include "store/forward.h"
#include "StoreIOBuffer.h"
bool appliedUpdates = false;
void stat (MemBuf * mb) const;
+
+ /// The offset of the last memory-stored HTTP response byte plus one.
+ /// * HTTP response headers (if any) are stored at offset zero.
+ /// * HTTP response body byte[n] usually has offset (hdr_sz + n), where
+ /// hdr_sz is the size of stored HTTP response headers (zero if none); and
+ /// n is the corresponding byte offset in the whole resource body.
+ /// However, some 206 (Partial Content) response bodies are stored (and
+ /// retrieved) as regular 200 response bodies, disregarding offsets of
+ /// their body parts. \sa HttpStateData::decideIfWeDoRanges().
int64_t endOffset () const;
/// sets baseReply().hdr_sz (i.e. written reply headers size) to endOffset()
class XitTable
{
public:
+ /// associate our StoreEntry with a Transients entry at the given index
+ void open(const int32_t anIndex, const Io anIo)
+ {
+ index = anIndex;
+ io = anIo;
+ }
+
+ /// stop associating our StoreEntry with a Transients entry
+ void close()
+ {
+ index = -1;
+ io = Store::ioDone;
+ }
+
int32_t index = -1; ///< entry position inside the in-transit table
Io io = ioUndecided; ///< current I/O state
};
PeerSelector *ircb_data = nullptr;
/// used for notifying StoreEntry writers about 3rd-party initiated aborts
- AsyncCall::Pointer abortCallback;
+ AsyncCallPointer abortCallback;
RemovalPolicyNode repl;
int id = 0;
int64_t object_sz = -1;
SBuf vary_headers;
- void delayRead(DeferredRead const &);
+ void delayRead(const AsyncCallPointer &);
void kickReads();
private:
HttpReplyPointer reply_; ///< \see baseReply()
HttpReplyPointer updatedReply_; ///< \see updatedReply()
- mutable String storeId_; ///< StoreId for our entry (usually request URI)
- mutable String logUri_; ///< URI used for logging (usually request URI)
+ mutable SBuf storeId_; ///< StoreId for our entry (usually request URI)
+ mutable SBuf logUri_; ///< URI used for logging (usually request URI)
- DeferredReadManager deferredReads;
+ DelayedAsyncCalls deferredReads;
};
/** global current memory removal policy */
extern RemovalPolicy *mem_policy;
-#endif /* SQUID_MEMOBJECT_H */
+#endif /* SQUID_SRC_MEMOBJECT_H */