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 | #ifndef SQUID_AIODISKIOSTRATEGY_H |
---|
10 | #define SQUID_AIODISKIOSTRATEGY_H |
---|
11 | |
---|
12 | #if USE_DISKIO_AIO |
---|
13 | |
---|
14 | #include "async_io.h" |
---|
15 | #include "DiskIO/DiskIOStrategy.h" |
---|
16 | |
---|
17 | class AIODiskIOStrategy : public DiskIOStrategy |
---|
18 | { |
---|
19 | |
---|
20 | public: |
---|
21 | AIODiskIOStrategy(); |
---|
22 | virtual ~AIODiskIOStrategy(); |
---|
23 | |
---|
24 | virtual bool shedLoad(); |
---|
25 | /* What is the current load? 999 = 99.9% */ |
---|
26 | virtual int load(); |
---|
27 | /* Return a handle for performing IO operations */ |
---|
28 | virtual RefCount<DiskFile> newFile (char const *path); |
---|
29 | /* flush all IO operations */ |
---|
30 | virtual void sync(); |
---|
31 | /** whether the IO Strategy can use unlinkd */ |
---|
32 | virtual bool unlinkdUseful() const; |
---|
33 | /* unlink a file by path */ |
---|
34 | virtual void unlinkFile (char const *); |
---|
35 | |
---|
36 | /* perform any pending callbacks */ |
---|
37 | virtual int callback(); |
---|
38 | |
---|
39 | /* Init per-instance logic */ |
---|
40 | virtual void init(); |
---|
41 | |
---|
42 | /* cachemgr output on the IO instance stats */ |
---|
43 | virtual void statfs(StoreEntry & sentry)const; |
---|
44 | /* module specific options */ |
---|
45 | virtual ConfigOption *getOptionTree() const; |
---|
46 | /* a file descriptor */ |
---|
47 | int fd; |
---|
48 | /* queue of requests */ |
---|
49 | async_queue_t aq; |
---|
50 | |
---|
51 | int findSlot(); |
---|
52 | }; |
---|
53 | |
---|
54 | #endif /* USE_DISKIO_AIO */ |
---|
55 | #endif /* SQUID_AIODISKIOSTRATEGY_H */ |
---|
56 | |
---|