Merge lp:~brianaker/gearmand/gearmnan_job_use_client into lp:gearmand
- gearmnan_job_use_client
- Merge into 1.2
Proposed by
Brian Aker
Status: | Merged |
---|---|
Merged at revision: | 869 |
Proposed branch: | lp:~brianaker/gearmand/gearmnan_job_use_client |
Merge into: | lp:gearmand |
Diff against target: |
605 lines (+307/-64) 15 files modified
ChangeLog (+1/-1) configure.ac (+1/-0) docs/conf.py.in (+1/-0) docs/libgearman/gearman_job_st.rst (+6/-1) libgearman-1.0/job.h (+3/-0) libgearman/job.cc (+46/-3) libgearman/job.hpp (+4/-0) libgearman/worker.cc (+0/-10) m4/ax_uuid.m4 (+61/-49) man/include.am (+1/-0) support/gearmand.spec.in (+1/-0) tests/libgearman-1.0/worker_test.cc (+71/-0) tests/workers/include.am (+2/-0) tests/workers/v2/client_echo.cc (+67/-0) tests/workers/v2/client_echo.h (+42/-0) |
To merge this branch: | bzr merge lp:~brianaker/gearmand/gearmnan_job_use_client |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tangent Trunk | Pending | ||
Review via email: mp+181725@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 867. By Brian Aker
-
Fix missing man pages
- 868. By Brian Aker
-
Fix uuid testing
- 869. By Brian Aker
-
Fix duplicate man page entry.
- 870. By Brian Aker
-
Fix docs
- 871. By Brian Aker
-
Fix spec file.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2013-08-15 06:28:02 +0000 | |||
3 | +++ ChangeLog 2013-08-31 03:15:41 +0000 | |||
4 | @@ -1,5 +1,5 @@ | |||
5 | 1 | 1.1.10 | 1 | 1.1.10 |
7 | 2 | * | 2 | * Added gearman_job_use_client() |
8 | 3 | 3 | ||
9 | 4 | 1.1.9 Fri Aug 2 02:39:25 EDT 2013 | 4 | 1.1.9 Fri Aug 2 02:39:25 EDT 2013 |
10 | 5 | * Added gearman_task_is_finished() | 5 | * Added gearman_task_is_finished() |
11 | 6 | 6 | ||
12 | === modified file 'configure.ac' | |||
13 | --- configure.ac 2013-08-16 08:58:49 +0000 | |||
14 | +++ configure.ac 2013-08-31 03:15:41 +0000 | |||
15 | @@ -271,6 +271,7 @@ | |||
16 | 271 | 271 | ||
17 | 272 | AX_LIBEVENT(,[AC_MSG_ERROR([Unable to find libevent])]) | 272 | AX_LIBEVENT(,[AC_MSG_ERROR([Unable to find libevent])]) |
18 | 273 | 273 | ||
19 | 274 | AX_UUID(,[AC_MSG_ERROR([Unable to find libuuid])]) | ||
20 | 274 | AX_UUID_GENERATE_TIME_SAFE | 275 | AX_UUID_GENERATE_TIME_SAFE |
21 | 275 | 276 | ||
22 | 276 | AX_AM_JOBSERVER([yes]) | 277 | AX_AM_JOBSERVER([yes]) |
23 | 277 | 278 | ||
24 | === modified file 'docs/conf.py.in' | |||
25 | --- docs/conf.py.in 2013-01-09 16:53:25 +0000 | |||
26 | +++ docs/conf.py.in 2013-08-31 03:15:41 +0000 | |||
27 | @@ -292,6 +292,7 @@ | |||
28 | 292 | ('libgearman/gearman_job_st', 'gearman_job_free_all', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | 292 | ('libgearman/gearman_job_st', 'gearman_job_free_all', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), |
29 | 293 | ('libgearman/gearman_job_st', 'gearman_job_function_name', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | 293 | ('libgearman/gearman_job_st', 'gearman_job_function_name', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), |
30 | 294 | ('libgearman/gearman_job_st', 'gearman_job_handle', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | 294 | ('libgearman/gearman_job_st', 'gearman_job_handle', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), |
31 | 295 | ('libgearman/gearman_job_st', 'gearman_job_use_client', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | ||
32 | 295 | ('libgearman/gearman_job_st', 'gearman_job_send_complete', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | 296 | ('libgearman/gearman_job_st', 'gearman_job_send_complete', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), |
33 | 296 | ('libgearman/gearman_job_st', 'gearman_job_send_data', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | 297 | ('libgearman/gearman_job_st', 'gearman_job_send_data', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), |
34 | 297 | ('libgearman/gearman_job_st', 'gearman_job_send_exception', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), | 298 | ('libgearman/gearman_job_st', 'gearman_job_send_exception', u'Gearmand Documentation, http://gearman.info/', [u'Data Differential http://www.datadifferential.com/'], 3), |
35 | 298 | 299 | ||
36 | === modified file 'docs/libgearman/gearman_job_st.rst' | |||
37 | --- docs/libgearman/gearman_job_st.rst 2013-08-16 08:41:58 +0000 | |||
38 | +++ docs/libgearman/gearman_job_st.rst 2013-08-31 03:15:41 +0000 | |||
39 | @@ -36,6 +36,8 @@ | |||
40 | 36 | 36 | ||
41 | 37 | .. c:function:: void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size) | 37 | .. c:function:: void *gearman_job_take_workload(gearman_job_st *job, size_t *data_size) |
42 | 38 | 38 | ||
43 | 39 | .. c:function:: gearman_client_st *gearman_job_use_client(gearman_job_st *job) | ||
44 | 40 | |||
45 | 39 | Link with -lgearman | 41 | Link with -lgearman |
46 | 40 | 42 | ||
47 | 41 | ----------- | 43 | ----------- |
48 | @@ -54,10 +56,13 @@ | |||
49 | 54 | 56 | ||
50 | 55 | :c:func:`gearman_job_unique` return the unique value that was used for :c:type:`gearman_job_st`. | 57 | :c:func:`gearman_job_unique` return the unique value that was used for :c:type:`gearman_job_st`. |
51 | 56 | 58 | ||
53 | 57 | returns the :c:type:`gearman_job_st` workload. The size of it can be determined with :c:func:`gearman_job_workload_size`. | 59 | 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`. |
54 | 58 | :c:func:`gearman_job_take_workload` is the same as :c:func:`gearman_job_workload` with the exception that the result must be | 60 | :c:func:`gearman_job_take_workload` is the same as :c:func:`gearman_job_workload` with the exception that the result must be |
55 | 59 | :manpage:`free(3)` by the caller. | 61 | :manpage:`free(3)` by the caller. |
56 | 60 | 62 | ||
57 | 63 | 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. | ||
58 | 64 | 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. | ||
59 | 65 | |||
60 | 61 | ------------ | 66 | ------------ |
61 | 62 | RETURN VALUE | 67 | RETURN VALUE |
62 | 63 | ------------ | 68 | ------------ |
63 | 64 | 69 | ||
64 | === modified file 'libgearman-1.0/job.h' | |||
65 | --- libgearman-1.0/job.h 2013-07-10 01:57:34 +0000 | |||
66 | +++ libgearman-1.0/job.h 2013-08-31 03:15:41 +0000 | |||
67 | @@ -150,6 +150,9 @@ | |||
68 | 150 | gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job); | 150 | gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job); |
69 | 151 | 151 | ||
70 | 152 | GEARMAN_API | 152 | GEARMAN_API |
71 | 153 | gearman_client_st *gearman_job_use_client(gearman_job_st *job); | ||
72 | 154 | |||
73 | 155 | GEARMAN_API | ||
74 | 153 | const char *gearman_job_error(gearman_job_st *job); | 156 | const char *gearman_job_error(gearman_job_st *job); |
75 | 154 | 157 | ||
76 | 155 | /** @} */ | 158 | /** @} */ |
77 | 156 | 159 | ||
78 | === modified file 'libgearman-server/plugins/protocol/gear/protocol.cc' | |||
79 | === modified file 'libgearman/job.cc' | |||
80 | --- libgearman/job.cc 2013-08-05 22:43:13 +0000 | |||
81 | +++ libgearman/job.cc 2013-08-31 03:15:41 +0000 | |||
82 | @@ -226,6 +226,7 @@ | |||
83 | 226 | 226 | ||
84 | 227 | Job::Job(gearman_job_st* shell_, Worker& worker_): | 227 | Job::Job(gearman_job_st* shell_, Worker& worker_): |
85 | 228 | _worker(worker_), | 228 | _worker(worker_), |
86 | 229 | _client(NULL), | ||
87 | 229 | next(NULL), | 230 | next(NULL), |
88 | 230 | prev(NULL), | 231 | prev(NULL), |
89 | 231 | con(NULL), | 232 | con(NULL), |
90 | @@ -247,6 +248,30 @@ | |||
91 | 247 | gearman_set_initialized(_shell, true); | 248 | gearman_set_initialized(_shell, true); |
92 | 248 | } | 249 | } |
93 | 249 | 250 | ||
94 | 251 | Job::~Job() | ||
95 | 252 | { | ||
96 | 253 | if (_client) | ||
97 | 254 | { | ||
98 | 255 | gearman_client_free(_client); | ||
99 | 256 | } | ||
100 | 257 | |||
101 | 258 | delete reducer; | ||
102 | 259 | } | ||
103 | 260 | |||
104 | 261 | gearman_client_st* Job::client() | ||
105 | 262 | { | ||
106 | 263 | if (_client == NULL) | ||
107 | 264 | { | ||
108 | 265 | _client= gearman_client_create(NULL); | ||
109 | 266 | if (_client) | ||
110 | 267 | { | ||
111 | 268 | gearman_universal_clone(_client->impl()->universal, _worker.universal); | ||
112 | 269 | } | ||
113 | 270 | } | ||
114 | 271 | |||
115 | 272 | return _client; | ||
116 | 273 | } | ||
117 | 274 | |||
118 | 250 | bool gearman_job_build_reducer(Job* job, gearman_aggregator_fn *aggregator_fn) | 275 | bool gearman_job_build_reducer(Job* job, gearman_aggregator_fn *aggregator_fn) |
119 | 251 | { | 276 | { |
120 | 252 | if (job->reducer) | 277 | if (job->reducer) |
121 | @@ -272,6 +297,27 @@ | |||
122 | 272 | return true; | 297 | return true; |
123 | 273 | } | 298 | } |
124 | 274 | 299 | ||
125 | 300 | |||
126 | 301 | gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job_shell) | ||
127 | 302 | { | ||
128 | 303 | if (job_shell and job_shell->impl()) | ||
129 | 304 | { | ||
130 | 305 | return gearman_worker_clone(NULL, job_shell->impl()->_worker.shell()); | ||
131 | 306 | } | ||
132 | 307 | |||
133 | 308 | return NULL; | ||
134 | 309 | } | ||
135 | 310 | |||
136 | 311 | gearman_client_st *gearman_job_use_client(gearman_job_st *job_shell) | ||
137 | 312 | { | ||
138 | 313 | if (job_shell and job_shell->impl()) | ||
139 | 314 | { | ||
140 | 315 | return job_shell->impl()->client(); | ||
141 | 316 | } | ||
142 | 317 | |||
143 | 318 | return NULL; | ||
144 | 319 | } | ||
145 | 320 | |||
146 | 275 | static inline void gearman_job_reset_error(Job* job) | 321 | static inline void gearman_job_reset_error(Job* job) |
147 | 276 | { | 322 | { |
148 | 277 | if (job) | 323 | if (job) |
149 | @@ -778,9 +824,6 @@ | |||
150 | 778 | } | 824 | } |
151 | 779 | job->_worker.job_count--; | 825 | job->_worker.job_count--; |
152 | 780 | 826 | ||
153 | 781 | delete job->reducer; | ||
154 | 782 | job->reducer= NULL; | ||
155 | 783 | |||
156 | 784 | delete job; | 827 | delete job; |
157 | 785 | } | 828 | } |
158 | 786 | else if (job_shell) | 829 | else if (job_shell) |
159 | 787 | 830 | ||
160 | === modified file 'libgearman/job.hpp' | |||
161 | --- libgearman/job.hpp 2013-07-15 19:50:11 +0000 | |||
162 | +++ libgearman/job.hpp 2013-08-31 03:15:41 +0000 | |||
163 | @@ -43,6 +43,7 @@ | |||
164 | 43 | { | 43 | { |
165 | 44 | public: | 44 | public: |
166 | 45 | Job(gearman_job_st* shell_, Worker& worker_); | 45 | Job(gearman_job_st* shell_, Worker& worker_); |
167 | 46 | ~Job(); | ||
168 | 46 | 47 | ||
169 | 47 | gearman_job_st* shell() | 48 | gearman_job_st* shell() |
170 | 48 | { | 49 | { |
171 | @@ -72,6 +73,7 @@ | |||
172 | 72 | } | 73 | } |
173 | 73 | 74 | ||
174 | 74 | Worker& _worker; | 75 | Worker& _worker; |
175 | 76 | gearman_client_st* _client; | ||
176 | 75 | Job *next; | 77 | Job *next; |
177 | 76 | Job *prev; | 78 | Job *prev; |
178 | 77 | gearman_connection_st *con; | 79 | gearman_connection_st *con; |
179 | @@ -85,6 +87,8 @@ | |||
180 | 85 | return _worker.universal; | 87 | return _worker.universal; |
181 | 86 | } | 88 | } |
182 | 87 | 89 | ||
183 | 90 | gearman_client_st* client(); | ||
184 | 91 | |||
185 | 88 | gearman_universal_st& universal() const | 92 | gearman_universal_st& universal() const |
186 | 89 | { | 93 | { |
187 | 90 | return _worker.universal; | 94 | return _worker.universal; |
188 | 91 | 95 | ||
189 | === modified file 'libgearman/worker.cc' | |||
190 | --- libgearman/worker.cc 2013-08-23 07:08:19 +0000 | |||
191 | +++ libgearman/worker.cc 2013-08-31 03:15:41 +0000 | |||
192 | @@ -1439,16 +1439,6 @@ | |||
193 | 1439 | return gearman_universal_id(self->impl()->universal); | 1439 | return gearman_universal_id(self->impl()->universal); |
194 | 1440 | } | 1440 | } |
195 | 1441 | 1441 | ||
196 | 1442 | gearman_worker_st *gearman_job_clone_worker(gearman_job_st *job_shell) | ||
197 | 1443 | { | ||
198 | 1444 | if (job_shell and job_shell->impl()) | ||
199 | 1445 | { | ||
200 | 1446 | return gearman_worker_clone(NULL, job_shell->impl()->_worker.shell()); | ||
201 | 1447 | } | ||
202 | 1448 | |||
203 | 1449 | return NULL; | ||
204 | 1450 | } | ||
205 | 1451 | |||
206 | 1452 | gearman_return_t gearman_worker_set_identifier(gearman_worker_st *worker, | 1442 | gearman_return_t gearman_worker_set_identifier(gearman_worker_st *worker, |
207 | 1453 | const char *id, size_t id_size) | 1443 | const char *id, size_t id_size) |
208 | 1454 | { | 1444 | { |
209 | 1455 | 1445 | ||
210 | === modified file 'm4/ax_uuid.m4' | |||
211 | --- m4/ax_uuid.m4 2013-04-27 04:10:37 +0000 | |||
212 | +++ m4/ax_uuid.m4 2013-08-31 03:15:41 +0000 | |||
213 | @@ -5,9 +5,9 @@ | |||
214 | 5 | # | 5 | # |
215 | 6 | # SYNOPSIS | 6 | # SYNOPSIS |
216 | 7 | # | 7 | # |
220 | 8 | # AX_UUID() | 8 | # AX_UUID([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
221 | 9 | # AX_UUID_GENERATE_TIME() | 9 | # AX_UUID_GENERATE_TIME([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
222 | 10 | # AX_UUID_GENERATE_TIME_SAFE() | 10 | # AX_UUID_GENERATE_TIME_SAFE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
223 | 11 | # | 11 | # |
224 | 12 | # DESCRIPTION | 12 | # DESCRIPTION |
225 | 13 | # | 13 | # |
226 | @@ -22,7 +22,7 @@ | |||
227 | 22 | # and this notice are preserved. This file is offered as-is, without any | 22 | # and this notice are preserved. This file is offered as-is, without any |
228 | 23 | # warranty. | 23 | # warranty. |
229 | 24 | 24 | ||
231 | 25 | #serial 7 | 25 | #serial 8 |
232 | 26 | 26 | ||
233 | 27 | AC_DEFUN([AX_UUID], | 27 | AC_DEFUN([AX_UUID], |
234 | 28 | [AC_PREREQ([2.63])dnl | 28 | [AC_PREREQ([2.63])dnl |
235 | @@ -71,54 +71,66 @@ | |||
236 | 71 | 71 | ||
237 | 72 | AC_SUBST([LIBUUID_LIB]) | 72 | AC_SUBST([LIBUUID_LIB]) |
238 | 73 | AM_CONDITIONAL([HAVE_LIBUUID],[test "x$ax_libuuid" = xyes]) | 73 | AM_CONDITIONAL([HAVE_LIBUUID],[test "x$ax_libuuid" = xyes]) |
239 | 74 | |||
240 | 75 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: | ||
241 | 76 | AS_IF([test "x$ax_libuuid" = xyes], | ||
242 | 77 | [$1], | ||
243 | 78 | [$2]) | ||
244 | 74 | ]) | 79 | ]) |
245 | 75 | 80 | ||
246 | 76 | AC_DEFUN([AX_UUID_GENERATE_TIME], | 81 | AC_DEFUN([AX_UUID_GENERATE_TIME], |
265 | 77 | [AC_PREREQ([2.63])dnl | 82 | [AC_PREREQ([2.63])dnl |
266 | 78 | AC_REQUIRE([AX_UUID])dnl | 83 | AX_UUID([$1],[$2]) |
267 | 79 | AC_CACHE_CHECK([for uuid_generate_time], | 84 | AC_CACHE_CHECK([for uuid_generate_time], |
268 | 80 | [ax_cv_uuid_generate_time], | 85 | [ax_cv_uuid_generate_time], |
269 | 81 | [AX_SAVE_FLAGS | 86 | [AX_SAVE_FLAGS |
270 | 82 | LIBS="$LIBUUID_LIB $LIBS" | 87 | LIBS="$LIBUUID_LIB $LIBS" |
271 | 83 | AC_LANG_PUSH([C]) | 88 | AC_LANG_PUSH([C]) |
272 | 84 | AC_RUN_IFELSE([ | 89 | AC_RUN_IFELSE([ |
273 | 85 | AC_LANG_PROGRAM([#include <uuid/uuid.h>],[ | 90 | AC_LANG_PROGRAM([#include <uuid/uuid.h>],[ |
274 | 86 | uuid_t out; | 91 | uuid_t out; |
275 | 87 | uuid_generate_time(out); | 92 | uuid_generate_time(out); |
276 | 88 | ])], | 93 | ])], |
277 | 89 | [ax_cv_uuid_generate_time=yes], | 94 | [ax_cv_uuid_generate_time=yes], |
278 | 90 | [ax_cv_uuid_generate_time=no], | 95 | [ax_cv_uuid_generate_time=no], |
279 | 91 | [AC_MSG_WARN([test program execution failed])]) | 96 | [AC_MSG_WARN([test program execution failed])]) |
280 | 92 | AC_LANG_POP | 97 | AC_LANG_POP |
281 | 93 | AX_RESTORE_FLAGS | 98 | AX_RESTORE_FLAGS |
282 | 94 | ]) | 99 | ]) |
283 | 95 | 100 | ||
288 | 96 | AS_IF([test "$ax_cv_uuid_generate_time" = yes], | 101 | AS_IF([test "$ax_cv_uuid_generate_time" = yes], |
289 | 97 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[1],[Define if uuid_generate_time is present in uuid/uuid.h.])], | 102 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[1],[Define if uuid_generate_time is present in uuid/uuid.h.])], |
290 | 98 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[0],[Define if uuid_generate_time is present in uuid/uuid.h.])]) | 103 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[0],[Define if uuid_generate_time is present in uuid/uuid.h.])]) |
291 | 99 | ]) | 104 | AS_IF([test "x$ax_cv_uuid_generate_time" = xyes], |
292 | 105 | [$1], | ||
293 | 106 | [$2]) | ||
294 | 107 | ]) | ||
295 | 100 | 108 | ||
296 | 101 | AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], | 109 | AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], |
320 | 102 | [AC_PREREQ([2.63])dnl | 110 | [AC_PREREQ([2.63])dnl |
321 | 103 | AC_REQUIRE([AX_UUID])dnl | 111 | AX_UUID([$1],[$2]) |
322 | 104 | AC_CACHE_CHECK([for uuid_generate_time_safe], | 112 | AC_CACHE_CHECK([for uuid_generate_time_safe], |
323 | 105 | [ax_cv_uuid_generate_time_safe], | 113 | [ax_cv_uuid_generate_time_safe], |
324 | 106 | [AX_SAVE_FLAGS | 114 | [AX_SAVE_FLAGS |
325 | 107 | LIBS="$LIBUUID_LIB $LIBS" | 115 | LIBS="$LIBUUID_LIB $LIBS" |
326 | 108 | AC_LANG_PUSH([C]) | 116 | AC_LANG_PUSH([C]) |
327 | 109 | AC_RUN_IFELSE([ | 117 | AC_RUN_IFELSE([ |
328 | 110 | AC_LANG_PROGRAM([#include <uuid/uuid.h>],[ | 118 | AC_LANG_PROGRAM([#include <uuid/uuid.h>],[ |
329 | 111 | uuid_t out; | 119 | uuid_t out; |
330 | 112 | uuid_generate_time_safe(out); | 120 | uuid_generate_time_safe(out); |
331 | 113 | ])], | 121 | ])], |
332 | 114 | [ax_cv_uuid_generate_time_safe=yes], | 122 | [ax_cv_uuid_generate_time_safe=yes], |
333 | 115 | [ax_cv_uuid_generate_time_safe=no], | 123 | [ax_cv_uuid_generate_time_safe=no], |
334 | 116 | [AC_MSG_WARN([test program execution failed])]) | 124 | [AC_MSG_WARN([test program execution failed])]) |
335 | 117 | AC_LANG_POP | 125 | AC_LANG_POP |
336 | 118 | AX_RESTORE_FLAGS | 126 | AX_RESTORE_FLAGS |
337 | 119 | ]) | 127 | ]) |
338 | 120 | 128 | ||
339 | 121 | AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes], | 129 | AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes], |
340 | 122 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])], | 130 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])], |
341 | 123 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])]) | 131 | [AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE],[0],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])]) |
342 | 124 | ]) | 132 | |
343 | 133 | AS_IF([test "x$ax_cv_uuid_generate_time_safe" = xyes], | ||
344 | 134 | [$1], | ||
345 | 135 | [$2]) | ||
346 | 136 | ]) | ||
347 | 125 | 137 | ||
348 | === modified file 'man/include.am' | |||
349 | --- man/include.am 2013-08-16 08:58:49 +0000 | |||
350 | +++ man/include.am 2013-08-31 03:15:41 +0000 | |||
351 | @@ -87,6 +87,7 @@ | |||
352 | 87 | notrans_dist_man_MANS+= gearman_job_st.3 | 87 | notrans_dist_man_MANS+= gearman_job_st.3 |
353 | 88 | notrans_dist_man_MANS+= gearman_job_take_workload.3 | 88 | notrans_dist_man_MANS+= gearman_job_take_workload.3 |
354 | 89 | notrans_dist_man_MANS+= gearman_job_unique.3 | 89 | notrans_dist_man_MANS+= gearman_job_unique.3 |
355 | 90 | notrans_dist_man_MANS+= gearman_job_use_client.3 | ||
356 | 90 | notrans_dist_man_MANS+= gearman_job_workload.3 | 91 | notrans_dist_man_MANS+= gearman_job_workload.3 |
357 | 91 | notrans_dist_man_MANS+= gearman_job_workload_size.3 | 92 | notrans_dist_man_MANS+= gearman_job_workload_size.3 |
358 | 92 | notrans_dist_man_MANS+= gearman_log_fn.3 | 93 | notrans_dist_man_MANS+= gearman_log_fn.3 |
359 | 93 | 94 | ||
360 | === modified file 'support/gearmand.spec.in' | |||
361 | --- support/gearmand.spec.in 2013-07-18 05:59:53 +0000 | |||
362 | +++ support/gearmand.spec.in 2013-08-31 03:15:41 +0000 | |||
363 | @@ -235,6 +235,7 @@ | |||
364 | 235 | %{_mandir}/man3/gearman_job_st.3.gz | 235 | %{_mandir}/man3/gearman_job_st.3.gz |
365 | 236 | %{_mandir}/man3/gearman_job_take_workload.3.gz | 236 | %{_mandir}/man3/gearman_job_take_workload.3.gz |
366 | 237 | %{_mandir}/man3/gearman_job_unique.3.gz | 237 | %{_mandir}/man3/gearman_job_unique.3.gz |
367 | 238 | %{_mandir}/man3/gearman_job_use_client.3.gz | ||
368 | 238 | %{_mandir}/man3/gearman_job_workload.3.gz | 239 | %{_mandir}/man3/gearman_job_workload.3.gz |
369 | 239 | %{_mandir}/man3/gearman_job_workload_size.3.gz | 240 | %{_mandir}/man3/gearman_job_workload_size.3.gz |
370 | 240 | %{_mandir}/man3/gearman_log_fn.3.gz | 241 | %{_mandir}/man3/gearman_log_fn.3.gz |
371 | 241 | 242 | ||
372 | === modified file 'tests/libgearman-1.0/worker_test.cc' | |||
373 | --- tests/libgearman-1.0/worker_test.cc 2013-08-20 09:27:42 +0000 | |||
374 | +++ tests/libgearman-1.0/worker_test.cc 2013-08-31 03:15:41 +0000 | |||
375 | @@ -62,6 +62,7 @@ | |||
376 | 62 | 62 | ||
377 | 63 | #include "tests/start_worker.h" | 63 | #include "tests/start_worker.h" |
378 | 64 | #include "tests/workers/v2/call_exception.h" | 64 | #include "tests/workers/v2/call_exception.h" |
379 | 65 | #include "tests/workers/v2/client_echo.h" | ||
380 | 65 | #include "tests/workers/v2/echo_or_react.h" | 66 | #include "tests/workers/v2/echo_or_react.h" |
381 | 66 | #include "tests/workers/v2/echo_or_react_chunk.h" | 67 | #include "tests/workers/v2/echo_or_react_chunk.h" |
382 | 67 | #include "tests/workers/v2/call_exception.h" | 68 | #include "tests/workers/v2/call_exception.h" |
383 | @@ -942,6 +943,75 @@ | |||
384 | 942 | return TEST_SUCCESS; | 943 | return TEST_SUCCESS; |
385 | 943 | } | 944 | } |
386 | 944 | 945 | ||
387 | 946 | static test_return_t gearman_job_client_TEST(void *) | ||
388 | 947 | { | ||
389 | 948 | gearman_function_t call_client_echo_WORKER_FN= gearman_function_create(client_echo_WORKER); | ||
390 | 949 | std::auto_ptr<worker_handle_st> handle(test_worker_start(libtest::default_port(), | ||
391 | 950 | NULL, | ||
392 | 951 | "client_echo", | ||
393 | 952 | call_client_echo_WORKER_FN, | ||
394 | 953 | NULL, | ||
395 | 954 | gearman_worker_options_t(), | ||
396 | 955 | 0)); // timeout | ||
397 | 956 | |||
398 | 957 | std::vector<gearman_task_st*> tasks; | ||
399 | 958 | libgearman::Client client(libtest::default_port()); | ||
400 | 959 | |||
401 | 960 | gearman_client_add_options(&client, GEARMAN_CLIENT_EXCEPTION); | ||
402 | 961 | |||
403 | 962 | for (size_t x= 0; x < 10; ++x) | ||
404 | 963 | { | ||
405 | 964 | char buffer[GEARMAN_MAXIMUM_INTEGER_DISPLAY_LENGTH]; | ||
406 | 965 | int buffer_length= snprintf(buffer, sizeof(buffer), "%d", int(x)); | ||
407 | 966 | gearman_return_t ret; | ||
408 | 967 | gearman_task_st *task= gearman_client_add_task(&client, | ||
409 | 968 | NULL, // preallocated task | ||
410 | 969 | NULL, // context | ||
411 | 970 | "client_echo", // function | ||
412 | 971 | NULL, // unique | ||
413 | 972 | (const void*)buffer, size_t(buffer_length), // workload | ||
414 | 973 | &ret); | ||
415 | 974 | ASSERT_EQ(ret, GEARMAN_SUCCESS); | ||
416 | 975 | ASSERT_TRUE(task); | ||
417 | 976 | |||
418 | 977 | tasks.push_back(task); | ||
419 | 978 | } | ||
420 | 979 | |||
421 | 980 | bool more= true; | ||
422 | 981 | while (more) | ||
423 | 982 | { | ||
424 | 983 | for (std::vector<gearman_task_st*>::iterator iter= tasks.begin(); | ||
425 | 984 | iter != tasks.end(); ++iter) | ||
426 | 985 | { | ||
427 | 986 | if (gearman_task_return(*iter) == GEARMAN_UNKNOWN_STATE) | ||
428 | 987 | { | ||
429 | 988 | { | ||
430 | 989 | gearman_return_t ret; | ||
431 | 990 | do { | ||
432 | 991 | ret= gearman_client_run_tasks(&client); | ||
433 | 992 | } while (gearman_continue(ret)); | ||
434 | 993 | |||
435 | 994 | if (gearman_failed(ret)) | ||
436 | 995 | { | ||
437 | 996 | Error << gearman_strerror(ret); | ||
438 | 997 | } | ||
439 | 998 | ASSERT_EQ(GEARMAN_SUCCESS, ret); | ||
440 | 999 | } | ||
441 | 1000 | |||
442 | 1001 | continue; | ||
443 | 1002 | } | ||
444 | 1003 | else | ||
445 | 1004 | { | ||
446 | 1005 | ASSERT_EQ(GEARMAN_SUCCESS, gearman_task_return(*iter)); | ||
447 | 1006 | } | ||
448 | 1007 | |||
449 | 1008 | more= false; | ||
450 | 1009 | } | ||
451 | 1010 | } | ||
452 | 1011 | |||
453 | 1012 | return TEST_SUCCESS; | ||
454 | 1013 | } | ||
455 | 1014 | |||
456 | 945 | static test_return_t gearman_job_send_exception_TEST(void *) | 1015 | static test_return_t gearman_job_send_exception_TEST(void *) |
457 | 946 | { | 1016 | { |
458 | 947 | libgearman::Client client(libtest::default_port()); | 1017 | libgearman::Client client(libtest::default_port()); |
459 | @@ -1671,6 +1741,7 @@ | |||
460 | 1671 | {"gearman_client_job_status(is_known)", 0, gearman_client_job_status_is_known_TEST }, | 1741 | {"gearman_client_job_status(is_known)", 0, gearman_client_job_status_is_known_TEST }, |
461 | 1672 | {"gearman_job_send_exception()", 0, gearman_job_send_exception_TEST }, | 1742 | {"gearman_job_send_exception()", 0, gearman_job_send_exception_TEST }, |
462 | 1673 | {"gearman_job_send_exception(mass)", 0, gearman_job_send_exception_mass_TEST }, | 1743 | {"gearman_job_send_exception(mass)", 0, gearman_job_send_exception_mass_TEST }, |
463 | 1744 | {"gearman_job_client()", 0, gearman_job_client_TEST }, | ||
464 | 1674 | {"job order", 0, job_order_TEST }, | 1745 | {"job order", 0, job_order_TEST }, |
465 | 1675 | {"job background order", 0, job_order_background_TEST }, | 1746 | {"job background order", 0, job_order_background_TEST }, |
466 | 1676 | {"echo_max", 0, echo_max_test }, | 1747 | {"echo_max", 0, echo_max_test }, |
467 | 1677 | 1748 | ||
468 | === modified file 'tests/workers/include.am' | |||
469 | --- tests/workers/include.am 2013-05-28 22:55:50 +0000 | |||
470 | +++ tests/workers/include.am 2013-08-31 03:15:41 +0000 | |||
471 | @@ -16,6 +16,7 @@ | |||
472 | 16 | noinst_HEADERS+= tests/workers/v2/call_exception.h | 16 | noinst_HEADERS+= tests/workers/v2/call_exception.h |
473 | 17 | noinst_HEADERS+= tests/workers/v2/called.h | 17 | noinst_HEADERS+= tests/workers/v2/called.h |
474 | 18 | noinst_HEADERS+= tests/workers/v2/check_order.h | 18 | noinst_HEADERS+= tests/workers/v2/check_order.h |
475 | 19 | noinst_HEADERS+= tests/workers/v2/client_echo.h | ||
476 | 19 | noinst_HEADERS+= tests/workers/v2/count.h | 20 | noinst_HEADERS+= tests/workers/v2/count.h |
477 | 20 | noinst_HEADERS+= tests/workers/v2/echo_or_react.h | 21 | noinst_HEADERS+= tests/workers/v2/echo_or_react.h |
478 | 21 | noinst_HEADERS+= tests/workers/v2/echo_or_react_chunk.h | 22 | noinst_HEADERS+= tests/workers/v2/echo_or_react_chunk.h |
479 | @@ -46,6 +47,7 @@ | |||
480 | 46 | tests_libstartworker_la_SOURCES+= tests/workers/v1/unique.cc | 47 | tests_libstartworker_la_SOURCES+= tests/workers/v1/unique.cc |
481 | 47 | tests_libstartworker_la_SOURCES+= tests/workers/v2/call_exception.cc | 48 | tests_libstartworker_la_SOURCES+= tests/workers/v2/call_exception.cc |
482 | 48 | tests_libstartworker_la_SOURCES+= tests/workers/v2/called.cc | 49 | tests_libstartworker_la_SOURCES+= tests/workers/v2/called.cc |
483 | 50 | tests_libstartworker_la_SOURCES+= tests/workers/v2/client_echo.cc | ||
484 | 49 | tests_libstartworker_la_SOURCES+= tests/workers/v2/count.cc | 51 | tests_libstartworker_la_SOURCES+= tests/workers/v2/count.cc |
485 | 50 | tests_libstartworker_la_SOURCES+= tests/workers/v2/echo_or_react.cc | 52 | tests_libstartworker_la_SOURCES+= tests/workers/v2/echo_or_react.cc |
486 | 51 | tests_libstartworker_la_SOURCES+= tests/workers/v2/echo_or_react_chunk.cc | 53 | tests_libstartworker_la_SOURCES+= tests/workers/v2/echo_or_react_chunk.cc |
487 | 52 | 54 | ||
488 | === added file 'tests/workers/v2/client_echo.cc' | |||
489 | --- tests/workers/v2/client_echo.cc 1970-01-01 00:00:00 +0000 | |||
490 | +++ tests/workers/v2/client_echo.cc 2013-08-31 03:15:41 +0000 | |||
491 | @@ -0,0 +1,67 @@ | |||
492 | 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | ||
493 | 2 | * | ||
494 | 3 | * Gearmand client and server library. | ||
495 | 4 | * | ||
496 | 5 | * Copyright (C) 2013 Data Differential, http://datadifferential.com/ | ||
497 | 6 | * All rights reserved. | ||
498 | 7 | * | ||
499 | 8 | * Redistribution and use in source and binary forms, with or without | ||
500 | 9 | * modification, are permitted provided that the following conditions are | ||
501 | 10 | * met: | ||
502 | 11 | * | ||
503 | 12 | * * Redistributions of source code must retain the above copyright | ||
504 | 13 | * notice, this list of conditions and the following disclaimer. | ||
505 | 14 | * | ||
506 | 15 | * * Redistributions in binary form must reproduce the above | ||
507 | 16 | * copyright notice, this list of conditions and the following disclaimer | ||
508 | 17 | * in the documentation and/or other materials provided with the | ||
509 | 18 | * distribution. | ||
510 | 19 | * | ||
511 | 20 | * * The names of its contributors may not be used to endorse or | ||
512 | 21 | * promote products derived from this software without specific prior | ||
513 | 22 | * written permission. | ||
514 | 23 | * | ||
515 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
516 | 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
517 | 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
518 | 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
519 | 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
520 | 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
521 | 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
522 | 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
523 | 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
524 | 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
525 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
526 | 35 | * | ||
527 | 36 | */ | ||
528 | 37 | |||
529 | 38 | #include <gear_config.h> | ||
530 | 39 | |||
531 | 40 | #include <libtest/test.hpp> | ||
532 | 41 | |||
533 | 42 | #include <libgearman-1.0/gearman.h> | ||
534 | 43 | |||
535 | 44 | #include "tests/workers/v2/client_echo.h" | ||
536 | 45 | |||
537 | 46 | #include <cassert> | ||
538 | 47 | #include <cstring> | ||
539 | 48 | |||
540 | 49 | gearman_return_t client_echo_WORKER(gearman_job_st *job, void *) | ||
541 | 50 | { | ||
542 | 51 | gearman_client_st* client= gearman_job_use_client(job); | ||
543 | 52 | |||
544 | 53 | if (client) | ||
545 | 54 | { | ||
546 | 55 | if (gearman_failed(gearman_client_echo(client, test_literal_param("Tastes great")))) | ||
547 | 56 | { | ||
548 | 57 | assert(gearman_client_error(client)); | ||
549 | 58 | return gearman_job_send_exception(job, gearman_client_error(client), strlen(gearman_client_error(client))); | ||
550 | 59 | } | ||
551 | 60 | } | ||
552 | 61 | else | ||
553 | 62 | { | ||
554 | 63 | return gearman_job_send_exception(job, test_literal_param("Failed to allocate gearman_client_st")); | ||
555 | 64 | } | ||
556 | 65 | |||
557 | 66 | return GEARMAN_SUCCESS; | ||
558 | 67 | } | ||
559 | 0 | 68 | ||
560 | === added file 'tests/workers/v2/client_echo.h' | |||
561 | --- tests/workers/v2/client_echo.h 1970-01-01 00:00:00 +0000 | |||
562 | +++ tests/workers/v2/client_echo.h 2013-08-31 03:15:41 +0000 | |||
563 | @@ -0,0 +1,42 @@ | |||
564 | 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | ||
565 | 2 | * | ||
566 | 3 | * Gearmand client and server library. | ||
567 | 4 | * | ||
568 | 5 | * Copyright (C) 2013 Data Differential, http://datadifferential.com/ | ||
569 | 6 | * All rights reserved. | ||
570 | 7 | * | ||
571 | 8 | * Redistribution and use in source and binary forms, with or without | ||
572 | 9 | * modification, are permitted provided that the following conditions are | ||
573 | 10 | * met: | ||
574 | 11 | * | ||
575 | 12 | * * Redistributions of source code must retain the above copyright | ||
576 | 13 | * notice, this list of conditions and the following disclaimer. | ||
577 | 14 | * | ||
578 | 15 | * * Redistributions in binary form must reproduce the above | ||
579 | 16 | * copyright notice, this list of conditions and the following disclaimer | ||
580 | 17 | * in the documentation and/or other materials provided with the | ||
581 | 18 | * distribution. | ||
582 | 19 | * | ||
583 | 20 | * * The names of its contributors may not be used to endorse or | ||
584 | 21 | * promote products derived from this software without specific prior | ||
585 | 22 | * written permission. | ||
586 | 23 | * | ||
587 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
588 | 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
589 | 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
590 | 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
591 | 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
592 | 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
593 | 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
594 | 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
595 | 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
596 | 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
597 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
598 | 35 | * | ||
599 | 36 | */ | ||
600 | 37 | |||
601 | 38 | #pragma once | ||
602 | 39 | |||
603 | 40 | LIBTEST_API | ||
604 | 41 | gearman_return_t client_echo_WORKER(gearman_job_st *job, void *); | ||
605 | 42 |