Net_Gearman
[ class tree: Net_Gearman ] [ index: Net_Gearman ] [ all elements ]

Class: Net_Gearman_Job_Common

Source Location: /Net_Gearman-0.2.3/Net/Gearman/Job/Common.php

Class Overview


Base job class for all Gearman jobs


Author(s):

Copyright:

  • 2007-2008 Digg.com, Inc.

Variables

Methods


Child classes:

Net_Gearman_Job_SQL
Base job class for all Gearman jobs
Net_Gearman_Job_Sum
Sum up a bunch of numbers

Inherited Variables

Inherited Methods


Class Details

[line 37]
Base job class for all Gearman jobs


[ Top ]


Class Variables

$conn =  null

[line 52]

Connection to Gearman

Type:   resource


[ Top ]

$handle =  ''

[line 44]

Gearman job handle
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 62]

void __construct( resource $conn, string $handle)

Constructor
  • Access: public

Parameters:

resource   $conn   —  Connection to communicate with
string   $handle   —  Job ID / handle for this job

[ Top ]

complete   [line 109]

void complete( array $result)

Mark your job as complete with its status

Net_Gearman communicates between the client and jobs in JSON. The main benefit of this is that we can send fairly complex data types between different languages. You should always pass an array as the result to this function.


Parameters:

array   $result   —  Result of your job

[ Top ]

fail   [line 127]

void fail( )

Mark your job as failing

If your job fails for some reason (e.g. a query fails) you need to run this function and exit from your run() method. This will tell Gearman (and the client by proxy) that the job has failed.


[ Top ]

run   [line 76]

void run( array $arg)

Run your job here
  • Abstract:
  • Throws: Net_Gearman_Exception
  • Access: public

Overridden in child classes as:

Net_Gearman_Job_SQL::run()
Net_Gearman_Job_Sum::run()
Run the summing job

Parameters:

array   $arg   —  Arguments passed from the client

[ Top ]

status   [line 87]

void status( integer $numerator, integer $denominator)

Update Gearman with your job's status

Parameters:

integer   $numerator   —  The numerator (e.g. 1)
integer   $denominator   —  The denominator (e.g. 100)

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:31:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.