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