| client.h | | client.h | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| * | | * | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file | | * @file | |
| * @brief Client Declarations | | * @brief Client Declarations | |
| */ | | */ | |
| | | | |
| #pragma once | | #pragma once | |
| | | | |
|
| | | #include <libgearman-1.0/interface/client.h> | |
| | | | |
| /** @addtogroup gearman_client Client Declarations | | /** @addtogroup gearman_client Client Declarations | |
| * | | * | |
| * This is the interface gearman clients should use. You can run tasks one
at a | | * This is the interface gearman clients should use. You can run tasks one
at a | |
| * time or concurrently. | | * time or concurrently. | |
| * | | * | |
| * @ref main_page_client "See Main Page for full details." | | * @ref main_page_client "See Main Page for full details." | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
| enum gearman_client_t { | | enum gearman_client_t { | |
| GEARMAN_CLIENT_STATE_IDLE, | | GEARMAN_CLIENT_STATE_IDLE, | |
| GEARMAN_CLIENT_STATE_NEW, | | GEARMAN_CLIENT_STATE_NEW, | |
| GEARMAN_CLIENT_STATE_SUBMIT, | | GEARMAN_CLIENT_STATE_SUBMIT, | |
| GEARMAN_CLIENT_STATE_PACKET | | GEARMAN_CLIENT_STATE_PACKET | |
| }; | | }; | |
| | | | |
|
| /** | | | |
| * @ingroup gearman_client | | | |
| */ | | | |
| struct gearman_client_st | | | |
| { | | | |
| struct { | | | |
| bool allocated; | | | |
| bool non_blocking; | | | |
| bool unbuffered_result; | | | |
| bool no_new; | | | |
| bool free_tasks; | | | |
| bool generate_unique; | | | |
| } options; | | | |
| enum gearman_client_t state; | | | |
| uint32_t new_tasks; | | | |
| uint32_t running_tasks; | | | |
| uint32_t task_count; | | | |
| void *context; | | | |
| gearman_connection_st *con; | | | |
| gearman_task_st *task; | | | |
| gearman_task_st *task_list; | | | |
| gearman_task_context_free_fn *task_context_free_fn; | | | |
| struct gearman_universal_st universal; | | | |
| struct gearman_actions_t actions; | | | |
| gearman_job_handle_t _do_handle; // Backwards compatible | | | |
| }; | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Initialize a client structure. Always check the return value even if pas
sing | | * Initialize a client structure. Always check the return value even if pas
sing | |
| * in a pre-allocated structure. Some other initialization may have failed.
It | | * in a pre-allocated structure. Some other initialization may have failed.
It | |
| * is not required to memset() a structure before providing it. | | * is not required to memset() a structure before providing it. | |
| * | | * | |
| * @param[in] client Caller allocated structure, or NULL to allocate one. | | * @param[in] client Caller allocated structure, or NULL to allocate one. | |
| | | | |
| skipping to change at line 721 | | skipping to change at line 696 | |
| /** | | /** | |
| * Run tasks that have been added in parallel. | | * Run tasks that have been added in parallel. | |
| * | | * | |
| * @param[in] client Structure previously initialized with | | * @param[in] client Structure previously initialized with | |
| * gearman_client_create() or gearman_client_clone(). | | * gearman_client_create() or gearman_client_clone(). | |
| * @return Standard gearman return value. | | * @return Standard gearman return value. | |
| */ | | */ | |
| GEARMAN_API | | GEARMAN_API | |
| gearman_return_t gearman_client_run_tasks(gearman_client_st *client); | | gearman_return_t gearman_client_run_tasks(gearman_client_st *client); | |
| | | | |
|
| | | GEARMAN_LOCAL | |
| | | gearman_return_t gearman_client_run_block_tasks(gearman_client_st *client); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| bool gearman_client_compare(const gearman_client_st *first, const gearman_c
lient_st *second); | | bool gearman_client_compare(const gearman_client_st *first, const gearman_c
lient_st *second); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| bool gearman_client_set_server_option(gearman_client_st *self, const char *
option_arg, size_t option_arg_size); | | bool gearman_client_set_server_option(gearman_client_st *self, const char *
option_arg, size_t option_arg_size); | |
| | | | |
|
| | | GEARMAN_LOCAL | |
| | | size_t gearman_client_count_tasks(gearman_client_st *client); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| void gearman_client_set_namespace(gearman_client_st *self, const char *name
space_key, size_t namespace_key_size); | | void gearman_client_set_namespace(gearman_client_st *self, const char *name
space_key, size_t namespace_key_size); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| gearman_return_t gearman_client_set_identifier(gearman_client_st *client, | | gearman_return_t gearman_client_set_identifier(gearman_client_st *client, | |
| const char *id, size_t id_si
ze); | | const char *id, size_t id_si
ze); | |
| | | | |
| const char *gearman_client_namespace(gearman_client_st *self); | | const char *gearman_client_namespace(gearman_client_st *self); | |
| | | | |
|
| | | GEARMAN_API | |
| | | bool gearman_client_has_tasks(const gearman_client_st *client); | |
| | | | |
| /** @} */ | | /** @} */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 27 lines changed or deleted | | 11 lines changed or added | |
|
| connection.h | | connection.h | |
| /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | |
| * | | * | |
| * Gearmand client and server library. | | * Gearmand client and server library. | |
| * | | * | |
|
| * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ | | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ | |
| * Copyright (C) 2008 Brian Aker, Eric Day | | * Copyright (C) 2008 Brian Aker, Eric Day | |
| * All rights reserved. | | * All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are | | * modification, are permitted provided that the following conditions are | |
| * met: | | * met: | |
| * | | * | |
| * * Redistributions of source code must retain the above copyright | | * * Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * | | * | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| * | | * | |
| */ | | */ | |
| | | | |
| #pragma once | | #pragma once | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| #include <sys/socket.h> | | #include <sys/socket.h> | |
| #include <netdb.h> | | #include <netdb.h> | |
| | | | |
| #ifdef NI_MAXHOST | | #ifdef NI_MAXHOST | |
|
| # define GEARMAN_NI_MAXHOST NI_MAXHOST | | #define GEARMAN_NI_MAXHOST NI_MAXHOST | |
| #else | | #else | |
|
| # define GEARMAN_NI_MAXHOST 1025 | | #define GEARMAN_NI_MAXHOST 1025 | |
| #endif | | #endif | |
| | | | |
| #ifdef NI_MAXSERV | | #ifdef NI_MAXSERV | |
|
| # define GEARMAN_NI_MAXSERV NI_MAXSERV | | #define GEARMAN_NI_MAXSERV NI_MAXSERV | |
| #else | | #else | |
|
| # define GEARMAN_NI_MAXSERV 32 | | #define GEARMAN_NI_MAXSERV 32 | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| Do not define these enum in your application. There are left publically d
ue to one client. | | Do not define these enum in your application. There are left publically d
ue to one client. | |
| */ | | */ | |
| | | | |
| enum gearman_con_recv_t { | | enum gearman_con_recv_t { | |
| GEARMAN_CON_RECV_UNIVERSAL_NONE, | | GEARMAN_CON_RECV_UNIVERSAL_NONE, | |
| GEARMAN_CON_RECV_UNIVERSAL_READ, | | GEARMAN_CON_RECV_UNIVERSAL_READ, | |
| GEARMAN_CON_RECV_STATE_READ_DATA | | GEARMAN_CON_RECV_STATE_READ_DATA | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 5 lines changed or added | |
|
| constants.h | | constants.h | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 111 | |
| * Options for gearman_client_st. | | * Options for gearman_client_st. | |
| */ | | */ | |
| typedef enum | | typedef enum | |
| { | | { | |
| GEARMAN_CLIENT_ALLOCATED= (1 << 0), | | GEARMAN_CLIENT_ALLOCATED= (1 << 0), | |
| GEARMAN_CLIENT_NON_BLOCKING= (1 << 1), | | GEARMAN_CLIENT_NON_BLOCKING= (1 << 1), | |
| GEARMAN_CLIENT_TASK_IN_USE= (1 << 2), | | GEARMAN_CLIENT_TASK_IN_USE= (1 << 2), | |
| GEARMAN_CLIENT_UNBUFFERED_RESULT= (1 << 3), | | GEARMAN_CLIENT_UNBUFFERED_RESULT= (1 << 3), | |
| GEARMAN_CLIENT_NO_NEW= (1 << 4), | | GEARMAN_CLIENT_NO_NEW= (1 << 4), | |
| GEARMAN_CLIENT_FREE_TASKS= (1 << 5), | | GEARMAN_CLIENT_FREE_TASKS= (1 << 5), | |
|
| GEARMAN_CLIENT_GENERATE_UNIQUE= (1 << 6), | | GEARMAN_CLIENT_MAX= (1 << 6) | |
| GEARMAN_CLIENT_MAX= (1 << 7) | | | |
| } gearman_client_options_t; | | } gearman_client_options_t; | |
| | | | |
| /** | | /** | |
| * @ingroup gearman_worker | | * @ingroup gearman_worker | |
| * Options for gearman_worker_st. | | * Options for gearman_worker_st. | |
| */ | | */ | |
| typedef enum | | typedef enum | |
| { | | { | |
| GEARMAN_WORKER_ALLOCATED= (1 << 0), | | GEARMAN_WORKER_ALLOCATED= (1 << 0), | |
| GEARMAN_WORKER_NON_BLOCKING= (1 << 1), | | GEARMAN_WORKER_NON_BLOCKING= (1 << 1), | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 134 | |
| GEARMAN_WORKER_PRE_SLEEP_IN_USE= (1 << 4), | | GEARMAN_WORKER_PRE_SLEEP_IN_USE= (1 << 4), | |
| GEARMAN_WORKER_WORK_JOB_IN_USE= (1 << 5), | | GEARMAN_WORKER_WORK_JOB_IN_USE= (1 << 5), | |
| GEARMAN_WORKER_CHANGE= (1 << 6), | | GEARMAN_WORKER_CHANGE= (1 << 6), | |
| GEARMAN_WORKER_GRAB_UNIQ= (1 << 7), | | GEARMAN_WORKER_GRAB_UNIQ= (1 << 7), | |
| GEARMAN_WORKER_TIMEOUT_RETURN= (1 << 8), | | GEARMAN_WORKER_TIMEOUT_RETURN= (1 << 8), | |
| GEARMAN_WORKER_GRAB_ALL= (1 << 9), | | GEARMAN_WORKER_GRAB_ALL= (1 << 9), | |
| GEARMAN_WORKER_MAX= (1 << 10) | | GEARMAN_WORKER_MAX= (1 << 10) | |
| } gearman_worker_options_t; | | } gearman_worker_options_t; | |
| | | | |
| /* Types. */ | | /* Types. */ | |
|
| typedef struct gearman_packet_st gearman_packet_st; | | | |
| typedef struct gearman_task_st gearman_task_st; | | typedef struct gearman_task_st gearman_task_st; | |
| typedef struct gearman_client_st gearman_client_st; | | typedef struct gearman_client_st gearman_client_st; | |
| typedef struct gearman_job_st gearman_job_st; | | typedef struct gearman_job_st gearman_job_st; | |
| typedef struct gearman_worker_st gearman_worker_st; | | typedef struct gearman_worker_st gearman_worker_st; | |
| typedef struct gearman_allocator_t gearman_allocator_t; | | typedef struct gearman_allocator_t gearman_allocator_t; | |
| typedef struct gearman_task_attr_t gearman_task_attr_t; | | typedef struct gearman_task_attr_t gearman_task_attr_t; | |
| typedef struct gearman_result_st gearman_result_st; | | typedef struct gearman_result_st gearman_result_st; | |
| typedef struct gearman_string_t gearman_string_t; | | typedef struct gearman_string_t gearman_string_t; | |
| typedef struct gearman_argument_t gearman_argument_t; | | typedef struct gearman_argument_t gearman_argument_t; | |
| typedef struct gearman_status_t gearman_status_t; | | typedef struct gearman_status_t gearman_status_t; | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 1 lines changed or added | |
|
| job.h | | job.h | |
| /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | |
| * | | * | |
| * Gearmand client and server library. | | * Gearmand client and server library. | |
| * | | * | |
|
| * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ | | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ | |
| * Copyright (C) 2008 Brian Aker, Eric Day | | * Copyright (C) 2008 Brian Aker, Eric Day | |
| * All rights reserved. | | * All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are | | * modification, are permitted provided that the following conditions are | |
| * met: | | * met: | |
| * | | * | |
| * * Redistributions of source code must retain the above copyright | | * * Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * | | * | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| * | | * | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file | | * @file | |
| * @brief Job Declarations | | * @brief Job Declarations | |
| */ | | */ | |
| | | | |
| #pragma once | | #pragma once | |
| | | | |
|
| struct gearman_job_st | | | |
| { | | | |
| struct { | | | |
| bool allocated; | | | |
| bool assigned_in_use; | | | |
| bool work_in_use; | | | |
| bool finished; | | | |
| } options; | | | |
| gearman_worker_st *worker; | | | |
| gearman_job_st *next; | | | |
| gearman_job_st *prev; | | | |
| gearman_connection_st *con; | | | |
| gearman_packet_st assigned; | | | |
| gearman_packet_st work; | | | |
| struct gearman_job_reducer_st *reducer; | | | |
| gearman_return_t error_code; | | | |
| }; | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * @addtogroup gearman_job Job Declarations | | * @addtogroup gearman_job Job Declarations | |
| * @ingroup gearman_worker | | * @ingroup gearman_worker | |
| * | | * | |
| * The job functions are used to manage jobs assigned to workers. It is mos
t | | * The job functions are used to manage jobs assigned to workers. It is mos
t | |
| * commonly used with the worker interface. | | * commonly used with the worker interface. | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 149 | |
| /** | | /** | |
| * Take allocated workload from job. After this, the caller is responsible | | * Take allocated workload from job. After this, the caller is responsible | |
| * for free()ing the memory. | | * for free()ing the memory. | |
| */ | | */ | |
| GEARMAN_API | | GEARMAN_API | |
| void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); | | void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job); | | gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job); | |
| | | | |
|
| GEARMAN_API | | | |
| const char *gearman_job_error(gearman_job_st *job); | | | |
| | | | |
| /** @} */ | | /** @} */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 22 lines changed or deleted | | 1 lines changed or added | |
|
| ostream.hpp | | ostream.hpp | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| #include <libgearman-1.0/gearman.h> | | #include <libgearman-1.0/gearman.h> | |
| | | | |
| #include <ostream> | | #include <ostream> | |
| | | | |
| static inline std::ostream& operator<<(std::ostream& output, const enum gea
rman_return_t &arg) | | static inline std::ostream& operator<<(std::ostream& output, const enum gea
rman_return_t &arg) | |
| { | | { | |
| output << gearman_strerror(arg); | | output << gearman_strerror(arg); | |
| return output; | | return output; | |
| } | | } | |
| | | | |
|
| static inline std::ostream& operator<<(std::ostream& output, const gearman_ | | | |
| packet_st &arg) | | | |
| { | | | |
| const char* command_str; | | | |
| switch(arg.command) | | | |
| { | | | |
| case GEARMAN_COMMAND_TEXT: command_str= "GEARMAN_COMMAND_TEXT"; | | | |
| case GEARMAN_COMMAND_CAN_DO: command_str= "GEARMAN_COMMAND_CAN_DO"; | | | |
| case GEARMAN_COMMAND_CANT_DO: command_str= "GEARMAN_COMMAND_CANT_DO"; | | | |
| case GEARMAN_COMMAND_RESET_ABILITIES: command_str= "GEARMAN_COMMAND_RESE | | | |
| T_ABILITIES"; | | | |
| case GEARMAN_COMMAND_PRE_SLEEP: command_str= "GEARMAN_COMMAND_PRE_SLEEP" | | | |
| ; | | | |
| case GEARMAN_COMMAND_UNUSED: command_str= "GEARMAN_COMMAND_UNUSED"; | | | |
| case GEARMAN_COMMAND_NOOP: command_str= "GEARMAN_COMMAND_NOOP"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB: command_str= "GEARMAN_COMMAND_SUBMIT_JO | | | |
| B"; | | | |
| case GEARMAN_COMMAND_JOB_CREATED: command_str= "GEARMAN_COMMAND_JOB_CREA | | | |
| TED"; | | | |
| case GEARMAN_COMMAND_GRAB_JOB: command_str= "GEARMAN_COMMAND_GRAB_JOB"; | | | |
| case GEARMAN_COMMAND_NO_JOB: command_str= "GEARMAN_COMMAND_NO_JOB"; | | | |
| case GEARMAN_COMMAND_JOB_ASSIGN: command_str= "GEARMAN_COMMAND_JOB_ASSIG | | | |
| N"; | | | |
| case GEARMAN_COMMAND_WORK_STATUS: command_str= "GEARMAN_COMMAND_WORK_STA | | | |
| TUS"; | | | |
| case GEARMAN_COMMAND_WORK_COMPLETE: command_str= "GEARMAN_COMMAND_WORK_C | | | |
| OMPLETE"; | | | |
| case GEARMAN_COMMAND_WORK_FAIL: command_str= "GEARMAN_COMMAND_WORK_FAIL" | | | |
| ; | | | |
| case GEARMAN_COMMAND_GET_STATUS: command_str= "GEARMAN_COMMAND_GET_STATU | | | |
| S"; | | | |
| case GEARMAN_COMMAND_ECHO_REQ: command_str= "GEARMAN_COMMAND_ECHO_REQ"; | | | |
| case GEARMAN_COMMAND_ECHO_RES: command_str= "GEARMAN_COMMAND_ECHO_RES"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_BG: command_str= "GEARMAN_COMMAND_SUBMIT | | | |
| _JOB_BG"; | | | |
| case GEARMAN_COMMAND_ERROR: command_str= "GEARMAN_COMMAND_ERROR"; | | | |
| case GEARMAN_COMMAND_STATUS_RES: command_str= "GEARMAN_COMMAND_STATUS_RE | | | |
| S"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_HIGH: command_str= "GEARMAN_COMMAND_SUBM | | | |
| IT_JOB_HIGH"; | | | |
| case GEARMAN_COMMAND_SET_CLIENT_ID: command_str= "GEARMAN_COMMAND_SET_CL | | | |
| IENT_ID"; | | | |
| case GEARMAN_COMMAND_CAN_DO_TIMEOUT: command_str= "GEARMAN_COMMAND_CAN_D | | | |
| O_TIMEOUT"; | | | |
| case GEARMAN_COMMAND_ALL_YOURS: command_str= "GEARMAN_COMMAND_ALL_YOURS" | | | |
| ; | | | |
| case GEARMAN_COMMAND_WORK_EXCEPTION: command_str= "GEARMAN_COMMAND_WORK_ | | | |
| EXCEPTION"; | | | |
| case GEARMAN_COMMAND_OPTION_REQ: command_str= "GEARMAN_COMMAND_OPTION_RE | | | |
| Q"; | | | |
| case GEARMAN_COMMAND_OPTION_RES: command_str= "GEARMAN_COMMAND_OPTION_RE | | | |
| S"; | | | |
| case GEARMAN_COMMAND_WORK_DATA: command_str= "GEARMAN_COMMAND_WORK_DATA" | | | |
| ; | | | |
| case GEARMAN_COMMAND_WORK_WARNING: command_str= "GEARMAN_COMMAND_WORK_WA | | | |
| RNING"; | | | |
| case GEARMAN_COMMAND_GRAB_JOB_UNIQ: command_str= "GEARMAN_COMMAND_GRAB_J | | | |
| OB_UNIQ"; | | | |
| case GEARMAN_COMMAND_JOB_ASSIGN_UNIQ: command_str= "GEARMAN_COMMAND_JOB_ | | | |
| ASSIGN_UNIQ"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_HIGH_BG: command_str= "GEARMAN_COMMAND_S | | | |
| UBMIT_JOB_HIGH_BG"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_LOW: command_str= "GEARMAN_COMMAND_SUBMI | | | |
| T_JOB_LOW"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_LOW_BG: command_str= "GEARMAN_COMMAND_SU | | | |
| BMIT_JOB_LOW_BG"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_SCHED: command_str= "GEARMAN_COMMAND_SUB | | | |
| MIT_JOB_SCHED"; | | | |
| case GEARMAN_COMMAND_SUBMIT_JOB_EPOCH: command_str= "GEARMAN_COMMAND_SUB | | | |
| MIT_JOB_EPOCH"; | | | |
| case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB: command_str= "GEARMAN_COMMAND_SU | | | |
| BMIT_REDUCE_JOB"; | | | |
| case GEARMAN_COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND: command_str= "GEARMAN | | | |
| _COMMAND_SUBMIT_REDUCE_JOB_BACKGROUND"; | | | |
| case GEARMAN_COMMAND_GRAB_JOB_ALL: command_str= "GEARMAN_COMMAND_GRAB_JO | | | |
| B_ALL"; | | | |
| case GEARMAN_COMMAND_JOB_ASSIGN_ALL: command_str= "GEARMAN_COMMAND_JOB_A | | | |
| SSIGN_ALL"; | | | |
| case GEARMAN_COMMAND_MAX: command_str= "GEARMAN_COMMAND_MAX"; | | | |
| case GEARMAN_COMMAND_GET_STATUS_UNIQUE: command_str= "GEARMAN_COMMAND_GE | | | |
| T_STATUS_UNIQUE"; | | | |
| case GEARMAN_COMMAND_STATUS_RES_UNIQUE: command_str= "GEARMAN_COMMAND_ST | | | |
| ATUS_RES_UNIQUE"; | | | |
| } | | | |
| | | | |
| output << std::boolalpha | | | |
| << "command: " << command_str | | | |
| << " argc: " << int(arg.argc); | | | |
| | | | |
| for (uint8_t x= 0; x < arg.argc; x++) | | | |
| { | | | |
| output << "arg[" << int(x) << "]: "; | | | |
| output.write(arg.arg[x], arg.arg_size[x]); | | | |
| output << " "; | | | |
| } | | | |
| | | | |
| return output; | | | |
| } | | | |
| | | | |
| static inline std::ostream& operator<<(std::ostream& output, const gearman_
task_st &arg) | | static inline std::ostream& operator<<(std::ostream& output, const gearman_
task_st &arg) | |
| { | | { | |
| output << std::boolalpha | | output << std::boolalpha | |
| << "job: " << gearman_task_job_handle(&arg) | | << "job: " << gearman_task_job_handle(&arg) | |
| << " unique: " << gearman_task_unique(&arg) | | << " unique: " << gearman_task_unique(&arg) | |
|
| << " has_result:" << bool(arg.result_ptr) | | | |
| << " complete: " << gearman_task_numerator(&arg) << "/" << gearman_task
_denominator(&arg) | | << " complete: " << gearman_task_numerator(&arg) << "/" << gearman_task
_denominator(&arg) | |
| << " state: " << gearman_task_strstate(&arg) | | << " state: " << gearman_task_strstate(&arg) | |
| << " is_known: " << gearman_task_is_known(&arg) | | << " is_known: " << gearman_task_is_known(&arg) | |
| << " is_running: " << gearman_task_is_running(&arg) | | << " is_running: " << gearman_task_is_running(&arg) | |
| << " ret: " << gearman_task_return(&arg); | | << " ret: " << gearman_task_return(&arg); | |
| | | | |
|
| if (arg.recv) | | | |
| { | | | |
| output << " " << *arg.recv; | | | |
| } | | | |
| | | | |
| return output; | | return output; | |
| } | | } | |
| | | | |
| static inline std::ostream& operator<<(std::ostream& output, const gearman_
status_t &arg) | | static inline std::ostream& operator<<(std::ostream& output, const gearman_
status_t &arg) | |
| { | | { | |
| output << std::boolalpha | | output << std::boolalpha | |
| << " is_known: " << gearman_status_is_known(arg) | | << " is_known: " << gearman_status_is_known(arg) | |
| << " is_running: " << gearman_status_is_running(arg) | | << " is_running: " << gearman_status_is_running(arg) | |
| << " complete: " << gearman_status_numerator(arg) << "/" << gearman_sta
tus_denominator(arg) | | << " complete: " << gearman_status_numerator(arg) << "/" << gearman_sta
tus_denominator(arg) | |
| << " ret: " << gearman_strerror(gearman_status_return(arg)); | | << " ret: " << gearman_strerror(gearman_status_return(arg)); | |
| | | | |
End of changes. 3 change blocks. |
| 105 lines changed or deleted | | 0 lines changed or added | |
|
| result.h | | result.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #pragma once | | #pragma once | |
| | | | |
|
| | | enum gearman_result_t { | |
| | | GEARMAN_RESULT_BINARY, | |
| | | GEARMAN_RESULT_BOOLEAN, | |
| | | GEARMAN_RESULT_INTEGER | |
| | | }; | |
| | | #ifndef __cplusplus | |
| | | typedef enum gearman_result_t gearman_result_t; | |
| | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| int64_t gearman_result_integer(const gearman_result_st *self); | | int64_t gearman_result_integer(const gearman_result_st *self); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| bool gearman_result_boolean(const gearman_result_st *self); | | bool gearman_result_boolean(const gearman_result_st *self); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| gearman_string_t gearman_result_string(const gearman_result_st *self); | | gearman_string_t gearman_result_string(const gearman_result_st *self); | |
| | | | |
|
| | | GEARMAN_LOCAL | |
| | | gearman_string_t gearman_result_take_string(gearman_result_st *self); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| gearman_return_t gearman_result_store_string(gearman_result_st *self, gea
rman_string_t arg); | | gearman_return_t gearman_result_store_string(gearman_result_st *self, gea
rman_string_t arg); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| void gearman_result_store_integer(gearman_result_st *self, int64_t value)
; | | void gearman_result_store_integer(gearman_result_st *self, int64_t value)
; | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| gearman_return_t gearman_result_store_value(gearman_result_st *self, cons
t void *value, size_t size); | | gearman_return_t gearman_result_store_value(gearman_result_st *self, cons
t void *value, size_t size); | |
| | | | |
| GEARMAN_API | | GEARMAN_API | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 12 lines changed or added | |
|
| return.h | | return.h | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 97 | |
| GEARMAN_PIPE_EOF, // DEPRECATED, SERVER ONLY | | GEARMAN_PIPE_EOF, // DEPRECATED, SERVER ONLY | |
| GEARMAN_QUEUE_ERROR, // DEPRECATED, SERVER ONLY | | GEARMAN_QUEUE_ERROR, // DEPRECATED, SERVER ONLY | |
| GEARMAN_FLUSH_DATA, // Internal state, should never be seen by either cli
ent or worker. | | GEARMAN_FLUSH_DATA, // Internal state, should never be seen by either cli
ent or worker. | |
| GEARMAN_SEND_BUFFER_TOO_SMALL, | | GEARMAN_SEND_BUFFER_TOO_SMALL, | |
| GEARMAN_IGNORE_PACKET, // Internal only | | GEARMAN_IGNORE_PACKET, // Internal only | |
| GEARMAN_UNKNOWN_OPTION, // DEPRECATED | | GEARMAN_UNKNOWN_OPTION, // DEPRECATED | |
| GEARMAN_TIMEOUT, | | GEARMAN_TIMEOUT, | |
| GEARMAN_ARGUMENT_TOO_LARGE, | | GEARMAN_ARGUMENT_TOO_LARGE, | |
| GEARMAN_INVALID_ARGUMENT, | | GEARMAN_INVALID_ARGUMENT, | |
| GEARMAN_IN_PROGRESS, // See gearman_client_job_status() | | GEARMAN_IN_PROGRESS, // See gearman_client_job_status() | |
|
| GEARMAN_INVALID_SERVER_OPTION, // Bad server option sent to server | | | |
| GEARMAN_MAX_RETURN, /* Always add new error code before */ | | GEARMAN_MAX_RETURN, /* Always add new error code before */ | |
| GEARMAN_FAIL= GEARMAN_WORK_FAIL, | | GEARMAN_FAIL= GEARMAN_WORK_FAIL, | |
| GEARMAN_FATAL= GEARMAN_WORK_FAIL, | | GEARMAN_FATAL= GEARMAN_WORK_FAIL, | |
| GEARMAN_ERROR= GEARMAN_WORK_ERROR | | GEARMAN_ERROR= GEARMAN_WORK_ERROR | |
| }; | | }; | |
| | | | |
| static inline bool gearman_continue(enum gearman_return_t rc) | | static inline bool gearman_continue(enum gearman_return_t rc) | |
| { | | { | |
| return rc == GEARMAN_IO_WAIT || rc == GEARMAN_IN_PROGRESS || rc == GEARM
AN_PAUSE || rc == GEARMAN_JOB_EXISTS; | | return rc == GEARMAN_IO_WAIT || rc == GEARMAN_IN_PROGRESS || rc == GEARM
AN_PAUSE || rc == GEARMAN_JOB_EXISTS; | |
| } | | } | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 0 lines changed or added | |
|
| string.h | | string.h | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| const char *c_str; | | const char *c_str; | |
| const size_t size; | | const size_t size; | |
| }; | | }; | |
| | | | |
| #define gearman_size(X) (X).size | | #define gearman_size(X) (X).size | |
| #define gearman_c_str(X) (X).c_str | | #define gearman_c_str(X) (X).c_str | |
| #define gearman_string_param(X) (X).c_str, (X).size | | #define gearman_string_param(X) (X).c_str, (X).size | |
| #define gearman_string_param_null NULL, 0 | | #define gearman_string_param_null NULL, 0 | |
| #define gearman_string_param_cstr(X) (X), ((X) ? strlen(X) : 0) | | #define gearman_string_param_cstr(X) (X), ((X) ? strlen(X) : 0) | |
| | | | |
|
| #ifndef gearman_literal_param | | #ifdef __cplusplus | |
| # ifdef __cplusplus | | # define gearman_literal_param(X) (X), (static_cast<size_t>((sizeof(X) - 1) | |
| # define gearman_literal_param(X) (X), (static_cast<size_t>((sizeof(X) - 1 | | )) | |
| ))) | | # define gearman_literal_param_size(X) static_cast<size_t>(sizeof(X) - 1) | |
| # define gearman_literal_param_size(X) static_cast<size_t>(sizeof(X) - 1) | | | |
| # endif | | | |
| #endif | | #endif | |
| | | | |
| #ifdef BUILDING_LIBGEARMAN | | #ifdef BUILDING_LIBGEARMAN | |
| | | | |
| #ifdef __cplusplus // correct define | | #ifdef __cplusplus // correct define | |
|
| # define gearman_string_make(X) (X), size_t((sizeof(X) - 1)) | | #define gearman_string_make(X) (X), size_t((sizeof(X) - 1)) | |
| #else | | #else | |
|
| # define gearman_string_make(X) (X), (((size_t)((sizeof(X) - 1))) | | #define gearman_string_make(X) (X), (((size_t)((sizeof(X) - 1))) | |
| #endif // correct define | | #endif // correct define | |
| | | | |
| #endif // BUILDING_LIBGEARMAN | | #endif // BUILDING_LIBGEARMAN | |
| | | | |
End of changes. 3 change blocks. |
| 8 lines changed or deleted | | 6 lines changed or added | |
|
| task.h | | task.h | |
| /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | |
| * | | * | |
| * Gearmand client and server library. | | * Gearmand client and server library. | |
| * | | * | |
|
| * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ | | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ | |
| * Copyright (C) 2008 Brian Aker, Eric Day | | * Copyright (C) 2008 Brian Aker, Eric Day | |
| * All rights reserved. | | * All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are | | * modification, are permitted provided that the following conditions are | |
| * met: | | * met: | |
| * | | * | |
| * * Redistributions of source code must retain the above copyright | | * * Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * | | * | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| version.h | | version.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #pragma once | | #pragma once | |
| | | | |
|
| #define LIBGEARMAN_VERSION_STRING "1.0.6" | | #define LIBGEARMAN_VERSION_STRING "1.1.0" | |
| #define LIBGEARMAN_VERSION_HEX 0x01000006 | | #define LIBGEARMAN_VERSION_HEX @PANDORA_HEX_VERSION@ | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 0 lines changed or added | |
|
| worker.h | | worker.h | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| * | | * | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file | | * @file | |
| * @brief Worker Declarations | | * @brief Worker Declarations | |
| */ | | */ | |
| | | | |
| #pragma once | | #pragma once | |
| | | | |
|
| | | #include <libgearman-1.0/interface/worker.h> | |
| | | | |
| /** @addtogroup gearman_worker Worker Declarations | | /** @addtogroup gearman_worker Worker Declarations | |
| * | | * | |
| * This is the interface gearman workers should use. | | * This is the interface gearman workers should use. | |
| * | | * | |
| * @ref main_page_worker "See Main Page for full details." | | * @ref main_page_worker "See Main Page for full details." | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
| enum gearman_worker_state_t { | | enum gearman_worker_state_t { | |
| GEARMAN_WORKER_STATE_START, | | GEARMAN_WORKER_STATE_START, | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 72 | |
| GEARMAN_WORKER_STATE_PRE_SLEEP | | GEARMAN_WORKER_STATE_PRE_SLEEP | |
| }; | | }; | |
| | | | |
| enum gearman_worker_universal_t { | | enum gearman_worker_universal_t { | |
| GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB, | | GEARMAN_WORKER_WORK_UNIVERSAL_GRAB_JOB, | |
| GEARMAN_WORKER_WORK_UNIVERSAL_FUNCTION, | | GEARMAN_WORKER_WORK_UNIVERSAL_FUNCTION, | |
| GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE, | | GEARMAN_WORKER_WORK_UNIVERSAL_COMPLETE, | |
| GEARMAN_WORKER_WORK_UNIVERSAL_FAIL | | GEARMAN_WORKER_WORK_UNIVERSAL_FAIL | |
| }; | | }; | |
| | | | |
|
| /** | | | |
| * @ingroup gearman_worker | | | |
| */ | | | |
| struct gearman_worker_st | | | |
| { | | | |
| struct { | | | |
| bool allocated; | | | |
| bool non_blocking; | | | |
| bool packet_init; | | | |
| bool change; | | | |
| bool grab_uniq; | | | |
| bool grab_all; | | | |
| bool timeout_return; | | | |
| } options; | | | |
| enum gearman_worker_state_t state; | | | |
| enum gearman_worker_universal_t work_state; | | | |
| uint32_t function_count; | | | |
| uint32_t job_count; | | | |
| size_t work_result_size; | | | |
| void *context; | | | |
| gearman_connection_st *con; | | | |
| gearman_job_st *job; | | | |
| gearman_job_st *job_list; | | | |
| struct _worker_function_st *function; | | | |
| struct _worker_function_st *function_list; | | | |
| struct _worker_function_st *work_function; | | | |
| void *work_result; | | | |
| struct gearman_universal_st universal; | | | |
| gearman_packet_st grab_job; | | | |
| gearman_packet_st pre_sleep; | | | |
| gearman_job_st *work_job; | | | |
| }; | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| #define gearman_has_reducer(A) (A) ? static_cast<bool>((A)->reducer.final_f
n) : false | | #define gearman_has_reducer(A) (A) ? static_cast<bool>((A)->reducer.final_f
n) : false | |
| #else | | #else | |
| #define gearman_has_reducer(A) (A) ? (bool)((A)->reducer.final_fn) : false | | #define gearman_has_reducer(A) (A) ? (bool)((A)->reducer.final_fn) : false | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 33 lines changed or deleted | | 2 lines changed or added | |
|