dnxDispatcher.c File Reference

#include "dnxDispatcher.h"
#include "dnxError.h"
#include "dnxDebug.h"
#include "dnxProtocol.h"
#include "dnxXml.h"
#include "dnxServerMain.h"
#include "dnxRegistrar.h"
#include "dnxJobList.h"
#include "dnxLogging.h"
#include "dnxStats.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  iDnxDispatcher_
 The implementation data structure for a dispatcher object. More...

Typedefs

typedef struct iDnxDispatcher_ iDnxDispatcher
 The implementation data structure for a dispatcher object.

Functions

static int dnxSendJobMsg (iDnxDispatcher *idisp, DnxNewJob *pSvcReq, DnxNodeRequest *pNode)
 Send a job to a designated client node.
static int dnxDispatchJob (iDnxDispatcher *idisp, DnxNewJob *pSvcReq)
 Send a service request to the appropriate worker node.
static void * dnxDispatcher (void *data)
 The dispatcher thread entry point.
DnxChanneldnxDispatcherGetChannel (DnxDispatcher *disp)
 Return the internal comm channel used by the dispatcher.
int dnxDispatcherCreate (char *chname, char *url, DnxJobList *joblist, DnxDispatcher **pdisp)
 Create a new dispatcher object.
void dnxDispatcherDestroy (DnxDispatcher *disp)
 Destroy an existing dispatcher object.


Typedef Documentation

The implementation data structure for a dispatcher object.


Function Documentation

static void* dnxDispatcher ( void *  data  )  [static]

The dispatcher thread entry point.

Parameters:
[in] data - an opaque pointer to the dispatcher object.
Returns:
Always returns NULL.

Definition at line 131 of file dnxDispatcher.c.

References DnxNodeRequest::address, DISPATCHES_FAILED, DISPATCHES_OK, DNX_OK, dnxAuditJob(), dnxDispatchJob(), dnxJobListDispatch(), dnxLog(), dnxStatsInc(), iDnxDispatcher_::joblist, and DnxNewJob::pNode.

Referenced by dnxDispatcherCreate().

int dnxDispatcherCreate ( char *  chname,
char *  url,
DnxJobList joblist,
DnxDispatcher **  pdisp 
)

Create a new dispatcher object.

Parameters:
[in] chname - the name of the dispatch channel.
[in] url - the dispatcher channel url.
[in] joblist - a pointer to the global job list object.
[out] pdisp - the address of storage for the return of the new dispatcher object.
Returns:
Zero on success, or a non-zero error value.

Definition at line 177 of file dnxDispatcher.c.

Referenced by dnxServerInit().

void dnxDispatcherDestroy ( DnxDispatcher disp  ) 

Destroy an existing dispatcher object.

Parameters:
[in] disp - a pointer to the dispatcher object to be destroyed.

Definition at line 239 of file dnxDispatcher.c.

Referenced by dnxServerDeInit().

DnxChannel* dnxDispatcherGetChannel ( DnxDispatcher disp  ) 

Return the internal comm channel used by the dispatcher.

Return a reference to the dispatcher channel object.

This method exists so the registrar can send a job on the same socket from which it received a job request.

Parameters:
[in] disp - the dispatcher from which to retrieve the channel.
Returns:
the DnxChannel object belonging to disp.

Definition at line 172 of file dnxDispatcher.c.

Referenced by dnxServerInit().

static int dnxDispatchJob ( iDnxDispatcher idisp,
DnxNewJob pSvcReq 
) [static]

Send a service request to the appropriate worker node.

Parameters:
[in] idisp - the dispatcher object.
[in] pSvcReq - the service request to be dispatched.
Returns:
Zero on success, or a non-zero error value.

Todo:
Implement the fork-error re-scheduling logic as found in run_service_check() in checks.c.

Definition at line 109 of file dnxDispatcher.c.

References dnxSendJobMsg(), and DnxNewJob::pNode.

Referenced by dnxDispatcher().

static int dnxSendJobMsg ( iDnxDispatcher idisp,
DnxNewJob pSvcReq,
DnxNodeRequest pNode 
) [static]

Send a job to a designated client node.

Parameters:
[in] idisp - the dispatcher object.
[in] pSvcReq - the service request block belonging to the client node we're targeting.
[in] pNode - the dnx request node to be sent.
Returns:
Zero on success, or a non-zero error value.

Definition at line 74 of file dnxDispatcher.c.

References DnxNodeRequest::address, DnxNodeRequest::addrstr, iDnxDispatcher_::channel, DnxJob::cmd, DnxNewJob::cmd, DNX_JOB_PENDING, DNX_OK, dnxDebug(), dnxErrorString(), dnxLog(), dnxSendJob(), DnxXID::objSerial, DnxXID::objSlot, DnxJob::priority, DnxJob::state, DnxNewJob::timeout, DnxJob::timeout, DnxJob::xid, and DnxNewJob::xid.

Referenced by dnxDispatchJob().


Generated on Tue Apr 13 15:15:30 2010 for DNX by  doxygen 1.5.6