DiskFile.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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_DISKFILE_H
10 #define SQUID_DISKFILE_H
11 
12 #include "base/RefCount.h"
13 #include "SquidTime.h"
14 
15 class IORequestor;
16 
17 class ReadRequest;
18 
19 class WriteRequest;
20 
21 class DiskFile : public RefCountable
22 {
23 
24 public:
25 
27  class Config
28  {
29  public:
30  Config(): ioTimeout(0), ioRate(-1) {}
31 
33  time_msec_t ioTimeout; // not enforced if zero, which is the default
34 
36  int ioRate; // not enforced if negative, which is the default
37  };
38 
40 
42  virtual void configure(const Config &) {}
43 
44  virtual void open(int flags, mode_t mode, RefCount<IORequestor> callback) = 0;
45  virtual void create(int flags, mode_t mode, RefCount<IORequestor> callback) = 0;
46  virtual void read(ReadRequest *) = 0;
47  virtual void write(WriteRequest *) = 0;
48  virtual void close() = 0;
49  virtual bool canRead() const = 0;
50  virtual bool canWrite() const {return true;}
51 
53  virtual int getFD() const {return -1;}
54 
55  virtual bool error() const = 0;
56 
58  virtual bool ioInProgress() const = 0;
59 };
60 
61 #endif /* SQUID_DISKFILE_H */
62 
generally useful configuration options supported by some children
Definition: DiskFile.h:27
virtual void configure(const Config &)
notes supported configuration options; kids must call this first
Definition: DiskFile.h:42
virtual void create(int flags, mode_t mode, RefCount< IORequestor > callback)=0
void const char HLPCB * callback
Definition: stub_helper.cc:16
RefCount< DiskFile > Pointer
Definition: DiskFile.h:39
int ioRate
shape I/O request stream to approach that many per second
Definition: DiskFile.h:36
virtual bool canRead() const =0
uint64_t time_msec_t
Definition: SquidTime.h:20
virtual bool error() const =0
virtual void write(WriteRequest *)=0
unsigned short mode_t
Definition: types.h:150
virtual int getFD() const
Definition: DiskFile.h:53
virtual bool canWrite() const
Definition: DiskFile.h:50
virtual bool ioInProgress() const =0
virtual void close()=0
time_msec_t ioTimeout
canRead/Write should return false if expected I/O delay exceeds it
Definition: DiskFile.h:33
virtual void open(int flags, mode_t mode, RefCount< IORequestor > callback)=0
virtual void read(ReadRequest *)=0

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors