]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/DiskDaemon/DiskdFile.h
Merge from trunk rev.13584
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / DiskdFile.h
1 /*
2 * Copyright (C) 1996-2014 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
27 public:
28 DiskdFile(char const *path, DiskdIOStrategy *);
29 ~DiskdFile();
30 virtual void open(int flags, mode_t aMode, RefCount<IORequestor> callback);
31 virtual void create(int flags, mode_t aMode, RefCount<IORequestor> callback);
32 virtual void read(ReadRequest *);
33 virtual void write(WriteRequest *);
34 virtual void close();
35 virtual bool error() const;
36 virtual bool canRead() const;
37 virtual bool ioInProgress() const;
38
39 /* Temporary */
40 int getID() const {return id;}
41
42 void completed(diomsg *);
43
44 private:
45 int id;
46 char const *path_;
47 bool errorOccured;
48 DiskdIOStrategy *IO;
49 RefCount<IORequestor> ioRequestor;
50 void openDone(diomsg *);
51 void createDone (diomsg *);
52 void readDone (diomsg *);
53 void writeDone (diomsg *);
54 void closeDone (diomsg *);
55 int mode;
56 void notifyClient();
57 bool canNotifyClient() const;
58 void ioAway();
59 void ioCompleted();
60 size_t inProgressIOs;
61
62 CBDATA_CLASS2(DiskdFile);
63 };
64
65 #endif