StoreClient.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_STORECLIENT_H
10 #define SQUID_STORECLIENT_H
11 
12 #include "dlink.h"
13 #include "StoreIOBuffer.h"
14 #include "StoreIOState.h"
15 
16 typedef void STCB(void *, StoreIOBuffer); /* store callback */
17 
18 class StoreEntry;
19 
21 {
22 
23 public:
24  virtual ~StoreClient () {}
25 
26  virtual void created (StoreEntry *newEntry) = 0;
27 };
28 
29 #if USE_DELAY_POOLS
30 #include "DelayId.h"
31 #endif
32 
33 /* keep track each client receiving data from that particular StoreEntry */
34 
36 {
38 
39 public:
41  ~store_client();
42  bool memReaderHasLowerOffset(int64_t) const;
43  int getType() const;
44  void fail();
45  void callback(ssize_t len, bool error = false);
46  void doCopy (StoreEntry *e);
47  void readHeader(const char *buf, ssize_t len);
48  void readBody(const char *buf, ssize_t len);
49  void copy(StoreEntry *, StoreIOBuffer, STCB *, void *);
50  void dumpStats(MemBuf * output, int clientNumber) const;
51 
52  int64_t cmp_offset;
53 #if STORE_CLIENT_LIST_DEBUG
54 
55  void *owner;
56 #endif
57 
58  StoreEntry *entry; /* ptr to the parent StoreEntry, argh! */
60 
61  struct {
65  } flags;
66 
67 #if USE_DELAY_POOLS
69  void setDelayId(DelayId delay_id);
70 #endif
71 
73  /* Below here is private - do no alter outside storeClient calls */
75 
76 private:
77  bool moreToSend() const;
78 
79  void fileRead();
80  void scheduleDiskRead();
81  void scheduleMemRead();
82  void scheduleRead();
83  bool startSwapin();
84  bool unpackHeader(char const *buf, ssize_t len);
85 
86  int type;
87  bool object_ok;
88 
89  /* Until we finish stuffing code into store_client */
90 
91 public:
92 
93  struct Callback {
95 
96  Callback (STCB *, void *);
97  bool pending() const;
100  } _callback;
101 };
102 
106 int storeUnregister(store_client * sc, StoreEntry * e, void *data);
107 int storePendingNClients(const StoreEntry * e);
108 int storeClientIsThisAClient(store_client * sc, void *someClient);
109 
110 #endif /* SQUID_STORECLIENT_H */
111 
bool moreToSend() const
Whether there is (or will be) more entry data for us.
static int sc[16]
Definition: smbdes.c:121
void error(char *format,...)
int getType() const
Definition: store_client.cc:54
bool startSwapin()
opens the swapin "file" if possible; otherwise, fail()s and returns false
bool memReaderHasLowerOffset(int64_t) const
Definition: store_client.cc:48
store_client(StoreEntry *)
struct store_client::@145 flags
void setDelayId(DelayId delay_id)
dlink_node node
Definition: StoreClient.h:72
void readBody(const char *buf, ssize_t len)
bool object_ok
Definition: StoreClient.h:87
void storeClientCopy(store_client *, StoreEntry *, StoreIOBuffer, STCB *, void *)
void const char HLPCB void * data
Definition: stub_helper.cc:16
int storePendingNClients(const StoreEntry *e)
int storeClientIsThisAClient(store_client *sc, void *someClient)
bool unpackHeader(char const *buf, ssize_t len)
void scheduleDiskRead()
#define CBDATA_CLASS(type)
Definition: cbdata.h:302
StoreIOBuffer copyInto
Definition: StoreClient.h:74
virtual ~StoreClient()
Definition: StoreClient.h:24
StoreIOState::Pointer swapin_sio
Definition: StoreClient.h:59
bool copy_event_pending
Definition: StoreClient.h:64
void scheduleMemRead()
StoreEntry * entry
Definition: StoreClient.h:58
int64_t cmp_offset
Definition: StoreClient.h:52
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
void dumpStats(MemBuf *output, int clientNumber) const
void const char * buf
Definition: stub_helper.cc:16
void doCopy(StoreEntry *e)
bool store_copying
Definition: StoreClient.h:63
void copy(StoreEntry *, StoreIOBuffer, STCB *, void *)
store_client * storeClientListAdd(StoreEntry *e, void *data)
Definition: store_client.cc:87
void STCB(void *, StoreIOBuffer)
Definition: StoreClient.h:16
virtual void created(StoreEntry *newEntry)=0
bool disk_io_pending
Definition: StoreClient.h:62
Definition: MemBuf.h:23
void scheduleRead()
void readHeader(const char *buf, ssize_t len)
int storeUnregister(store_client *sc, StoreEntry *e, void *data)
DelayId delayId
Definition: StoreClient.h:68
int storeClientCopyPending(store_client *, StoreEntry *e, void *data)
#define NULL
Definition: types.h:166
struct store_client::Callback _callback
void callback(ssize_t len, bool error=false)

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors