php_gearman_task.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Gearman PHP Extension
  3. *
  4. * Copyright (C) 2008 James M. Luedke <contact@jamesluedke.com>,
  5. * Eric Day <eday@oddments.org>
  6. * All rights reserved.
  7. *
  8. * Use and distribution licensed under the PHP license. See
  9. * the LICENSE file in this directory for full text.
  10. */
  11. #ifndef __PHP_GEARMAN_TASK_H
  12. #define __PHP_GEARMAN_TASK_H
  13. #include "php.h"
  14. #include "php_ini.h"
  15. #include "ext/standard/info.h"
  16. #include "zend_exceptions.h"
  17. #include "zend_interfaces.h"
  18. #include "php_gearman.h"
  19. #include "php_gearman_client.h"
  20. #include <libgearman-1.0/gearman.h>
  21. #include <libgearman-1.0/interface/status.h>
  22. #include <libgearman-1.0/status.h>
  23. void gearman_task_free_obj(zend_object *object);
  24. zend_object *gearman_task_obj_new(zend_class_entry *ce);
  25. extern zend_class_entry *gearman_task_ce;
  26. extern zend_object_handlers gearman_task_obj_handlers;
  27. typedef enum {
  28. GEARMAN_TASK_OBJ_CREATED = (1 << 0),
  29. } gearman_task_obj_flags_t;
  30. typedef struct {
  31. gearman_return_t ret;
  32. gearman_task_obj_flags_t flags;
  33. gearman_task_st *task;
  34. zval zclient;
  35. zval zdata;
  36. zval zworkload;
  37. zend_ulong task_id;
  38. zend_object std;
  39. } gearman_task_obj;
  40. gearman_task_obj *gearman_task_fetch_object(zend_object *obj);
  41. #define Z_GEARMAN_TASK_P(zv) gearman_task_fetch_object(Z_OBJ_P((zv)))
  42. gearman_return_t _php_task_cb_fn(gearman_task_obj *task, gearman_client_obj *client, zval zcall);
  43. void _php_task_free(gearman_task_st *task, void *context);
  44. gearman_return_t _php_task_workload_fn(gearman_task_st *task);
  45. gearman_return_t _php_task_created_fn(gearman_task_st *task);
  46. gearman_return_t _php_task_data_fn(gearman_task_st *task);
  47. gearman_return_t _php_task_warning_fn(gearman_task_st *task);
  48. gearman_return_t _php_task_status_fn(gearman_task_st *task);
  49. gearman_return_t _php_task_complete_fn(gearman_task_st *task);
  50. gearman_return_t _php_task_exception_fn(gearman_task_st *task);
  51. gearman_return_t _php_task_fail_fn(gearman_task_st *task);
  52. #endif /* __PHP_GEARMAN_TASK_H */