proxygen
proxygen::QueueTest Class Reference
Inheritance diagram for proxygen::QueueTest:
testing::Test proxygen::DanglingQueueTest

Public Member Functions

 QueueTest (HHWheelTimer *timer=nullptr)
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Protected Member Functions

void addTransaction (HTTPCodec::StreamID id, http2::PriorityUpdate pri, bool pnode=false, uint64_t *depth=nullptr)
 
void removeTransaction (HTTPCodec::StreamID id)
 
void updatePriority (HTTPCodec::StreamID id, http2::PriorityUpdate pri, uint64_t *depth=nullptr)
 
void signalEgress (HTTPCodec::StreamID id, bool mark)
 
void buildSimpleTree ()
 
bool visitNode (HTTP2PriorityQueue &, HTTPCodec::StreamID id, HTTPTransaction *, double r)
 
void dump ()
 
void dumpBFS (const std::function< bool()> &stopFn)
 
void nextEgress (bool spdyMode=false)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Protected Attributes

HTTP2PriorityQueue q_
 
std::map< HTTPCodec::StreamID, HTTP2PriorityQueue::Handlehandles_
 
IDList nodes_
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 52 of file HTTP2PriorityQueueTest.cpp.

Constructor & Destructor Documentation

proxygen::QueueTest::QueueTest ( HHWheelTimer timer = nullptr)
inlineexplicit

Definition at line 54 of file HTTP2PriorityQueueTest.cpp.

55  : q_(WheelTimerInstance(timer)) {
56  }

Member Function Documentation

void proxygen::QueueTest::addTransaction ( HTTPCodec::StreamID  id,
http2::PriorityUpdate  pri,
bool  pnode = false,
uint64_t depth = nullptr 
)
inlineprotected

Definition at line 59 of file HTTP2PriorityQueueTest.cpp.

References h.

60  {
63  id, pri, pnode ? nullptr : makeFakeTxn(id), false, depth);
64  handles_.insert(std::make_pair(id, h));
65  if (!pnode) {
66  signalEgress(id, 1);
67  }
68  }
*than *hazptr_holder h
Definition: Hazptr.h:116
Handle addTransaction(HTTPCodec::StreamID id, http2::PriorityUpdate pri, HTTPTransaction *txn, bool permanent=false, uint64_t *depth=nullptr) override
void signalEgress(HTTPCodec::StreamID id, bool mark)
std::map< HTTPCodec::StreamID, HTTP2PriorityQueue::Handle > handles_
void proxygen::QueueTest::buildSimpleTree ( )
inlineprotected

Definition at line 87 of file HTTP2PriorityQueueTest.cpp.

87  {
88  addTransaction(1, {0, false, 15});
89  addTransaction(3, {1, false, 3});
90  addTransaction(5, {1, false, 3});
91  addTransaction(7, {1, false, 7});
92  addTransaction(9, {5, false, 7});
93  }
void addTransaction(HTTPCodec::StreamID id, http2::PriorityUpdate pri, bool pnode=false, uint64_t *depth=nullptr)
void proxygen::QueueTest::dump ( )
inlineprotected

Definition at line 101 of file HTTP2PriorityQueueTest.cpp.

References folly::netops::bind().

101  {
102  nodes_.clear();
103  q_.iterate(std::bind(&QueueTest::visitNode, this, std::ref(q_), _1, _2, _3),
104  [] { return false; }, true);
105  }
bool visitNode(HTTP2PriorityQueue &, HTTPCodec::StreamID id, HTTPTransaction *, double r)
void iterate(const std::function< bool(HTTPCodec::StreamID, HTTPTransaction *, double)> &fn, const std::function< bool()> &stopFn, bool all)
int bind(NetworkSocket s, const sockaddr *name, socklen_t namelen)
Definition: NetOps.cpp:76
void proxygen::QueueTest::dumpBFS ( const std::function< bool()> &  stopFn)
inlineprotected

Definition at line 107 of file HTTP2PriorityQueueTest.cpp.

References folly::netops::bind().

107  {
108  nodes_.clear();
109  q_.iterateBFS(std::bind(&QueueTest::visitNode, this, _1, _2, _3, _4),
110  stopFn, true);
111  }
bool visitNode(HTTP2PriorityQueue &, HTTPCodec::StreamID id, HTTPTransaction *, double r)
int bind(NetworkSocket s, const sockaddr *name, socklen_t namelen)
Definition: NetOps.cpp:76
void iterateBFS(const std::function< bool(HTTP2PriorityQueue &, HTTPCodec::StreamID, HTTPTransaction *, double)> &fn, const std::function< bool()> &stopFn, bool all)
void proxygen::QueueTest::nextEgress ( bool  spdyMode = false)
inlineprotected

Definition at line 113 of file HTTP2PriorityQueueTest.cpp.

113  {
114  HTTP2PriorityQueue::NextEgressResult nextEgressResults;
115  q_.nextEgress(nextEgressResults, spdyMode);
116  nodes_.clear();
117  for (auto p: nextEgressResults) {
118  nodes_.push_back(std::make_pair(getTxnID(p.first), p.second * 100));
119  }
120  }
std::vector< std::pair< HTTPTransaction *, double >> NextEgressResult
void nextEgress(NextEgressResult &result, bool spdyMode=false)
void proxygen::QueueTest::removeTransaction ( HTTPCodec::StreamID  id)
inlineprotected

Definition at line 70 of file HTTP2PriorityQueueTest.cpp.

70  {
72  }
void removeTransaction(Handle handle) override
std::map< HTTPCodec::StreamID, HTTP2PriorityQueue::Handle > handles_
void proxygen::QueueTest::signalEgress ( HTTPCodec::StreamID  id,
bool  mark 
)
inlineprotected

Definition at line 79 of file HTTP2PriorityQueueTest.cpp.

79  {
80  if (mark) {
82  } else {
84  }
85  }
void clearPendingEgress(Handle h) override
void signalPendingEgress(Handle h) override
std::map< HTTPCodec::StreamID, HTTP2PriorityQueue::Handle > handles_
void proxygen::QueueTest::updatePriority ( HTTPCodec::StreamID  id,
http2::PriorityUpdate  pri,
uint64_t depth = nullptr 
)
inlineprotected

Definition at line 74 of file HTTP2PriorityQueueTest.cpp.

75  {
76  handles_[id] = q_.updatePriority(handles_[id], pri, depth);
77  }
Handle updatePriority(Handle handle, http2::PriorityUpdate pri, uint64_t *depth=nullptr) override
std::map< HTTPCodec::StreamID, HTTP2PriorityQueue::Handle > handles_
bool proxygen::QueueTest::visitNode ( HTTP2PriorityQueue ,
HTTPCodec::StreamID  id,
HTTPTransaction ,
double  r 
)
inlineprotected

Definition at line 95 of file HTTP2PriorityQueueTest.cpp.

96  {
97  nodes_.push_back(std::make_pair(id, r * 100));
98  return false;
99  }

Member Data Documentation

std::map<HTTPCodec::StreamID, HTTP2PriorityQueue::Handle> proxygen::QueueTest::handles_
protected

Definition at line 123 of file HTTP2PriorityQueueTest.cpp.

IDList proxygen::QueueTest::nodes_
protected

Definition at line 124 of file HTTP2PriorityQueueTest.cpp.

HTTP2PriorityQueue proxygen::QueueTest::q_
protected

Definition at line 122 of file HTTP2PriorityQueueTest.cpp.


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