source: squid-ssl/trunk/fuentes/src/DiskIO/DiskDaemon/DiskdIOStrategy.h @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 2.9 KB
Line 
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/* DEBUG: section 79    Squid-side DISKD I/O functions. */
10
11#ifndef __STORE_DISKDIOSTRATEGY_H__
12#define __STORE_DISKDIOSTRATEGY_H__
13
14struct diomsg;
15
16/// \ingroup diskd
17class SharedMemory
18{
19
20public:
21    void put(ssize_t);
22
23    void *get(ssize_t *);
24
25    void init(int ikey, int magic2);
26
27    int nbufs;
28
29    char *buf;
30
31    char *inuse_map;
32
33    int id;
34};
35
36#include "DiskIO/DiskIOStrategy.h"
37#include "StoreIOState.h"
38
39class DiskFile;
40
41class DiskdFile;
42class Lock;
43class ReadRequest;
44
45/// \ingroup diskd
46class DiskdIOStrategy : public DiskIOStrategy
47{
48
49public:
50    DiskdIOStrategy();
51    virtual bool shedLoad();
52    virtual int load();
53    virtual RefCount<DiskFile> newFile(char const *path);
54    virtual bool unlinkdUseful() const;
55    virtual void unlinkFile (char const *);
56    virtual ConfigOption *getOptionTree() const;
57    virtual void init();
58    virtual void sync();
59    virtual int callback();
60    virtual void statfs(StoreEntry & sentry) const;
61    int send(int mtype, int id, DiskdFile *theFile, size_t size, off_t offset, ssize_t shm_offset, Lock *requestor);
62
63    /** public for accessing return address's */
64    SharedMemory shm;
65
66private:
67    static size_t newInstance();
68    static size_t nextInstanceID;
69    void openFailed();
70    bool optionQ1Parse(char const *option, const char *value, int reconfiguring);
71    void optionQ1Dump(StoreEntry * e) const;
72    bool optionQ2Parse(char const *option, const char *value, int reconfiguring);
73    void optionQ2Dump(StoreEntry * e) const;
74    int send(int mtype, int id, RefCount<StoreIOState> sio, size_t size, off_t offset, ssize_t shm_offset);
75    int SEND(diomsg * M, int mtype, int id, size_t size, off_t offset, ssize_t shm_offset);
76    void handle(diomsg * M);
77    void unlinkDone(diomsg * M);
78
79    /**
80     * magic1 is the number of messages away which we
81     * stop allowing open/create for.
82     */
83    int magic1;
84
85    /**
86     * magic2 is the point at which we start blocking on msgsnd/msgrcv.
87     * If a queue has magic2 (or more) messages away, then we read the
88     * queue until the level falls below magic2.  Recommended value
89     * is 75% of SHMBUFS.
90     */
91    int magic2;
92
93    int away;
94    int smsgid;
95    int rmsgid;
96    int wfd;
97    size_t instanceID;
98};
99
100/// \ingroup diskd
101#define SHMBUF_BLKSZ SM_PAGE_SIZE
102
103/// \ingroup diskd
104struct diskd_stats_t {
105    int open_fail_queue_len;
106    int block_queue_len;
107    int max_away;
108    int max_shmuse;
109    int shmbuf_count;
110    int sent_count;
111    int recv_count;
112    int sio_id;
113
114    struct {
115        int ops;
116        int success;
117        int fail;
118    }
119
120    open, create, close, unlink, read, write;
121};
122
123/// \ingroup diskd
124extern diskd_stats_t diskd_stats;
125
126#endif
127
Note: See TracBrowser for help on using the repository browser.