DiskFile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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 "time/gadgets.h"
14
15class IORequestor;
16
17class ReadRequest;
18
19class WriteRequest;
20
21class DiskFile : public RefCountable
22{
23
24public:
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
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
generally useful configuration options supported by some children
Definition: DiskFile.h:28
time_msec_t ioTimeout
canRead/Write should return false if expected I/O delay exceeds it
Definition: DiskFile.h:33
int ioRate
shape I/O request stream to approach that many per second
Definition: DiskFile.h:36
virtual void read(ReadRequest *)=0
virtual void close()=0
RefCount< DiskFile > Pointer
Definition: DiskFile.h:39
virtual bool ioInProgress() const =0
virtual void open(int flags, mode_t mode, RefCount< IORequestor > callback)=0
virtual void configure(const Config &)
notes supported configuration options; kids must call this first
Definition: DiskFile.h:42
virtual int getFD() const
Definition: DiskFile.h:53
virtual bool canRead() const =0
virtual bool canWrite() const
Definition: DiskFile.h:50
virtual void write(WriteRequest *)=0
virtual void create(int flags, mode_t mode, RefCount< IORequestor > callback)=0
virtual bool error() const =0
uint64_t time_msec_t
Definition: gadgets.h:16
unsigned short mode_t
Definition: types.h:129

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors