Added query calls using LBProxy
authorMiloš Mulač <mulac@civ.zcu.cz>
Fri, 26 Nov 2004 16:12:59 +0000 (16:12 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Fri, 26 Nov 2004 16:12:59 +0000 (16:12 +0000)
org.glite.lb.client-interface/interface/consumer.h
org.glite.lb.client-interface/project/version.properties
org.glite.lb.client/src/consumer.c

index 74b12a3..7c57820 100644 (file)
@@ -150,6 +150,24 @@ int edg_wll_QueryEventsExt(
        edg_wll_Event **                events
 );
 
+
+/**
+ * Query LBProxy and use plain communication
+ */
+int edg_wll_QueryEventsProxy(
+       edg_wll_Context                 context,
+       const edg_wll_QueryRec *        job_conditions,
+       const edg_wll_QueryRec *        event_conditions,
+       edg_wll_Event **                events
+);
+
+int edg_wll_QueryEventsExtProxy(
+       edg_wll_Context                 context,
+       const edg_wll_QueryRec **       job_conditions,
+       const edg_wll_QueryRec **       event_conditions,
+       edg_wll_Event **                events
+);
+
 /** 
  * General query on jobs.
  * Return jobs (and possibly their states) for which an event satisfying the conditions
@@ -177,6 +195,27 @@ int edg_wll_QueryJobsExt(
        edg_wll_JobStat **              states
 );
 
+
+/**
+ * Query LBProxy and use plain communication
+ */
+int edg_wll_QueryJobsProxy(
+       edg_wll_Context                 context,
+       const edg_wll_QueryRec *        conditions,
+       int                             flags,
+       edg_wlc_JobId **                jobs,
+       edg_wll_JobStat **              states
+);
+
+int edg_wll_QueryJobsExtProxy(
+       edg_wll_Context                 context,
+       const edg_wll_QueryRec **       conditions,
+       int                             flags,
+       edg_wlc_JobId **                jobs,
+       edg_wll_JobStat **              states
+);
+
+
 /**
  * Bitmasks for edg_wll_JobStatus() flags argument.
  * Settings these flags causes the status calls to retrieve additional
@@ -202,6 +241,16 @@ int edg_wll_JobStatus(
 );
 
 /**
+ * Query LBProxy and use plain communication
+ */
+int edg_wll_JobStatusProxy(
+       edg_wll_Context         context,
+       const edg_wlc_JobId             jobid,
+       int                     flags,
+       edg_wll_JobStat         *status
+);
+
+/**
  * Return all events related to a single job.
  * Convenience wrapper around edg_wll_Query()
  * \param context IN: context to work with
@@ -215,6 +264,16 @@ int edg_wll_JobLog(
        edg_wll_Event **        events
 );
 
+
+/**
+ * Query LBProxy and use plain communication
+ */
+int edg_wll_JobLogProxy(
+       edg_wll_Context         context,
+       const edg_wlc_JobId     jobId,
+       edg_wll_Event **        events
+);
+
 /**
  * All current user's jobs.
  * \param context IN: context to work with
@@ -227,6 +286,16 @@ int edg_wll_UserJobs(
        edg_wll_JobStat **      states
 );
 
+
+/**
+ * Query LBProxy and use plain communication
+ */
+int edg_wll_UserJobsProxy(
+       edg_wll_Context         context,
+       edg_wlc_JobId **        jobs,
+       edg_wll_JobStat **      states
+);
+
 /**
  * Server supported indexed attributes
  * \see DataGrid-01-TEN-0125
@@ -270,6 +339,17 @@ int edg_wll_QueryListener(
 
 
 /**
+ * Query LBProxy and use plain communication
+ */
+int edg_wll_QueryListener(
+       edg_wll_Context context,
+       edg_wlc_JobId           jobId,
+       const char *    name,
+       char **         host,
+       uint16_t *      port
+);
+
+/**
  * Ask LB Proxy server for sequence number
  * \param context IN: context to work with
  * \param jobId IN: job to query
index 2510100..06f601a 100644 (file)
@@ -1,4 +1,4 @@
 #Fri Nov 26 05:53:49 CET 2004
-module.version=0.3.0
+module.version=0.3.1
 module.build=96
 module.age=2
index 09abdd5..bad3f4b 100644 (file)
@@ -35,7 +35,6 @@ int edg_wll_QueryEventsExt(
                const edg_wll_QueryRec **event_conditions,
                edg_wll_Event **eventsOut)
 {
-       int     error           = 0;
        char    *response       = NULL,
                *message        = NULL,
                *send_mess      = NULL;
@@ -48,14 +47,22 @@ int edg_wll_QueryEventsExt(
                goto err;
        }
 
-       if ((error = set_server_name_and_port(ctx,job_conditions)))
-               goto err; // XXX is it fatal??
-
        ctx->p_tmp_timeout = ctx->p_query_timeout;
-       error = edg_wll_http_send_recv(ctx, "POST /queryEvents HTTP/1.1",request_headers,send_mess,
-                                                                 &response,NULL,&message);
-       if ( error != 0 )
-               goto err;
+       
+       if (ctx->isProxy) {
+               ctx->isProxy = 0;
+               if (edg_wll_http_send_recv_proxy(ctx, "POST /queryEvents HTTP/1.1",
+                               request_headers,send_mess, &response,NULL,&message))
+                       goto err;
+       }
+       else {
+               if (set_server_name_and_port(ctx,job_conditions))
+                       goto err; // XXX is it fatal??
+
+               if (edg_wll_http_send_recv(ctx, "POST /queryEvents HTTP/1.1",
+                               request_headers,send_mess, &response,NULL,&message))
+                       goto err;
+       }
 
        if (http_check_status(ctx,response))
                goto err;
@@ -150,14 +157,22 @@ int edg_wll_QueryJobsExt(
                goto err;
        }
 
-       if (set_server_name_and_port(ctx, conditions))
-               goto err;
-
        ctx->p_tmp_timeout = ctx->p_query_timeout;
 
-       if (edg_wll_http_send_recv(ctx, "POST /queryJobs HTTP/1.1",request_headers,send_mess,
-                       &response,NULL,&message)) 
-               goto err;
+       if (ctx->isProxy){
+               ctx->isProxy = 0;
+               if (edg_wll_http_send_recv_proxy(ctx, "POST /queryJobs HTTP/1.1",
+                               request_headers,send_mess,&response,NULL,&message))
+                       goto err;
+       }
+       else {                          
+               if (set_server_name_and_port(ctx, conditions))
+                       goto err;
+
+               if (edg_wll_http_send_recv(ctx, "POST /queryJobs HTTP/1.1",
+                                       request_headers,send_mess,&response,NULL,&message)) 
+                       goto err;
+       }
          
        if (http_check_status(ctx,response))
                goto err;
@@ -381,7 +396,7 @@ int edg_wll_QuerySequenceCode(edg_wll_Context ctx, edg_wlc_JobId jobId, char **c
                goto err;
        }
 
-       // ctx->p_tmp_timeout = ctx->p_query_timeout; // not used
+       ctx->p_tmp_timeout = ctx->p_query_timeout; 
        
        error = edg_wll_http_send_recv_proxy(ctx, "POST /querySequenceCode HTTP/1.1",
                        request_headers, send_mess, &response, NULL, &message);
@@ -463,3 +478,107 @@ int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_c
                
        return(error);
 }
+
+
+/******************************************************************
+ * Proxy wrappers
+ */
+
+
+int edg_wll_QueryEventsExtProxy(
+               edg_wll_Context ctx,
+               const edg_wll_QueryRec **job_conditions,
+               const edg_wll_QueryRec **event_conditions,
+               edg_wll_Event **eventsOut)
+{
+       ctx->isProxy = 1;
+
+       return edg_wll_QueryEventsExt(ctx, job_conditions, event_conditions, eventsOut);
+}
+
+
+
+int edg_wll_QueryEventsProxy(
+               edg_wll_Context ctx,
+               const edg_wll_QueryRec *job_conditions,
+               const edg_wll_QueryRec *event_conditions,
+               edg_wll_Event **eventsOut)
+{
+       ctx->isProxy = 1;
+       
+       return edg_wll_QueryEvents(ctx, job_conditions, event_conditions, eventsOut);
+}
+
+
+
+int edg_wll_QueryJobsExtProxy(
+               edg_wll_Context         ctx,
+               const edg_wll_QueryRec **        conditions,
+               int                     flags,
+               edg_wlc_JobId **        jobsOut,
+               edg_wll_JobStat **      statesOut)
+{      
+       ctx->isProxy = 1;
+       
+       return edg_wll_QueryJobsExt(ctx, conditions, flags, jobsOut, statesOut);
+}
+
+
+
+int edg_wll_QueryJobsProxy(
+               edg_wll_Context         ctx,
+               const edg_wll_QueryRec *        conditions,
+               int                     flags,
+               edg_wlc_JobId **        jobsOut,
+               edg_wll_JobStat **      statesOut)
+{
+       ctx->isProxy = 1;
+       
+       return edg_wll_QueryJobs(ctx, conditions, flags, jobsOut, statesOut);
+}
+
+
+int edg_wll_UserJobsProxy(
+               edg_wll_Context ctx,
+               edg_wlc_JobId **jobsOut,
+               edg_wll_JobStat **statesOut)
+{
+       ctx->isProxy = 1;
+       
+       return edg_wll_UserJobs(ctx, jobsOut, statesOut);
+}
+
+int edg_wll_JobLogProxy(
+       edg_wll_Context ctx,
+       edg_wlc_JobId   job,
+       edg_wll_Event **eventsOut)
+{
+       ctx->isProxy = 1;
+
+       return edg_wll_JobLog(ctx, job, eventsOut);
+}
+
+int edg_wll_JobStatusProxy(
+                edg_wll_Context ctx,
+                edg_wlc_JobId job,
+                int flags,
+                edg_wll_JobStat *stat)
+{
+       ctx->isProxy = 1;
+               
+       return edg_wll_JobStatus(ctx, job, flags, stat);
+}
+
+
+       
+int edg_wll_QueryListenerProxy(
+               edg_wll_Context ctx,
+               edg_wlc_JobId job,
+               const char *name,
+               char** host,
+               uint16_t *port) 
+{
+       ctx->isProxy = 1;
+
+       return edg_wll_QueryListener(ctx, job, name, host, port);
+}