]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DiskIO/DiskDaemon/DiskdFile.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / DiskdFile.h
CommitLineData
59b2d47f 1/*
f70aedc4 2 * Copyright (C) 1996-2021 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
bbc27441
AJ
9/* DEBUG: section 79 Squid-side DISKD I/O functions. */
10
b9ae18aa 11#ifndef __STORE_DISKDFILE_H__
12#define __STORE_DISKDFILE_H__
13
aa839030 14#include "cbdata.h"
b9ae18aa 15#include "DiskIO/DiskFile.h"
59b2d47f 16
b9ae18aa 17class DiskdIOStrategy;
59b2d47f 18
b9ae18aa 19struct diomsg;
59b2d47f 20
63be0a78 21/**
22 \ingroup diskd
23 */
b9ae18aa 24class DiskdFile : public DiskFile
59b2d47f 25{
5c2f68b7 26 CBDATA_CLASS(DiskdFile);
59b2d47f 27
28public:
63be0a78 29 DiskdFile(char const *path, DiskdIOStrategy *);
b9ae18aa 30 ~DiskdFile();
63be0a78 31 virtual void open(int flags, mode_t aMode, RefCount<IORequestor> callback);
32 virtual void create(int flags, mode_t aMode, RefCount<IORequestor> callback);
b9ae18aa 33 virtual void read(ReadRequest *);
34 virtual void write(WriteRequest *);
63be0a78 35 virtual void close();
b9ae18aa 36 virtual bool error() const;
37 virtual bool canRead() const;
63be0a78 38 virtual bool ioInProgress() const;
59b2d47f 39
b9ae18aa 40 /* Temporary */
41 int getID() const {return id;}
59b2d47f 42
63be0a78 43 void completed(diomsg *);
b9ae18aa 44
45private:
46 int id;
47 char const *path_;
48 bool errorOccured;
49 DiskdIOStrategy *IO;
50 RefCount<IORequestor> ioRequestor;
b9ae18aa 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};
59b2d47f 63
b9ae18aa 64#endif
f53969cc 65