]>
Commit | Line | Data |
---|---|---|
59b2d47f | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
59b2d47f | 3 | * |
bbc27441 AJ |
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. | |
59b2d47f | 7 | */ |
8 | ||
b9ae18aa | 9 | #ifndef SQUID_AIODISKFILE_H |
10 | #define SQUID_AIODISKFILE_H | |
59b2d47f | 11 | |
2513178d AJ |
12 | #if USE_DISKIO_AIO |
13 | ||
b9ae18aa | 14 | #include "async_io.h" |
aa839030 | 15 | #include "cbdata.h" |
602d9612 | 16 | #include "DiskIO/DiskFile.h" |
582c2af2 | 17 | #include "SquidString.h" |
59b2d47f | 18 | |
b9ae18aa | 19 | class AIODiskIOStrategy; |
59b2d47f | 20 | |
b9ae18aa | 21 | class AIODiskFile : public DiskFile |
59b2d47f | 22 | { |
23 | ||
24 | public: | |
59b2d47f | 25 | |
b9ae18aa | 26 | friend class AIODiskIOStrategy; |
b9ae18aa | 27 | AIODiskFile (char const *path, AIODiskIOStrategy *); |
28 | ~AIODiskFile(); | |
63be0a78 | 29 | |
30 | /// \bug the code has this as "IORequestor::Pointer callback" | |
31 | virtual void open(int flags, mode_t mode, RefCount<IORequestor> callback); | |
32 | ||
b9ae18aa | 33 | virtual void create (int, mode_t, RefCount<IORequestor>); |
34 | virtual void read(ReadRequest *); | |
35 | virtual void write(WriteRequest *); | |
36 | virtual void close (); | |
37 | virtual bool canRead() const; | |
38 | virtual bool canWrite() const; | |
39 | ||
40 | /* During migration only */ | |
41 | virtual int getFD() const; | |
42 | ||
43 | virtual bool error() const; | |
59b2d47f | 44 | |
b9ae18aa | 45 | /* Inform callers if there is IO in progress */ |
46 | virtual bool ioInProgress() const; | |
47 | ||
48 | private: | |
b9ae18aa | 49 | void error(bool const &); |
50 | int fd; | |
30abd221 | 51 | String path; |
b9ae18aa | 52 | AIODiskIOStrategy *strategy; |
53 | RefCount<IORequestor> ioRequestor; | |
54 | bool closed; | |
55 | bool error_; | |
f49c09b2 | 56 | CBDATA_CLASS2(AIODiskFile); |
b9ae18aa | 57 | }; |
59b2d47f | 58 | |
2513178d | 59 | #endif /* USE_DISKIO_AIO */ |
b9ae18aa | 60 | #endif /* SQUID_AIODISKFILE_H */ |