]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/DiskDaemon/DiskdFile.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / DiskdFile.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* DEBUG: section 79 Squid-side DISKD I/O functions. */
10
11 #ifndef __STORE_DISKDFILE_H__
12 #define __STORE_DISKDFILE_H__
13
14 #include "cbdata.h"
15 #include "DiskIO/DiskFile.h"
16
17 class DiskdIOStrategy;
18
19 struct diomsg;
20
21 /**
22 \ingroup diskd
23 */
24 class DiskdFile : public DiskFile
25 {
26 CBDATA_CLASS(DiskdFile);
27
28 public:
29 DiskdFile(char const *path, DiskdIOStrategy *);
30 ~DiskdFile();
31 virtual void open(int flags, mode_t aMode, RefCount<IORequestor> callback);
32 virtual void create(int flags, mode_t aMode, RefCount<IORequestor> callback);
33 virtual void read(ReadRequest *);
34 virtual void write(WriteRequest *);
35 virtual void close();
36 virtual bool error() const;
37 virtual bool canRead() const;
38 virtual bool ioInProgress() const;
39
40 /* Temporary */
41 int getID() const {return id;}
42
43 void completed(diomsg *);
44
45 private:
46 int id;
47 char const *path_;
48 bool errorOccured;
49 DiskdIOStrategy *IO;
50 RefCount<IORequestor> ioRequestor;
51 void openDone(diomsg *);
52 void createDone (diomsg *);
53 void readDone (diomsg *);
54 void writeDone (diomsg *);
55 void closeDone (diomsg *);
56 int mode;
57 void notifyClient();
58 bool canNotifyClient() const;
59 void ioAway();
60 void ioCompleted();
61 size_t inProgressIOs;
62 };
63
64 #endif
65