#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. | |
DnxChannel * | dnxDispatcherGetChannel (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 struct iDnxDispatcher_ iDnxDispatcher |
The implementation data structure for a dispatcher object.
static void* dnxDispatcher | ( | void * | data | ) | [static] |
The dispatcher thread entry point.
[in] | data | - an opaque pointer to the dispatcher object. |
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.
[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. |
Definition at line 177 of file dnxDispatcher.c.
Referenced by dnxServerInit().
void dnxDispatcherDestroy | ( | DnxDispatcher * | disp | ) |
Destroy an existing dispatcher object.
[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.
[in] | disp | - the dispatcher from which to retrieve the channel. |
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.
[in] | idisp | - the dispatcher object. |
[in] | pSvcReq | - the service request to be dispatched. |
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.
[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. |
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().