libgearman.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. =============================
  2. Gearman Client/Worker Library
  3. =============================
  4. .. index:: libgearman
  5. --------
  6. SYNOPSIS
  7. --------
  8. #include <libgearman/gearman.h>
  9. Link -lgearman
  10. -----------
  11. DESCRIPTION
  12. -----------
  13. :doc:`libgearman` is a small, thread-safe client library for the
  14. gearman protocol. The code has all been written with an eye to allow
  15. for both web and embedded usage. It handles the work behind routing
  16. particular keys to specific servers that you specify (and values are
  17. matched based on server order as supplied by you). It implements both
  18. the :term:`client` and :term:`worker` interfaces.
  19. All operations are performed against either a client, ie :c:type:`gearman_client_st`
  20. or worker, ie :c:type:`gearman_worker_st`.
  21. Client and Worker structures can either be dynamically allocated or statically
  22. allocated. They must then b initialized by :c:func:`gearman_client_create()` or :c:func:`gearman_worker_create()`.
  23. Functions have been written in order to encapsulate all structures in the library. It is
  24. recommended that you do not operate directly against the structure.
  25. Nearly all functions return a :c:type:`gearman_return_t` value.
  26. This value can be translated to a printable string with :c:func:`gearman_strerror()`.
  27. :c:type:`gearman_client_st` and :c:type:`gearman_worker_st` structures are thread-safe, but each thread must
  28. contain its own structure (that is, if you want to share these among
  29. threads you must provide your own locking). No global variables are
  30. used in this library.
  31. If you are working with GNU autotools you will want to add the following to
  32. your configure.ac to properly include libgearman in your application.
  33. PKG_CHECK_MODULES(DEPS, libgearman >= 0.8.0)
  34. AC_SUBST(DEPS_CFLAGS)
  35. AC_SUBST(DEPS_LIBS)
  36. Hope you enjoy it!
  37. ---------
  38. CONSTANTS
  39. ---------
  40. A number of constants have been provided for in the library.
  41. .. c:macro:: GEARMAN_DEFAULT_TCP_PORT
  42. The default port used by gearmand(3).
  43. .. c:macro:: GEARMAN_DEFAULT_TCP_PORT
  44. The default service used by gearmand(3).
  45. .. c:macro:: LIBGEARMAN_VERSION_STRING
  46. String value of the libgearman version such as "0.20.4"
  47. .. c:macro:: LIBGEARMAN_VERSION_HEX
  48. Hex value of the version number. "0x00048000" This can be used for comparing versions based on number.
  49. .. c:macro:: GEARMAN_UNIQUE_SIZE
  50. Largest number of characters that can be used for a unique value.
  51. .. c:macro:: GEARMAN_JOB_HANDLE_SIZE
  52. Largest number of characters that can will be used for a job handle. Please
  53. see :c:type:`gearman_job_handle_t` for additional information.
  54. ---------------------
  55. THREADS AND PROCESSES
  56. ---------------------
  57. When using threads or forked processes it is important to keep an instance
  58. of :c:type:`gearman_client_st` or :c:type:`gearman_worker_st` per process
  59. or thread. Without creating your own locking structures you can not share
  60. a single :c:type:`gearman_client_st` or :c:type:`gearman_worker_st`.
  61. ----
  62. HOME
  63. ----
  64. To find out more information please check:
  65. `https://github.com/gearman/gearmand <https://github.com/gearman/gearmand>`_
  66. --------
  67. SEE ALSO
  68. --------
  69. :manpage:`gearmand(8)` :manpage:`libgearman_examples(3)`