]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DiskIO/AIO/AIODiskFile.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / AIO / AIODiskFile.h
CommitLineData
59b2d47f 1/*
59b2d47f 2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
4 *
5 * Squid is the result of efforts by numerous individuals from
6 * the Internet community; see the CONTRIBUTORS file for full
7 * details. Many organizations have provided support for Squid's
8 * development; see the SPONSORS file for full details. Squid is
9 * Copyrighted (C) 2001 by the Regents of the University of
10 * California; see the COPYRIGHT file for full details. Squid
11 * incorporates software developed and/or copyrighted by other
12 * sources; see the CREDITS file for full details.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
26ac0430 18 *
59b2d47f 19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
26ac0430 23 *
59b2d47f 24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
27 *
28 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
29 */
30
b9ae18aa 31#ifndef SQUID_AIODISKFILE_H
32#define SQUID_AIODISKFILE_H
59b2d47f 33
2513178d
AJ
34#if USE_DISKIO_AIO
35
b9ae18aa 36#include "async_io.h"
aa839030 37#include "cbdata.h"
602d9612 38#include "DiskIO/DiskFile.h"
582c2af2 39#include "SquidString.h"
59b2d47f 40
b9ae18aa 41class AIODiskIOStrategy;
59b2d47f 42
b9ae18aa 43class AIODiskFile : public DiskFile
59b2d47f 44{
45
46public:
59b2d47f 47
b9ae18aa 48 friend class AIODiskIOStrategy;
b9ae18aa 49 AIODiskFile (char const *path, AIODiskIOStrategy *);
50 ~AIODiskFile();
63be0a78 51
52 /// \bug the code has this as "IORequestor::Pointer callback"
53 virtual void open(int flags, mode_t mode, RefCount<IORequestor> callback);
54
b9ae18aa 55 virtual void create (int, mode_t, RefCount<IORequestor>);
56 virtual void read(ReadRequest *);
57 virtual void write(WriteRequest *);
58 virtual void close ();
59 virtual bool canRead() const;
60 virtual bool canWrite() const;
61
62 /* During migration only */
63 virtual int getFD() const;
64
65 virtual bool error() const;
59b2d47f 66
b9ae18aa 67 /* Inform callers if there is IO in progress */
68 virtual bool ioInProgress() const;
69
70private:
b9ae18aa 71 void error(bool const &);
72 int fd;
30abd221 73 String path;
b9ae18aa 74 AIODiskIOStrategy *strategy;
75 RefCount<IORequestor> ioRequestor;
76 bool closed;
77 bool error_;
f49c09b2 78 CBDATA_CLASS2(AIODiskFile);
b9ae18aa 79};
59b2d47f 80
2513178d 81#endif /* USE_DISKIO_AIO */
b9ae18aa 82#endif /* SQUID_AIODISKFILE_H */