proxygen
proxygen::WheelTimerInstance Class Reference

#include <WheelTimerInstance.h>

Public Member Functions

 WheelTimerInstance ()
 
 WheelTimerInstance (std::chrono::milliseconds defaultTimeoutMS, folly::EventBase *eventBase=nullptr)
 
 WheelTimerInstance (const WheelTimerInstance &timerInstance)
 
 WheelTimerInstance (WheelTimerInstance &&timerInstance) noexcept
 
 WheelTimerInstance (folly::HHWheelTimer *timer)
 
std::chrono::milliseconds getDefaultTimeout () const
 
void setDefaultTimeout (std::chrono::milliseconds timeout)
 
void scheduleTimeout (folly::HHWheelTimer::Callback *callback, std::chrono::milliseconds timeout)
 
void scheduleTimeout (folly::HHWheelTimer::Callback *callback)
 
WheelTimerInstanceoperator= (const WheelTimerInstance &timer)
 
WheelTimerInstanceoperator= (const WheelTimerInstance &&timer)
 
 operator bool () const
 
folly::HHWheelTimergetWheelTimer () const
 

Private Attributes

folly::HHWheelTimerwheelTimerPtr_ {nullptr}
 
std::chrono::milliseconds defaultTimeoutMS_
 

Detailed Description

Definition at line 29 of file WheelTimerInstance.h.

Constructor & Destructor Documentation

proxygen::WheelTimerInstance::WheelTimerInstance ( )

Definition at line 19 of file WheelTimerInstance.cpp.

19  {
20 }
proxygen::WheelTimerInstance::WheelTimerInstance ( std::chrono::milliseconds  defaultTimeoutMS,
folly::EventBase eventBase = nullptr 
)
explicit

Definition at line 31 of file WheelTimerInstance.cpp.

References folly::EventBaseManager::get(), folly::EventBaseManager::getEventBase(), folly::EventBase::timer(), and wheelTimerPtr_.

33  : defaultTimeoutMS_(defaultTimeoutMS) {
34  if (!eventBase) {
36  }
37  wheelTimerPtr_ = &eventBase->timer();
38 }
EventBase * getEventBase() const
folly::HHWheelTimer * wheelTimerPtr_
std::chrono::milliseconds defaultTimeoutMS_
static EventBaseManager * get()
HHWheelTimer & timer()
Definition: EventBase.h:526
proxygen::WheelTimerInstance::WheelTimerInstance ( const WheelTimerInstance timerInstance)

Definition at line 40 of file WheelTimerInstance.cpp.

41  : wheelTimerPtr_(timerInstance.wheelTimerPtr_),
42  defaultTimeoutMS_(timerInstance.defaultTimeoutMS_) {
43 }
folly::HHWheelTimer * wheelTimerPtr_
std::chrono::milliseconds defaultTimeoutMS_
proxygen::WheelTimerInstance::WheelTimerInstance ( WheelTimerInstance &&  timerInstance)
noexcept

Definition at line 45 of file WheelTimerInstance.cpp.

47  : wheelTimerPtr_(std::move(timerInstance.wheelTimerPtr_)),
48  defaultTimeoutMS_(std::move(timerInstance.defaultTimeoutMS_)) {
49 }
folly::HHWheelTimer * wheelTimerPtr_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::chrono::milliseconds defaultTimeoutMS_
proxygen::WheelTimerInstance::WheelTimerInstance ( folly::HHWheelTimer timer)
explicit

Definition at line 22 of file WheelTimerInstance.cpp.

References defaultTimeoutMS_, and folly::HHWheelTimer::getDefaultTimeout().

22  :
23  wheelTimerPtr_(timer) {
24  if (timer) {
25  // If you use an external timer with no default timeout set, you will get
26  // a check failed if you attempt to schedule a default timeout.
28  }
29 }
folly::HHWheelTimer * wheelTimerPtr_
std::chrono::milliseconds defaultTimeoutMS_
std::chrono::milliseconds getDefaultTimeout() const
Definition: HHWheelTimer.h:193

Member Function Documentation

std::chrono::milliseconds proxygen::WheelTimerInstance::getDefaultTimeout ( ) const

Definition at line 51 of file WheelTimerInstance.cpp.

References defaultTimeoutMS_.

Referenced by proxygen::HTTPSession::createTransaction().

51  {
52  return defaultTimeoutMS_;
53 }
std::chrono::milliseconds defaultTimeoutMS_
folly::HHWheelTimer* proxygen::WheelTimerInstance::getWheelTimer ( ) const
inline

Definition at line 61 of file WheelTimerInstance.h.

Referenced by proxygen::HTTPSession::createTransaction().

61  {
62  return wheelTimerPtr_;
63  }
folly::HHWheelTimer * wheelTimerPtr_
proxygen::WheelTimerInstance::operator bool ( ) const
explicit

Definition at line 88 of file WheelTimerInstance.cpp.

References wheelTimerPtr_.

88  {
89  return (wheelTimerPtr_ != nullptr);
90 }
folly::HHWheelTimer * wheelTimerPtr_
WheelTimerInstance & proxygen::WheelTimerInstance::operator= ( const WheelTimerInstance timer)

Definition at line 75 of file WheelTimerInstance.cpp.

References defaultTimeoutMS_, and wheelTimerPtr_.

75  {
76  wheelTimerPtr_ = t.wheelTimerPtr_;
77  defaultTimeoutMS_ = t.defaultTimeoutMS_;
78  return *this;
79 }
folly::HHWheelTimer * wheelTimerPtr_
std::chrono::milliseconds defaultTimeoutMS_
WheelTimerInstance & proxygen::WheelTimerInstance::operator= ( const WheelTimerInstance &&  timer)

Definition at line 82 of file WheelTimerInstance.cpp.

References defaultTimeoutMS_, folly::gen::move, and wheelTimerPtr_.

82  {
83  wheelTimerPtr_ = std::move(timer.wheelTimerPtr_);
84  defaultTimeoutMS_ = std::move(timer.defaultTimeoutMS_);
85  return *this;
86 }
folly::HHWheelTimer * wheelTimerPtr_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::chrono::milliseconds defaultTimeoutMS_
void proxygen::WheelTimerInstance::scheduleTimeout ( folly::HHWheelTimer::Callback callback,
std::chrono::milliseconds  timeout 
)

Definition at line 59 of file WheelTimerInstance.cpp.

References folly::HHWheelTimer::scheduleTimeout(), and wheelTimerPtr_.

Referenced by proxygen::HTTPSession::onConnectionSendWindowClosed(), proxygen::HTTPSession::onWriteSuccess(), proxygen::HTTPSession::readTimeoutExpired(), proxygen::HTTPSession::runLoopCallback(), and scheduleTimeout().

61  {
62  if (wheelTimerPtr_) {
63  wheelTimerPtr_->scheduleTimeout(callback, timeout);
64  } else {
65  VLOG(2) << "Ingoring scheduleTimeout on an empty WheelTimerInstance";
66  }
67 }
folly::HHWheelTimer * wheelTimerPtr_
void scheduleTimeout(Callback *callback, std::chrono::milliseconds timeout)
void proxygen::WheelTimerInstance::scheduleTimeout ( folly::HHWheelTimer::Callback callback)

Definition at line 69 of file WheelTimerInstance.cpp.

References defaultTimeoutMS_, and scheduleTimeout().

70  {
71  CHECK_GE(defaultTimeoutMS_.count(), 0);
73 }
std::chrono::milliseconds defaultTimeoutMS_
void scheduleTimeout(folly::HHWheelTimer::Callback *callback, std::chrono::milliseconds timeout)
void proxygen::WheelTimerInstance::setDefaultTimeout ( std::chrono::milliseconds  timeout)

Definition at line 55 of file WheelTimerInstance.cpp.

References defaultTimeoutMS_.

Member Data Documentation

std::chrono::milliseconds proxygen::WheelTimerInstance::defaultTimeoutMS_
private
folly::HHWheelTimer* proxygen::WheelTimerInstance::wheelTimerPtr_ {nullptr}
private

Definition at line 67 of file WheelTimerInstance.h.

Referenced by operator bool(), operator=(), scheduleTimeout(), and WheelTimerInstance().


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