ZOO-Project
Data Structures | Functions | Variables
service_callback.c File Reference
#include "service_json.h"
#include "service_internal_ms.h"
#include "sqlapi.h"
#include <pthread.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include "service_callback.h"

Data Structures

struct  local_params
 Parameter definition to be used for sending parameters to a thread. More...
 

Functions

bool isProhibited (maps *conf, const char *serviceName)
 Check if a service name is prohibited, meaning that the Kernel doesn't have to invoke the callback for this specific service. More...
 
void * _invokeCallback (void *args)
 Practically invoke the callback, meaning sending the HTTP POST request. More...
 
bool invokeCallback (maps *conf, maps *inputs, maps *outputs, int step, int state)
 Invoke the callback in case there is a [callback] section containing a url parameter. More...
 
void cleanupCallbackThreads ()
 Wait for the threads to end then, clean used memory. More...
 

Variables

int nbThreads =0
 Number of threads. More...
 
int cStep =0
 Current step. More...
 
int isOngoing =0
 Is there any ongoing HTTP request. More...
 
pthread_t * myThreads =NULL
 Threads array. More...
 
bool steps [7][2]
 Steps array. More...
 
local_params ** local_arguments
 Arguments array to give to the _invokeCallback thread's function. More...
 

Data Structure Documentation

struct local_params

Parameter definition to be used for sending parameters to a thread.

Data Fields
maps * conf the main configuration file
char * local_file
json_object * res the JSON object to post
int state the current state [0,1]
int step the current step [0,6]
char * target_file
map * url the callback url maps

Function Documentation

void* _invokeCallback ( void *  args)

Practically invoke the callback, meaning sending the HTTP POST request.

Parameters
argslocal_params containing all the variables required
void cleanupCallbackThreads ( )

Wait for the threads to end then, clean used memory.

bool invokeCallback ( maps conf,
maps inputs,
maps outputs,
int  step,
int  state 
)

Invoke the callback in case there is a [callback] section containing a url parameter.

Parameters
mthe maps containing the main configuration file definitions
inputsthe inputs defined in the request (can be null if not yet initialized)
inputsthe outputs provided in the request (can be null if not yet initialized)
stepthe step number, steps are defined as: 0: Analyze creation 1: Fetching Data Inputs 2: Uploading data inputs to cluster 3: Creating Job Script 4: Submitting Job to Cluster 5: Downloading processed output from cluster 6: Finalize 7: Dismiss or Error
state0 in case the step starts, 1 when it ends
Returns
bool true in case of success, false in other cases
bool isProhibited ( maps conf,
const char *  serviceName 
)

Check if a service name is prohibited, meaning that the Kernel doesn't have to invoke the callback for this specific service.

Parameters
confthe main configuration file maps
serviceNamethe serviceName
Returns
a bool true if the service is prohibited, false in other case

Variable Documentation

int cStep =0

Current step.

int isOngoing =0

Is there any ongoing HTTP request.

local_params** local_arguments

Arguments array to give to the _invokeCallback thread's function.

pthread_t* myThreads =NULL

Threads array.

int nbThreads =0

Number of threads.

bool steps[7][2]
Initial value:
={
{false,false},
{false,false},
{false,false},
{false,false},
{false,false},
{false,false},
{false,false}
}

Steps array.