GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GEARMAN::XS::CLIENT (3)

.ds Aq ’

NAME

Gearman::XS::Client - Perl client for gearman using libgearman

CONTENTS

SYNOPSIS



  use Gearman::XS qw(:constants);
  use Gearman::XS::Client;

  $client = new Gearman::XS::Client;

  $ret = $client->add_server($host, $port);
  if ($ret != GEARMAN_SUCCESS)
  {
    printf(STDERR "%s\n", $client->error());
    exit(1);
  }

  # single client interface
  ($ret, $result) = $client->do("reverse", teststring);
  if ($ret == GEARMAN_SUCCESS)
  {
    printf("Result=%s\n", $result);
  }

  # background client interface
  ($ret, $job_handle) = $client->do_background(reverse, teststring);
  if ($ret != GEARMAN_SUCCESS)
  {
    printf(STDERR "%s\n", $client->error());
    exit(1);
  }

  # concurrent client interface
  ($ret, $task) = $client->add_task(reverse, test1);
  ($ret, $task) = $client->add_task(reverse, test2);

  $ret = $client->run_tasks();



DESCRIPTION

Gearman::XS::Client is a client class for the Gearman distributed job system using libgearman.

CONSTRUCTOR

Gearman::XS::Client->new()

Returns a Gearman::XS::Client object.

METHODS

CW$client->add_server($host, CW$port)

Add a job server to a client. This goes into a list of servers than can be used to run tasks. No socket I/O happens here, it is just added to a list. Returns a standard gearman return value.

CW$client->add_servers($servers)

Add a list of job servers to a client. The format for the server list is: SERVER[:PORT][,SERVER[:PORT]]... No socket I/O happens here, it is just added to a list. Returns a standard gearman return value.

CW$client->options()

Get options for a client.

CW$client->set_options($options)

Set options for a client.

CW$client->add_options($options)

Add options for a client.

CW$client->remove_options($options)

Remove options for a client.

CW$client->timeout()

Get current socket I/O activity timeout value. Returns Timeout in milliseconds to wait for I/O activity.

CW$client->set_timeout($timeout)

Set socket I/O activity timeout for connections in milliseconds.

CW$client->echo($data)

Send data to all job servers to see if they echo it back. This is a test function to see if job servers are responding properly. Returns a standard gearman return value.

CW$client->do($function_name, CW$workload)

Run a single task and return a list with two entries: the first is a standard gearman return value, the second is the result.

CW$client->do_high($function_name, CW$workload)

Run a high priority task and return a list with two entries: the first is a standard gearman return value, the second is the result.

CW$client->do_low($function_name, CW$workload)

Run a low priority task and return a list with two entries: the first is a standard gearman return value, the second is the result.

CW$client->do_background($function_name, CW$workload)

Run a task in the background and return a list with two entries: the first is a standard gearman return value, the second is the job handle.

CW$client->do_high_background($function_name, CW$workload)

Run a high priority task in the background and return a list with two entries: the first is a standard gearman return value, the second is the job handle.

CW$client->do_low_background($function_name, CW$workload)

Run a low priority task in the background and return a list with two entries: the first is a standard gearman return value, the second is the job handle.

CW$client->add_task($function_name, CW$workload)

Add a task to be run in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->add_task_high($function_name, CW$workload)

Add a high priority task to be run in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->add_task_low($function_name, CW$workload)

Add a low priority task to be run in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->add_task_background($function_name, CW$workload)

Add a background task to be run in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->add_task_high_background($function_name, CW$workload)

Add a high priority background task to be run in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->add_task_low_background($function_name, CW$workload)

Add a low priority background task to be run in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->add_task_status($job_handle)

Add task to get the status for a background task in parallel and return a list with two entries: the first is a standard gearman return value, the second is a Gearman::XS::Task object.

CW$client->run_tasks()

Run tasks that have been added in parallel. Returns a standard gearman return value.

CW$client->set_created_fn($subref)

Set callback function when a job has been created for a task. No return value.

CW$client->set_data_fn($subref)

Set callback function when there is a data packet for a task. No return value.

CW$client->set_complete_fn($subref)

Set callback function when a task is complete. No return value.

CW$client->set_fail_fn($subref)

Set callback function when a task has failed. No return value.

CW$client->set_status_fn($subref)

Set callback function when there is a status packet for a task. No return value.

CW$client->set_warning_fn($subref)

Set callback function when there is a warning packet for a task. No return value.

CW$client->error()

Return an error string for the last error encountered.

CW$client->do_status()

Get the status for the running task. Returns a list with the percent complete numerator and denominator.

CW$client->job_status($job_handle)

Get the status for a background job. Returns a list with 5 entries: standard gearman return value, boolean indicating the know status, boolean indicating the running status, and the precent complete numerator and denominator.

CW$client->wait()

When in non-blocking I/O mode, wait for activity from one of the servers.

CW$client->clear_fn()

Clear all task callback functions.

CALLBACKS

Please make sure that callback functions always explicitly return a valid gearman_return_t value. An implicitly returned value, for example from a print statement can cause the client connection to abort.

BUGS

Any in libgearman plus many others of my own.

COPYRIGHT

Copyright (C) 2009-2010 Dennis Schoen

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.9 or, at your option, any later version of Perl 5 you may have available.

WARRANTY

This is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Dennis Schoen <dennis@blogma.de>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GEARMAN::XS::CLIENT (3) 2011-07-18

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.