11#ifndef SQUID_SRC_HELPER_H
12#define SQUID_SRC_HELPER_H
31#include <unordered_map>
148 void submit(
const char *buf,
HLPCB * callback,
void *data);
158 typedef std::unordered_map<Helper::ReservationId, helper_stateful_server *>
Reservations;
#define RefCountable
The locking interface for use on Reference-Counted classes.
time_t timeout
Requests timeout.
void handleKilledServer(SessionBase *)
bool retryBrokenHelper
Whether the requests must retried on BH replies.
bool queueFull() const
whether queuing an additional request would overload the helper
Client(const char *const name)
unsigned int droppedRequests
requests not sent during helper overload
bool willOverload() const
void packStatsInto(Packable *p, const char *label=nullptr) const
Dump some stats about the helper state to a Packable object.
void handleFewerServers(bool madeProgress)
char eom
The char which marks the end of (response) message, normally ' '.
void submit(const char *buf, HLPCB *callback, void *data)
dispatches or enqueues a helper requests; does not enforce queue limits
SBuf onTimedOutResponse
The response to use when helper response timedout.
bool trySubmit(const char *buf, HLPCB *callback, void *data)
If possible, submit request. Otherwise, either kill Squid or return false.
void syncQueueStats()
synchronizes queue-dependent measurements with the current queue state
std::queue< Xaction * > queue
void submitRequest(Xaction *)
time_t overloadStart
when the helper became overloaded (zero if it is not)
ChildConfig childs
Configuration settings for number running.
void callBack(Xaction &)
sends transaction response to the transaction initiator
bool retryTimedOut
Whether the timed-out requests must retried.
struct Helper::Client::_stats stats
static Pointer Make(const char *name)
virtual void openSessions()
a (temporary) lock on a (stateful) helper channel
represents a single helper process
struct Helper::SessionBase::_helper_flags flags
virtual void dropQueued()
dequeues and sends an Unknown answer to all queued requests
virtual Client & helper() const =0
our creator (parent) object
Requests requests
requests in order of submission/expiration
const InstanceId< SessionBase > index
struct timeval dispatch_time
struct timeval answer_time
virtual bool reserved()=0
whether the server is locked for exclusive use by a client
void closeWritePipeSafely()
static void HelperServerClosed(SessionBase *)
close handler to handle exited server processes
Comm::ConnectionPointer readPipe
struct Helper::SessionBase::@53 stats
std::list< Xaction * > Requests
Comm::ConnectionPointer writePipe
void dropQueued() override
dequeues and sends an Unknown answer to all queued requests
bool reserved() override
whether the server is locked for exclusive use by a client
void checkForTimedOutRequests(bool const retry)
bool ignoreToEom
Whether to ignore current message, because it is timed-out or other reason.
Client & helper() const override
our creator (parent) object
Xaction * popRequest(int requestId)
RequestIndex requestsIndex
maps request IDs to requests
std::map< uint64_t, Requests::iterator > RequestIndex
static void requestTimeout(const CommTimeoutCbParams &io)
Read timeout handler.
Holds the required data to serve a helper request.
Xaction(HLPCB *c, void *d, const char *b)
MEMPROXY_CLASS(Helper::Xaction)
bool reserved() override
whether the server is locked for exclusive use by a client
~helper_stateful_server() override
statefulhelper::Pointer parent
Helper::Client & helper() const override
our creator (parent) object
time_t reservationStart
when the last reservation was made
CBDATA_CHILD(helper_stateful_server)
Helper::ReservationId reservationId
"confirmation ID" of the last
void submit(const char *buf, HLPCB *callback, void *data, const Helper::ReservationId &reservation)
helper_stateful_server * findServer(const Helper::ReservationId &reservation)
~statefulhelper() override=default
std::unordered_map< Helper::ReservationId, helper_stateful_server * > Reservations
static Pointer Make(const char *name)
void reserveServer(helper_stateful_server *srv)
reserve the given server
void cancelReservation(const Helper::ReservationId reservation)
undo reserveServer(), clear the reservation and kick the queue
void openSessions() override
statefulhelper(const char *const name)
Reservations reservations
friend void helperStatefulSubmit(const statefulhelper::Pointer &, const char *buf, HLPCB *, void *cbData, const Helper::ReservationId &)
bool trySubmit(const char *buf, HLPCB *callback, void *data, const Helper::ReservationId &reservation)
reserved servers indexed by reservation IDs
void HLPCB(void *, const Helper::Reply &)
void helperSubmit(const Helper::Client::Pointer &, const char *buf, HLPCB *, void *cbData)
void helperShutdown(const Helper::Client::Pointer &)
void helperStatefulSubmit(const statefulhelper::Pointer &, const char *buf, HLPCB *, void *cbData, uint64_t reservation)
void helperStatefulShutdown(const statefulhelper::Pointer &)
helper protocol primitives