Gearman-XS
view release on metacpan or search on metacpan
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
char *unique= NULL;
gearman_return_t ret;
const char *w;
size_t w_size;
void *result;
size_t result_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= SvPV(workload, w_size);
result= gearman_client_do(self->client, function_name, unique, w, w_size,
&result_size, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
if ((ret == GEARMAN_WORK_DATA) || (ret == GEARMAN_SUCCESS) || (ret == GEARMAN_WORK_WARNING))
{
XPUSHs(sv_2mortal(newSVpvn(result, result_size)));
Safefree(result);
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
char *unique= NULL;
gearman_return_t ret;
const char *w;
size_t w_size;
void *result;
size_t result_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= SvPV(workload, w_size);
result= gearman_client_do_high(self->client, function_name, unique, w,
w_size, &result_size, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
if ((ret == GEARMAN_WORK_DATA) || (ret == GEARMAN_SUCCESS) || (ret == GEARMAN_WORK_WARNING))
{
XPUSHs(sv_2mortal(newSVpvn(result, result_size)));
Safefree(result);
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
char *unique= NULL;
gearman_return_t ret;
const char *w;
size_t w_size;
void *result;
size_t result_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= SvPV(workload, w_size);
result= gearman_client_do_low(self->client, function_name, unique, w,
w_size, &result_size, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
if ((ret == GEARMAN_WORK_DATA) || (ret == GEARMAN_SUCCESS) || (ret == GEARMAN_WORK_WARNING))
{
XPUSHs(sv_2mortal(newSVpvn(result, result_size)));
Safefree(result);
do_background(self, function_name, workload, ...)
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
char *job_handle;
char *unique= NULL;
const char *w;
size_t w_size;
gearman_return_t ret;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
Newxz(job_handle, GEARMAN_JOB_HANDLE_SIZE, char);
w= SvPV(workload, w_size);
ret= gearman_client_do_background(self->client, function_name, unique, w,
w_size, job_handle);
XPUSHs(sv_2mortal(newSViv(ret)));
if (ret != GEARMAN_SUCCESS)
{
Safefree(job_handle);
do_high_background(self, function_name, workload, ...)
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
char *job_handle;
char *unique= NULL;
const char *w;
size_t w_size;
gearman_return_t ret;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
Newxz(job_handle, GEARMAN_JOB_HANDLE_SIZE, char);
w= SvPV(workload, w_size);
ret= gearman_client_do_high_background(self->client, function_name, unique,
w, w_size, job_handle);
XPUSHs(sv_2mortal(newSViv(ret)));
if (ret != GEARMAN_SUCCESS)
{
Safefree(job_handle);
do_low_background(self, function_name, workload, ...)
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
char *job_handle;
char *unique= NULL;
const char *w;
size_t w_size;
gearman_return_t ret;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
Newxz(job_handle, GEARMAN_JOB_HANDLE_SIZE, char);
w= SvPV(workload, w_size);
ret= gearman_client_do_low_background(self->client, function_name, unique,
w, w_size, job_handle);
XPUSHs(sv_2mortal(newSViv(ret)));
if (ret != GEARMAN_SUCCESS)
{
Safefree(job_handle);
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
gearman_task_st *task;
char *unique= NULL;
gearman_return_t ret;
gearman_task_context_st *context;
const void *w;
size_t w_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= _get_string(workload, &w_size);
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
context->workload= w;
task= gearman_client_add_task(self->client, NULL, context, function_name,
unique, w, w_size, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
XPUSHs(sv_2mortal(_bless("Gearman::XS::Task", task)));
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
gearman_task_st *task;
char *unique= NULL;
gearman_return_t ret;
gearman_task_context_st *context;
const void *w;
size_t w_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= _get_string(workload, &w_size);
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
context->workload= w;
task= gearman_client_add_task_high(self->client, NULL, context,
function_name, unique, w, w_size, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
gearman_task_st *task;
char *unique= NULL;
gearman_return_t ret;
gearman_task_context_st *context;
const void *w;
size_t w_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= _get_string(workload, &w_size);
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
context->workload= w;
task= gearman_client_add_task_low(self->client, NULL, context,
function_name, unique, w, w_size, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
gearman_task_st *task;
char *unique= NULL;
gearman_return_t ret;
gearman_task_context_st *context;
const void *w;
size_t w_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= _get_string(workload, &w_size);
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
context->workload= w;
task= gearman_client_add_task_background(self->client, NULL, context,
function_name, unique, w, w_size,
&ret);
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
gearman_task_st *task;
char *unique= NULL;
gearman_return_t ret;
gearman_task_context_st *context;
const void *w;
size_t w_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= _get_string(workload, &w_size);
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
context->workload= w;
task= gearman_client_add_task_high_background(self->client, NULL, context,
function_name, unique, w,
w_size, &ret);
gearman_xs_client *self
const char *function_name
SV * workload
PREINIT:
gearman_task_st *task;
char *unique= NULL;
gearman_return_t ret;
gearman_task_context_st *context;
const void *w;
size_t w_size;
PPCODE:
if (items > 3)
unique= SvPV_nolen(ST(3));
w= _get_string(workload, &w_size);
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
context->workload= w;
task= gearman_client_add_task_low_background(self->client, NULL, context,
function_name, unique, w,
w_size, &ret);
RETVAL= gearman_client_error(self->client);
OUTPUT:
RETVAL
void
do_status(self)
gearman_xs_client *self
PREINIT:
uint32_t numerator;
uint32_t denominator;
PPCODE:
gearman_client_do_status(self->client, &numerator, &denominator);
XPUSHs(sv_2mortal(newSVuv(numerator)));
XPUSHs(sv_2mortal(newSVuv(denominator)));
void
job_status(self, job_handle= NULL)
gearman_xs_client *self
const char *job_handle
PREINIT:
gearman_return_t ret;
bool is_known;
bool is_running;
uint32_t numerator;
uint32_t denominator;
PPCODE:
ret= gearman_client_job_status(self->client, job_handle, &is_known, &is_running,
&numerator, &denominator);
XPUSHs(sv_2mortal(newSViv(ret)));
XPUSHs(sv_2mortal(newSViv(is_known)));
XPUSHs(sv_2mortal(newSViv(is_running)));
XPUSHs(sv_2mortal(newSVuv(numerator)));
XPUSHs(sv_2mortal(newSVuv(denominator)));
int
timeout(self)
RETVAL
void
add_task_status(self, job_handle)
gearman_xs_client *self
const char *job_handle
PREINIT:
gearman_task_st *task;
gearman_return_t ret;
gearman_task_context_st *context;
PPCODE:
Newxz(context, 1, gearman_task_context_st);
context->client= self->client;
task= gearman_client_add_task_status(self->client, NULL, context, job_handle, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
XPUSHs(sv_2mortal(_bless("Gearman::XS::Task", task)));
void
clear_fn(self)
gearman_xs_client *self
CODE:
unique(self)
gearman_xs_task *self
CODE:
RETVAL= gearman_task_unique(self);
OUTPUT:
RETVAL
void
is_known(self)
gearman_xs_task *self
PPCODE:
if (gearman_task_is_known(self))
XSRETURN_YES;
else
XSRETURN_NO;
void
is_running(self)
gearman_xs_task *self
PPCODE:
if (gearman_task_is_running(self))
XSRETURN_YES;
else
XSRETURN_NO;
gearman_xs_worker *self
gearman_worker_options_t options
CODE:
gearman_worker_remove_options(self, options);
void
grab_job(self)
gearman_xs_worker *self
PREINIT:
gearman_return_t ret;
PPCODE:
gearman_job_st *job= gearman_worker_grab_job(self, NULL, &ret);
XPUSHs(sv_2mortal(newSViv(ret)));
if (ret == GEARMAN_SUCCESS)
XPUSHs(sv_2mortal(_bless("Gearman::XS::Job", job)));
else
XPUSHs(&PL_sv_undef);
int
timeout(self)
gearman_xs_worker *self
gearman_xs_worker *self
SV * fn
gearman_verbose_t verbose
CODE:
gearman_worker_set_log_fn(self, _perl_log_fn_callback, newSVsv(fn), verbose);
void
function_exists(self, function_name)
gearman_xs_worker *self
const char *function_name
PPCODE:
if (gearman_worker_function_exist(self, function_name, strlen(function_name)))
XSRETURN_YES;
else
XSRETURN_NO;
void
DESTROY(self)
gearman_xs_worker *self
CODE:
gearman_worker_free(self);
( run in 1.960 second using v1.01-cache-2.11-cpan-5511b514fd6 )