gearman_job_st.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ====================
  2. Job (gearman_job_st)
  3. ====================
  4. --------
  5. SYNOPSIS
  6. --------
  7. #include <libgearman/gearman.h>
  8. .. c:type:: gearman_job_st
  9. .. c:function:: void gearman_job_free(gearman_job_st *job)
  10. .. c:function:: gearman_return_t gearman_job_send_data(gearman_job_st *job, const void *data, size_t data_size)
  11. .. c:function:: gearman_return_t gearman_job_send_warning(gearman_job_st *job, const void *warning, size_t warning_size)
  12. .. c:function:: gearman_return_t gearman_job_send_status(gearman_job_st *job, uint32_t numerator, uint32_t denominator)
  13. .. c:function:: gearman_return_t gearman_job_send_complete(gearman_job_st *job, const void *result, size_t result_size)
  14. .. c:function:: gearman_return_t gearman_job_send_exception(gearman_job_st *job, const void *exception, size_t exception_size)
  15. .. c:function:: gearman_return_t gearman_job_send_fail(gearman_job_st *job)
  16. .. c:function:: const char *gearman_job_handle(const gearman_job_st *job)
  17. .. c:function:: const char *gearman_job_function_name(const gearman_job_st *job)
  18. .. c:function:: const char *gearman_job_unique(const gearman_job_st *job)
  19. .. c:function:: const void *gearman_job_workload(const gearman_job_st *job)
  20. .. c:function:: size_t gearman_job_workload_size(const gearman_job_st *job)
  21. .. c:function:: void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size)
  22. .. c:function:: gearman_client_st *gearman_job_use_client(gearman_job_st *job)
  23. Link with -lgearman
  24. -----------
  25. DESCRIPTION
  26. -----------
  27. :c:type:`gearman_job_st` are passed to worker functions to represent jobs that are being run by :c:func:`gearman_worker_work`.
  28. :c:func:`gearman_job_free` is used to free a job. This only needs to be
  29. done if a task was created with a preallocated structure.
  30. :c:func:`gearman_job_handle` returns the job handle(see :c:type:`gearman_job_handle_t` for more information).
  31. :c:func:`gearman_job_function_name` return the name of the function that the
  32. job was set to execute against.
  33. :c:func:`gearman_job_unique` return the unique value that was used for :c:type:`gearman_job_st`.
  34. gearman_job_take_workload returns the :c:type:`gearman_job_st` workload. The size of it can be determined with :c:func:`gearman_job_workload_size`.
  35. :c:func:`gearman_job_take_workload` is the same as :c:func:`gearman_job_workload` with the exception that the result must be
  36. :manpage:`free(3)` by the caller.
  37. gearman_job_use_client returns a :c:type:`gearman_client_st` configured from gearman_job_st. The gearman_client_st can be used to communicate client API commands to the server.
  38. You do not, and should not, call :c:func:`gearman_client_free` on the gearman_client_st. It is cleaned up when job is cleaned up.
  39. ------------
  40. RETURN VALUE
  41. ------------
  42. A value of :c:type:`gearman_return_t` is returned. On success that value
  43. will be :c:type::`GEARMAN_SUCCESS`. Use :c:func:`gearman_strerror` to
  44. translate this value to a printable string.
  45. ----
  46. HOME
  47. ----
  48. To find out more information please check:
  49. `https://gearman.org/gearmand/ <https://gearman.org/gearmand/>`_
  50. --------
  51. SEE ALSO
  52. --------
  53. :manpage:`gearmand(8)` :manpage:`libgearman(3)`