9#ifndef SQUID_SRC_DISKIO_IPCIO_IPCIOFILE_H
10#define SQUID_SRC_DISKIO_IPCIO_IPCIOFILE_H
46 void stat(std::ostream &);
82 void close()
override;
83 bool error()
const override;
84 int getFD()
const override;
116 static void Notify(
const int peerId);
144 typedef std::map<unsigned int, IpcIoPendingRequest*>
RequestMap;
161 static std::unique_ptr<Queue>
queue;
generally useful configuration options supported by some children
RequestMap * newerRequests
newer requests (map2 or map1)
RequestMap requestMap1
older (or newer) pending requests
static void DiskerHandleMoreRequests(void *)
void create(int flags, mode_t mode, RefCount< IORequestor > callback) override
void scheduleTimeoutCheck()
prepare to check for timeouts in a little while
RefCount< IpcIoFile > Pointer
static bool DiskerHandleMoreRequestsScheduled
whether we are waiting for an event to handle still queued I/O requests
bool canWait() const
whether we think there is enough time to complete the I/O
static IpcIoFileList WaitingForOpen
pending open requests
void read(ReadRequest *) override
static const double Timeout
timeout value in seconds
bool canRead() const override
static void CheckTimeouts(void *const param)
IpcIoFile::checkTimeouts wrapper.
static IpcIoFilesMap IpcIoFiles
RequestMap * olderRequests
older requests (map1 or map2)
void trackPendingRequest(const unsigned int id, IpcIoPendingRequest *const pending)
track a new pending request
static void DiskerHandleRequests()
void open(int flags, mode_t mode, RefCount< IORequestor > callback) override
static void Notify(const int peerId)
static void HandleOpenResponse(const Ipc::StrandMessage &)
handle open response from coordinator
void writeCompleted(WriteRequest *writeRequest, const IpcIoMsg *const response)
RefCount< IORequestor > ioRequestor
bool ioInProgress() const override
int getFD() const override
void configure(const Config &cfg) override
notes supported configuration options; kids must call this first
static void OpenTimeout(void *const param)
handles open request timeout
void handleResponse(IpcIoMsg &ipcIo)
bool error() const override
static void DiskerHandleRequest(const int workerId, IpcIoMsg &ipcIo)
called when disker receives an I/O request
void openCompleted(const Ipc::StrandMessage *)
int diskId
the kid ID of the disker we talk to
void readCompleted(ReadRequest *readRequest, IpcIoMsg *const response)
size_t pendingRequests() const
std::map< int, IpcIoFile * > IpcIoFilesMap
DiskFile::Config config
supported configuration options
void push(IpcIoPendingRequest *const pending)
push an I/O request to disker
static void StatQueue(std::ostream &)
prints IPC message queue state; suitable for cache manager reports
void write(WriteRequest *) override
bool timeoutCheckScheduled
we expect a CheckTimeouts() call
unsigned int lastRequestId
last requestId used
Ipc::FewToFewBiQueue Queue
RequestMap requestMap2
newer (or older) pending requests
static std::unique_ptr< Queue > queue
IPC queue.
IpcIoPendingRequest * dequeueRequest(const unsigned int requestId)
returns and forgets the right IpcIoFile pending request
const pid_t myPid
optimization: cached process ID of our process
bool error_
whether we have seen at least one I/O error (XXX)
bool canWrite() const override
static void HandleMessagesAtStart()
static void HandleResponses(const char *const when)
const String dbName
the name of the file we are managing
std::map< unsigned int, IpcIoPendingRequest * > RequestMap
maps requestId to the handleResponse callback
static bool WaitBeforePop()
static void HandleNotification(const Ipc::TypedMsgHdr &msg)
handle queue push notifications from worker or disker
std::list< Pointer > IpcIoFileList
converts DiskIO requests to IPC queue messages
pid_t workerPid
the process ID of the I/O requestor
IpcIo::Command command
what disker is supposed to do or did
unsigned int requestId
unique for requestor; matches request w/ response
void stat(std::ostream &)
prints message parameters; suitable for cache manager reports
struct timeval start
when the I/O request was converted to IpcIoMsg
int xerrno
I/O error code or zero.
keeps original I/O request parameters while disker is handling the request
IpcIoPendingRequest & operator=(const IpcIoPendingRequest &d)
CodeContext::Pointer codeContext
requestor's context
const IpcIoFile::Pointer file
the file object waiting for the response
WriteRequest * writeRequest
set if this is a write request
IpcIoPendingRequest(const IpcIoPendingRequest &d)
void completeIo(IpcIoMsg *const response)
called when response is received and, with a nil response, on timeouts
ReadRequest * readRequest
set if this is a read requests
Shared memory page identifier, address, or handler.
an IPC message carrying StrandCoord
struct msghdr with a known type, fixed-size I/O and control buffers
Command
what kind of I/O the disker needs to do or have done
std::ostream & operator<<(std::ostream &, Command)