/*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#include "base/RefCount.h"
#include "cbdata.h"
+#include "mem/forward.h"
+#include "store/forward.h"
class StoreIOState : public RefCountable
{
/* StoreIOState does not get mempooled - it's children do */
void *operator new (size_t amount);
void operator delete (void *address);
- virtual ~StoreIOState();
- StoreIOState();
+ StoreIOState(StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data);
+ virtual ~StoreIOState();
- off_t offset() const;
+ off_t offset() const {return offset_;}
virtual void read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) = 0;
/** write the given buffer and free it when it is no longer needed
} CloseHow;
virtual void close(int how) = 0; ///< finish or abort swapping per CloseHow
+ // Tests whether we are working with the primary/public StoreEntry chain.
+ // Reads start reading the primary chain, but it may become secondary.
+ // There are two store write kinds:
+ // * regular writes that change (usually append) the entry visible to all and
+ // * header updates that create a fresh chain (while keeping the stale one usable).
+ bool touchingStoreEntry() const;
+
sdirno swap_dirn;
sfileno swap_filen;
- StoreEntry *e; /* Need this so the FS layers can play god */
+ StoreEntry *e; /* Need this so the FS layers can play god */
mode_t mode;
off_t offset_; ///< number of bytes written or read for this entry so far
- STFNCB *file_callback; /* called on delayed sfileno assignments */
+ STFNCB *file_callback; // XXX: Unused. TODO: Remove.
STIOCB *callback;
void *callback_data;
} read;
struct {
- bool closing; /* debugging aid */
+ bool closing; /* debugging aid */
} flags;
};
void storeIOWrite(StoreIOState::Pointer, char const *, size_t, off_t, FREE *);
#endif /* SQUID_STOREIOSTATE_H */
+