#include <StoreClient.h>

Collaboration diagram for store_client:


struct  Callback

Public Member Functions

void * operator new (size_t size)
void operator delete (void *address)
void * toCbdata () noexcept
 store_client (StoreEntry *)
 ~store_client ()
int64_t readOffset () const
int getType () const
void noteSwapInDone (bool error)
void doCopy (StoreEntry *e)
void readHeader (const char *buf, ssize_t len)
void readBody (const char *buf, ssize_t len)
void copy (StoreEntry *, StoreIOBuffer, STCB *, void *)
void dumpStats (MemBuf *output, int clientNumber) const
int bytesWanted () const
void setDelayId (DelayId delay_id)

Public Attributes

int64_t cmp_offset
StoreIOState::Pointer swapin_sio
struct {
   bool   disk_io_pending
   bool   store_copying
DelayId delayId
dlink_node node
struct store_client::Callback _callback

Private Member Functions

bool moreToSend () const
 Whether there is (or will be) more entry data for us. More...
void fileRead ()
void scheduleDiskRead ()
void scheduleMemRead ()
void scheduleRead ()
bool startSwapin ()
 opens the swapin "file" if possible; otherwise, fail()s and returns false More...
void fail ()
void callback (ssize_t)
void noteCopiedBytes (size_t)
void noteEof ()
void noteNews ()
 if necessary and possible, informs the Store reader about copy() result More...
void finishCallback ()
 finishes a copy()-STCB sequence by synchronously calling STCB More...

Static Private Member Functions

static void FinishCallback (store_client *)
 finishCallback() wrapper; TODO: Add NullaryMemFunT for non-jobs. More...

Private Attributes

int type
bool object_ok
StoreIOBuffer copyInto
size_t copiedSize

Static Private Attributes

static cbdata_type CBDATA_store_client = CBDATA_UNKNOWN

Detailed Description

Definition at line 56 of file StoreClient.h.

Constructor & Destructor Documentation

◆ store_client()

store_client::store_client ( StoreEntry e)

◆ ~store_client()

store_client::~store_client ( )

Definition at line 230 of file store_client.cc.

Member Function Documentation

◆ bytesWanted()

int store_client::bytesWanted ( ) const

The maximum number of bytes the Store client can read/copy next without overflowing its buffer and without violating delay pool limits. Store I/O is not rate-limited, but we assume that the same number of bytes may be read from the Squid-to-server connection that may be rate-limited.

Definition at line 947 of file store_client.cc.

References DelayId::bytesWanted(), copyInto, delayId, and StoreIOBuffer::length.

◆ callback()

void store_client::callback ( ssize_t  outcome)

schedules asynchronous STCB call to relay disk or memory read results

outcomean error signal (if negative), an EOF signal (if zero), or the number of bytes read

Definition at line 145 of file store_client.cc.

References fail(), noteCopiedBytes(), and noteEof().

Referenced by readBody(), and scheduleMemRead().

◆ copy()

void store_client::copy ( StoreEntry anEntry,
StoreIOBuffer  copyRequest,
STCB callback_fn,
void *  data 

◆ doCopy()

◆ dumpStats()

◆ fail()

void store_client::fail ( )

Definition at line 545 of file store_client.cc.

References debugs, noteNews(), and object_ok.

Referenced by callback(), noteSwapInDone(), readBody(), readHeader(), and startSwapin().

◆ fileRead()

◆ finishCallback()

◆ FinishCallback()

void store_client::FinishCallback ( store_client sc)

Definition at line 158 of file store_client.cc.

References sc.

Referenced by noteNews().

◆ getType()

int store_client::getType ( ) const

Definition at line 88 of file store_client.cc.

References type.

Referenced by store_client(), doCopy(), LowestMemReader::operator()(), and scheduleDiskRead().

◆ moreToSend()

◆ noteCopiedBytes()

void store_client::noteCopiedBytes ( size_t  bytesCopied)

schedules asynchronous STCB call to relay a successful disk or memory read

bytesCopiedthe number of response bytes copied into copyInto

Definition at line 192 of file store_client.cc.

References Assure, copiedSize, debugs, and noteNews().

Referenced by callback().

◆ noteEof()

void store_client::noteEof ( )

Definition at line 202 of file store_client.cc.

References Assure, copiedSize, debugs, and noteNews().

Referenced by callback(), doCopy(), and noteSwapInDone().

◆ noteNews()

◆ noteSwapInDone()

void store_client::noteSwapInDone ( bool  error)

React to the end of reading the response from disk. There will be no more readHeader() and readBody() callbacks for the current storeRead() swapin after this notification.

Definition at line 434 of file store_client.cc.

References _callback, Assure, error(), fail(), noteEof(), and store_client::Callback::pending().

◆ operator delete()

void store_client::operator delete ( void *  address)

Definition at line 58 of file StoreClient.h.

◆ operator new()

void * store_client::operator new ( size_t  size)

Definition at line 58 of file StoreClient.h.

◆ readBody()

◆ readHeader()

◆ readOffset()

int64_t store_client::readOffset ( ) const

An offset into the stored response bytes, including the HTTP response headers (if any). Note that this offset does not include Store entry metadata, because it is not a part of the stored response.

Return values
0means the client wants to read HTTP response headers.
+Nthe response byte that the client wants to read next.
-Nshould not occur.

Definition at line 72 of file StoreClient.h.

References copyInto, and StoreIOBuffer::offset.

Referenced by LowestMemReader::operator()().

◆ scheduleDiskRead()

void store_client::scheduleDiskRead ( )

Definition at line 455 of file store_client.cc.

References assert, debugs, entry, fileRead(), flags, getType(), startSwapin(), STORE_DISK_CLIENT, and swapin_sio.

Referenced by scheduleRead().

◆ scheduleMemRead()

void store_client::scheduleMemRead ( )

◆ scheduleRead()

void store_client::scheduleRead ( )

◆ setDelayId()

◆ startSwapin()

bool store_client::startSwapin ( )

◆ toCbdata()

void * store_client::toCbdata ( )

Definition at line 58 of file StoreClient.h.

Member Data Documentation

◆ _callback

◆ CBDATA_store_client

cbdata_type store_client::CBDATA_store_client = CBDATA_UNKNOWN

Definition at line 58 of file StoreClient.h.

◆ cmp_offset

int64_t store_client::cmp_offset

Definition at line 91 of file StoreClient.h.

Referenced by copy(), and finishCallback().

◆ copiedSize

size_t store_client::copiedSize

The number of bytes loaded from Store into copyInto while answering the current copy() request. Ought to be ignored when not answering.

Definition at line 151 of file StoreClient.h.

Referenced by finishCallback(), noteCopiedBytes(), and noteEof().

◆ copyInto

StoreIOBuffer store_client::copyInto

Storage and metadata associated with the current copy() request. Ought to be ignored when not answering a copy() request.

Definition at line 147 of file StoreClient.h.

Referenced by bytesWanted(), copy(), doCopy(), dumpStats(), fileRead(), finishCallback(), moreToSend(), readBody(), readHeader(), readOffset(), scheduleMemRead(), and scheduleRead().

◆ delayId

DelayId store_client::delayId

Definition at line 112 of file StoreClient.h.

Referenced by bytesWanted(), and setDelayId().

◆ disk_io_pending

bool store_client::disk_io_pending

whether we are expecting a response to be swapped in from disk (i.e. whether async storeRead() is currently in progress)

Definition at line 104 of file StoreClient.h.

◆ entry


◆ node

dlink_node store_client::node

Definition at line 123 of file StoreClient.h.

Referenced by MemObject::addClient().

◆ object_ok

bool store_client::object_ok

Definition at line 143 of file StoreClient.h.

Referenced by fail(), finishCallback(), and readHeader().

◆ store_copying

bool store_client::store_copying

whether the store_client::doCopy()-initiated STCB sequence is currently in progress

Definition at line 108 of file StoreClient.h.

◆ swapin_sio

StoreIOState::Pointer store_client::swapin_sio

Definition at line 98 of file StoreClient.h.

Referenced by doCopy(), fileRead(), scheduleDiskRead(), and startSwapin().

◆ type

int store_client::type

Definition at line 142 of file StoreClient.h.

Referenced by getType().

The documentation for this class was generated from the following files:






Web Site Translations