|
|||
|
|||
|
#include <m_sqlv2.h>
Inheritance diagram for QueryQueue:


Public Member Functions | |
| QueryQueue () | |
| void | push (const SQLrequest &q) |
| void | pop () |
| SQLrequest & | front () |
| std::pair< int, int > | size () |
| int | totalsize () |
| void | PurgeModule (Module *mod) |
Private Types | |
| typedef std::deque< SQLrequest > | ReqDeque |
| enum | { PRI, NOR, NON } |
Private Member Functions | |
| void | DoPurgeModule (Module *mod, ReqDeque &q) |
Private Attributes | |
| ReqDeque | priority |
| ReqDeque | normal |
| enum QueryQueue:: { ... } | which |
This maintains two queues internally, one for 'priority' queries and one for less important ones. Each queue has new queries appended to it and ones to execute are popped off the front. This keeps them flowing round nicely and no query should ever get 'stuck' for too long. If there are queries in the priority queue they will be executed first, 'unimportant' queries will only be executed when the priority queue is empty.
We store lists of SQLrequest's here, by value as we want to avoid storing any data allocated inside the client module (in case that module is unloaded while the query is in progress).
Because we want to work on the current SQLrequest in-situ, we need a way of accessing the request we are currently processing, QueryQueue::front(), but that call needs to always return the same request until that request is removed from the queue, this is what the 'which' variable is. New queries are always added to the back of one of the two queues, but if when front() is first called then the priority queue is empty then front() will return a query from the normal queue, but if a query is then added to the priority queue then front() must continue to return the front of the *normal* queue until pop() is called.
Definition at line 497 of file m_sqlv2.h.
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 584 of file m_sqlv2.h. References front(), and SQLrequest::id. Referenced by PurgeModule(). |
|
|
Definition at line 537 of file m_sqlv2.h. References NOR, normal, PRI, priority, and which. Referenced by SQLConn::DoConnectedPoll(), SQLConnection::DoLeadingQuery(), SQLConn::DoLeadingQuery(), DoPurgeModule(), and SQLConn::Query(). |
|
|
Definition at line 520 of file m_sqlv2.h. References NON, NOR, normal, PRI, priority, and which. Referenced by SQLConn::DoConnectedPoll(), DispatcherThread::Run(), and QueryThread::Run(). |
|
|
Definition at line 577 of file m_sqlv2.h. References DoPurgeModule(), normal, and priority. Referenced by SQLConn::OnUnloadModule(). |
|
|
Definition at line 512 of file m_sqlv2.h. References normal, SQLrequest::pri, and priority. Referenced by SQLConn::Query(). |
|
|
|
|
|
Definition at line 572 of file m_sqlv2.h. References normal, and priority. Referenced by SQLConn::DoConnectedPoll(), and SQLConn::Query(). |
|
|
Definition at line 503 of file m_sqlv2.h. Referenced by front(), pop(), PurgeModule(), push(), size(), and totalsize(). |
|
|
Definition at line 502 of file m_sqlv2.h. Referenced by front(), pop(), PurgeModule(), push(), size(), and totalsize(). |
|
|
|