2 * DEBUG: section 16 Cache Manager API
6 #ifndef SQUID_MGR_STORE_TO_COMM_WRITER_H
7 #define SQUID_MGR_STORE_TO_COMM_WRITER_H
9 #include "base/AsyncJob.h"
10 #include "comm/forward.h"
11 #include "mgr/Action.h"
12 #include "StoreIOBuffer.h"
16 class CommCloseCbParams
;
21 /// manages receive-from-store, write-to-comm, receive-... sequence
22 /// for the given StoreEntry and client FD
23 class StoreToCommWriter
: public AsyncJob
26 StoreToCommWriter(const Comm::ConnectionPointer
&conn
, StoreEntry
*anEntry
);
27 virtual ~StoreToCommWriter();
32 virtual void swanSong();
33 virtual bool doneAll() const;
35 /// request more action results from the store
36 void scheduleStoreCopy();
37 /// receive some action results from the store
38 void noteStoreCopied(StoreIOBuffer ioBuf
);
39 static void NoteStoreCopied(void* data
, StoreIOBuffer ioBuf
);
40 /// called by Store if the entry is no longer usable
41 static void Abort(void* param
);
43 /// tell Comm to write action results
44 void scheduleCommWrite(const StoreIOBuffer
& ioBuf
);
45 /// called by Comm after the action results are written
46 void noteCommWrote(const CommIoCbParams
& params
);
47 /// called by Comm if the client socket got closed
48 void noteCommClosed(const CommCloseCbParams
& params
);
50 /// closes the local connection to the HTTP client, if any
54 Comm::ConnectionPointer clientConnection
; ///< HTTP client descriptor
56 StoreEntry
* entry
; ///< store entry with the cache manager response
57 store_client
* sc
; ///< our registration with the store
58 int64_t writeOffset
; ///< number of bytes written to the client
60 AsyncCall::Pointer closer
; ///< comm_close handler
61 char buffer
[HTTP_REQBUF_SZ
]; ///< action results; Store fills, Comm writes
63 CBDATA_CLASS2(StoreToCommWriter
);
68 #endif /* SQUID_MGR_STORE_TO_COMM_WRITER_H */