Classes | Enumerator | Functions

Network Request Queue
[Networking Libraries]


A network request queue. More...

Collaboration diagram for Network Request Queue:

Classes

class  netrq::Request
 Base class from which clients can inherit. More...
class  netrq::Queue
 basic network request queue. More...

Functions

virtual const char * netrq::Request::getId (void) const =0 throw ()
virtual int netrq::Request::getMaxBytes (void) const =0 throw ()
virtual void netrq::Request::write (IO xdrbuf::Output *output)=0
virtual int netrq::Request::getRetryInterval (void) const throw ()
 if non-zero, this request is asking to be resent after the specified clock interval
virtual int netrq::Queue::size (void)=0
 Returns count of requests in queue.
virtual eInsertResult netrq::Queue::addRequest (IN dword_t sendClock, IN smart_ptr< Request > &request)=0
 If the addRequest fails due to a collision, the return value will tell the client whether the existing request has an earlier or later clock than what was just requested.
virtual bool netrq::Queue::getNextRequest (IN dword_t clock, OUT smart_ptr< Request > &request)=0
 returns the next request that should be sent.
virtual bool netrq::Queue::containsRequest (IN const char *id)=0
 does the queue already contain a request with this id?
virtual bool netrq::Queue::removeRequest (IN const char *id)=0



virtual netrq::Queue::~Queue (void) throw ()
static smart_ptr< Queue > netrq::Queue::create (void)
int netrq::sendMessagesFromQueue (IO xdrbuf::Output *output, IN dword_t clock,IO Queue *queue)
 Given an output buffer, write as many pending requests as possible.
virtual netrq::Request::~Request (void) throw ()

Detailed Description


A network request queue.

Clients can add requests with an ID and priority. Later, clients can pull the most immediate requests from the queue, and that request will be backed off. Finally, clients can remove requests altogether.

The client must construct IDs on its own.

This library makes use of a "clock". In the context of a network request queue, this is just a serial counter, not a timer. There is a clock tick per datagram sent out. This library relies on the client maintaining its own clock, and respects whatever the client provides as far as current and requested clock values.


Function Documentation

virtual const char* netrq::Request::getId ( void   )  const throw () [pure virtual, inherited]
virtual int netrq::Request::getMaxBytes ( void   )  const throw () [pure virtual, inherited]
virtual void netrq::Request::write ( IO xdrbuf::Output output  )  [pure virtual, inherited]
virtual int netrq::Request::getRetryInterval ( void   )  const throw () [inline, virtual, inherited]

if non-zero, this request is asking to be resent after the specified clock interval

Definition at line 88 of file netrq.h.

netrq::Queue::~Queue ( void   )  throw () [virtual, inherited]

Definition at line 43 of file netrq.cpp.

virtual int netrq::Queue::size ( void   )  [pure virtual, inherited]

Returns count of requests in queue.

Approximate only, since other threads may update the queue by the time the caller gets the count.

virtual eInsertResult netrq::Queue::addRequest ( IN dword_t  sendClock,
IN smart_ptr< Request > &  request 
) [pure virtual, inherited]

If the addRequest fails due to a collision, the return value will tell the client whether the existing request has an earlier or later clock than what was just requested.

Parameters:
sendClock send at this clock
virtual bool netrq::Queue::getNextRequest ( IN dword_t  clock,
OUT smart_ptr< Request > &  request 
) [pure virtual, inherited]

returns the next request that should be sent.

The clock value is the current packet count, not the time. So for instance, if you are using this queue to manage UDP data, increment the clock everytime you send a UDP packet.

Parameters:
clock current clock
virtual bool netrq::Queue::containsRequest ( IN const char *  id  )  [pure virtual, inherited]

does the queue already contain a request with this id?

virtual bool netrq::Queue::removeRequest ( IN const char *  id  )  [pure virtual, inherited]
smart_ptr< Queue > netrq::Queue::create ( void   )  [static, inherited]

Definition at line 344 of file netrq.cpp.

int netrq::sendMessagesFromQueue ( IO xdrbuf::Output output,
IN dword_t  clock,
IO Queue *  queue 
)

Given an output buffer, write as many pending requests as possible.

All sent messages are removed from the queue. Returns the number of messages sent. See the netrq library comments regarding the clock values.

Parameters:
clock current clock
netrq::Request::~Request ( void   )  throw () [virtual, inherited]

Definition at line 42 of file netrq.cpp.