gearman_execute_map_reduce.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ==========================
  2. Executing a map/reduce job
  3. ==========================
  4. -------
  5. LIBRARY
  6. -------
  7. C Client Library for Gearmand (libgearman, -lgearman)
  8. --------
  9. SYNOPSIS
  10. --------
  11. #include <libgearman/gearman.h>
  12. .. c:function:: gearman_task_st *gearman_execute_map_reduce(gearman_client_st *client, const char *mapper_name, const size_t mapper_length, const char *reducer_name, const size_t reducer_length, const char *unique_str, const size_t unique_length, gearman_work_t *workload, gearman_argument_t *arguments);
  13. .. c::type typedef gearman_worker_error_t (gearman_mapper_fn)(gearman_job_st *job, void *context);
  14. -----------
  15. DESCRIPTION
  16. -----------
  17. gearman_client_execute_reduce() takes a given :c:type::`gearman_argument_t` and executs it against a :c:type::`gearman_mapper_fn` function. This function is specified via the
  18. mapper_name argument. The mapper function will then break the work up into units, and send each of them to the function named reducer function. Once all work is completed, the mapper function will aggregate the work and return a result.
  19. If any of the units of work error, the job will be aborted. The resulting value will be stored in the :c:type::`gearman_task_st`.
  20. ------
  21. RETURN
  22. ------
  23. gearman_client_execute_reduce() returns a pointer to a gearman_task_st. On error a NULL will be returned. The error can be examined with c:function::`gearman_client_error()`.
  24. ----
  25. HOME
  26. ----
  27. To find out more information please check:
  28. `https://launchpad.net/gearmand <https://launchpad.net/gearmand>`_
  29. --------
  30. SEE ALSO
  31. --------
  32. :manpage:`gearmand(8)` :manpage:`libgearman(3)` :manpage:`gearman_strerror(3)` :manpage:`gearman_client_error`