Queue.c

filter: Statementstmt 61.2% 737 / 1204 Branchbran 40.1% 268 / 668 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 53.6% 1005 / 1872 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« include/pq_worker.h ↑ Summary xs/job.xs »
1 /*
2 * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the
3 * contents of Queue.xs. Do not edit this file, edit Queue.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8  
9 #line 1 "Queue.xs"
10 /*
11 * Queue.xs - root XS file
12 *
13 * Thin wrapper: resolves the File::Raw::JSON C ABI, includes the C
14 * implementation headers in strict dependency order, then pulls in the
15 * per-package XS fragments from xs/ via INCLUDE: (the Punk / Chandra /
16 * Open::API layout).
17 *
18 * The headers below are implementation headers full of static functions,
19 * not an interface. The public C contract is include/pq_abi.h, which
20 * arrives in phase 7 once these have stopped moving.
21 */
22  
23 #define PERL_NO_GET_CONTEXT
24 #include "EXTERN.h"
25 #include "perl.h"
26 #include "XSUB.h"
27  
28 #include "pq_compat.h" /* perl shims + the croaking allocators;
29 * must precede every other pq_ header */
30  
31 #include "frj_abi.h" /* File::Raw::JSON's ABI, via EU::Depends */
32 #include "pq_frj.h" /* ...and the lazy resolver for it */
33  
34 #include "pq_time.h" /* epoch seconds + the clock delta */
35 #include "pq_sql.h" /* statement assembly, the name rules */
36 #include "pq_dbi.h" /* the pooled DBI seam */
37 #include "pq_job.h" /* the job column list and row decode */
38 #include "pq_log.h" /* per-job log lines */
39 #include "pq_claim.h" /* the claim parts both backends share */
40 #include "pq_migrate.h" /* the migration runner */
41 #include "pq_migrate_sqlite.h" /* the SQLite schema */
42 #include "pq_migrate_pg.h" /* the PostgreSQL schema */
43 #include "pq_sqlite.h" /* the SQLite divergences */
44 #include "pq_pg.h" /* the PostgreSQL divergences */
45 #include "pq_backend.h" /* shared ops + per-driver dispatch */
46 #include "pq_lock.h" /* the two lock disciplines */
47 #include "pq_repair.h" /* broadcast/receive + the repair passes */
48 #include "hm_abi.h" /* Hyperman's ABI, vendored (soft dep) */
49 #include "pq_hm.h" /* ...and the optional lazy resolver */
50 #include "pq_queue.h" /* the Punk::Queue front (needs pq_hm:
51 * perform's timeout layers pick alarm or
52 * a loop timer by whether a loop is live) */
53 #include "time_keeper_recurrence_abi.h" /* Time::Keeper::Recurrence's ABI, vendored (soft dep) */
54 #include "pq_tkr.h" /* ...and the optional lazy resolver */
55 #include "pq_cron.h" /* the cron parser + next-occurrence walk */
56 #include "pq_sched.h" /* cron storage + the leader tick */
57 #include "pq_worker.h" /* the worker child state machine */
58 #include "pq_inserver.h" /* the in-server claim tick (web workers) */
59 #include "pq_super.h" /* the supervisor process pool */
60  
61 #line 62 "Queue.c"
62 #ifndef PERL_UNUSED_VAR
63 # define PERL_UNUSED_VAR(var) if (0) var = var
64 #endif
65  
66 #ifndef dVAR
67 # define dVAR dNOOP
68 #endif
69  
70  
71 /* This stuff is not part of the API! You have been warned. */
72 #ifndef PERL_VERSION_DECIMAL
73 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
74 #endif
75 #ifndef PERL_DECIMAL_VERSION
76 # define PERL_DECIMAL_VERSION \
77 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
78 #endif
79 #ifndef PERL_VERSION_GE
80 # define PERL_VERSION_GE(r,v,s) \
81 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
82 #endif
83 #ifndef PERL_VERSION_LE
84 # define PERL_VERSION_LE(r,v,s) \
85 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
86 #endif
87  
88 /* XS_INTERNAL is the explicit static-linkage variant of the default
89 * XS macro.
90 *
91 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
92 * "static", ie. it exports XSUB symbols. You probably don't want that
93 * for anything but the BOOT XSUB.
94 *
95 * See XSUB.h in core!
96 */
97  
98  
99 /* TODO: This might be compatible further back than 5.10.0. */
100 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
101 # undef XS_EXTERNAL
102 # undef XS_INTERNAL
103 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
104 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
105 # define XS_INTERNAL(name) static XSPROTO(name)
106 # endif
107 # if defined(__SYMBIAN32__)
108 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
109 # define XS_INTERNAL(name) EXPORT_C static XSPROTO(name)
110 # endif
111 # ifndef XS_EXTERNAL
112 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
113 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
114 # define XS_INTERNAL(name) static void name(pTHX_ CV* cv __attribute__unused__)
115 # else
116 # ifdef __cplusplus
117 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
118 # define XS_INTERNAL(name) static XSPROTO(name)
119 # else
120 # define XS_EXTERNAL(name) XSPROTO(name)
121 # define XS_INTERNAL(name) static XSPROTO(name)
122 # endif
123 # endif
124 # endif
125 #endif
126  
127 /* perl >= 5.10.0 && perl <= 5.15.1 */
128  
129  
130 /* The XS_EXTERNAL macro is used for functions that must not be static
131 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
132 * macro defined, the best we can do is assume XS is the same.
133 * Dito for XS_INTERNAL.
134 */
135 #ifndef XS_EXTERNAL
136 # define XS_EXTERNAL(name) XS(name)
137 #endif
138 #ifndef XS_INTERNAL
139 # define XS_INTERNAL(name) XS(name)
140 #endif
141  
142 /* Now, finally, after all this mess, we want an ExtUtils::ParseXS
143 * internal macro that we're free to redefine for varying linkage due
144 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
145 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
146 */
147  
148 #undef XS_EUPXS
149 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
150 # define XS_EUPXS(name) XS_EXTERNAL(name)
151 #else
152 /* default to internal */
153 # define XS_EUPXS(name) XS_INTERNAL(name)
154 #endif
155  
156 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
157 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
158  
159 /* prototype to pass -Wmissing-prototypes */
160 static void
161 S_croak_xs_usage(const CV *const cv, const char *const params);
162  
163 static void
164 S_croak_xs_usage(const CV *const cv, const char *const params)
165 {
166 const GV *const gv = CvGV(cv);
167  
168 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
169  
170 if (gv) {
171 const char *const gvname = GvNAME(gv);
172 const HV *const stash = GvSTASH(gv);
173 const char *const hvname = stash ? HvNAME(stash) : NULL;
174  
175 if (hvname)
176 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
177 else
178 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
179 } else {
180 /* Pants. I don't think that it should be possible to get here. */
181 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
182 }
183 }
184 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
185  
186 #define croak_xs_usage S_croak_xs_usage
187  
188 #endif
189  
190 /* NOTE: the prototype of newXSproto() is different in versions of perls,
191 * so we define a portable version of newXSproto()
192 */
193 #ifdef newXS_flags
194 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
195 #else
196 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
197 #endif /* !defined(newXS_flags) */
198  
199 #if PERL_VERSION_LE(5, 21, 5)
200 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
201 #else
202 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
203 #endif
204  
205 /* simple backcompat versions of the TARGx() macros with no optimisation */
206 #ifndef TARGi
207 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
208 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
209 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
210 #endif
211  
212 #line 213 "Queue.c"
213  
214 /* INCLUDE: Including 'xs/queue.xs' from 'Queue.xs' */
215  
216  
217 XS_EUPXS(XS_Punk__Queue_new); /* prototype to pass -Wmissing-prototypes */
218 212 XS_EUPXS(XS_Punk__Queue_new)
219 {
220 212 dVAR; dXSARGS;
221 212 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 212 212
222 0 croak_xs_usage(cv, "class, ...");
223 {
224 212 ▶ SV * class = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * class = ST(0) 0 212 212
225 ;
226 #line 10 "./xs/queue.xs"
227 HV *opts, *self;
228 SV *bclass, *backend, *rv;
229 int i;
230 #line 231 "Queue.c"
231 SV * RETVAL;
232 #line 14 "./xs/queue.xs"
233 {
234 if ((items - 1) % 2)
235 croak("Punk::Queue->new: odd number of options");
236  
237 opts = newHV();
238 for (i = 1; i < items; i += 2)
239 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
240  
241 /* An externally supplied handle is a legitimate way in - a test
242 * fixture, or an app that already manages its own connection. It
243 * still needs a backend class, so infer one from the driver. */
244 if (!pq_get(aTHX_ opts, "dsn") && !pq_get(aTHX_ opts, "backend")) {
245 SV *dbh = pq_get(aTHX_ opts, "dbh");
246 if (dbh && SvROK(dbh)) {
247 if (pq_driver_is(aTHX_ dbh, "SQLite"))
248 (void)hv_stores(opts, "backend", newSVpvs("SQLite"));
249 else if (pq_driver_is(aTHX_ dbh, "Pg"))
250 (void)hv_stores(opts, "backend", newSVpvs("Pg"));
251 }
252 }
253  
254 bclass = pq_backend_class(aTHX_ opts);
255 backend = pq_backend_construct(aTHX_ bclass, opts);
256  
257 self = newHV();
258 (void)hv_stores(self, "backend", backend);
259 (void)hv_stores(self, "tasks", newRV_noinc((SV *)newHV()));
260 (void)hv_stores(self, "opts", newRV_noinc((SV *)opts));
261  
262 rv = newRV_noinc((SV *)self);
263 sv_bless(rv, gv_stashsv(SvROK(class) ? SvRV(class) : class, GV_ADD));
264 RETVAL = rv;
265 }
266 #line 267 "Queue.c"
267 212 RETVAL = sv_2mortal(RETVAL);
268 212 ST(0) = RETVAL;
269 }
270 212 XSRETURN(1);
271 }
272  
273  
274 XS_EUPXS(XS_Punk__Queue_backend); /* prototype to pass -Wmissing-prototypes */
275 33 XS_EUPXS(XS_Punk__Queue_backend)
276 {
277 33 dVAR; dXSARGS;
278 33 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 33 33
279 0 croak_xs_usage(cv, "self");
280 {
281 33 SV * self = ST(0)
282 ;
283 SV * RETVAL;
284 #line 54 "./xs/queue.xs"
285 RETVAL = newSVsv(pq_backend_of(aTHX_ self));
286 #line 287 "Queue.c"
287 33 RETVAL = sv_2mortal(RETVAL);
288 33 ST(0) = RETVAL;
289 }
290 33 XSRETURN(1);
291 }
292  
293  
294 XS_EUPXS(XS_Punk__Queue_dbh); /* prototype to pass -Wmissing-prototypes */
295 66 XS_EUPXS(XS_Punk__Queue_dbh)
296 {
297 66 dVAR; dXSARGS;
298 66 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 66 66
299 0 croak_xs_usage(cv, "self");
300 {
301 66 SV * self = ST(0)
302 ;
303 SV * RETVAL;
304 #line 62 "./xs/queue.xs"
305 RETVAL = newSVsv(pq_dbh(aTHX_ pq_backend_of(aTHX_ self)));
306 #line 307 "Queue.c"
307 66 RETVAL = sv_2mortal(RETVAL);
308 66 ST(0) = RETVAL;
309 }
310 66 XSRETURN(1);
311 }
312  
313  
314 XS_EUPXS(XS_Punk__Queue_migrate); /* prototype to pass -Wmissing-prototypes */
315 153 XS_EUPXS(XS_Punk__Queue_migrate)
316 {
317 153 dVAR; dXSARGS;
318 153 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 153 0 153
if (items < 1 || items > 2) 0 153 153
319 0 croak_xs_usage(cv, "self, to = 0");
320 {
321 153 SV * self = ST(0)
322 ;
323 IV to;
324 IV RETVAL;
325 153 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 153 0 153
326  
327 153 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 152 1 153
328 152 to = 0;
329 else {
330 1 to = (IV)SvIV(ST(1))
331 ;
332 }
333 #line 71 "./xs/queue.xs"
334 RETVAL = pq_migrate(aTHX_ pq_backend_of(aTHX_ self), to);
335 #line 336 "Queue.c"
336 153 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 112 41 153
337 153 ST(0) = TARG;
338 }
339 153 XSRETURN(1);
340 }
341  
342  
343 XS_EUPXS(XS_Punk__Queue_schema_version); /* prototype to pass -Wmissing-prototypes */
344 13 XS_EUPXS(XS_Punk__Queue_schema_version)
345 {
346 13 dVAR; dXSARGS;
347 13 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 13 13
348 0 croak_xs_usage(cv, "self");
349 {
350 13 SV * self = ST(0)
351 ;
352 IV RETVAL;
353 13 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 13 0 13
354 #line 79 "./xs/queue.xs"
355 RETVAL = pq_schema_version(aTHX_ pq_backend_of(aTHX_ self));
356 #line 357 "Queue.c"
357 13 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 13 13
358 13 ST(0) = TARG;
359 }
360 13 XSRETURN(1);
361 }
362  
363  
364 XS_EUPXS(XS_Punk__Queue_task); /* prototype to pass -Wmissing-prototypes */
365 171 XS_EUPXS(XS_Punk__Queue_task)
366 {
367 171 dVAR; dXSARGS;
368 171 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 171 0 171
if (items < 2 || items > 3) 0 171 171
369 0 croak_xs_usage(cv, "self, name, body = NULL");
370 {
371 171 SV * self = ST(0)
372 ;
373 171 SV * name = ST(1)
374 ;
375 SV * body;
376 #line 90 "./xs/queue.xs"
377 HV *tasks;
378 #line 379 "Queue.c"
379 SV * RETVAL;
380  
381 171 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 8 163 171
382 8 body = NULL;
383 else {
384 163 body = ST(2)
385 ;
386 }
387 #line 92 "./xs/queue.xs"
388 {
389 pq_name_check(aTHX_ name, "task");
390 tasks = pq_tasks(aTHX_ self);
391 if (body) {
392 if (!(SvROK(body) && SvTYPE(SvRV(body)) == SVt_PVCV))
393 croak("Punk::Queue: task '%s' needs a code reference",
394 SvPV_nolen(name));
395 (void)hv_store_ent(tasks, name, newSVsv(body), 0);
396 RETVAL = newSVsv(self); /* chainable */
397 }
398 else {
399 SV *found = pq_task_body(aTHX_ self, name);
400 RETVAL = found ? newSVsv(found) : &PL_sv_undef;
401 if (!found) XSRETURN_UNDEF;
402 }
403 }
404 #line 405 "Queue.c"
405 171 RETVAL = sv_2mortal(RETVAL);
406 171 ST(0) = RETVAL;
407 }
408 171 XSRETURN(1);
409 }
410  
411  
412 XS_EUPXS(XS_Punk__Queue_tasks); /* prototype to pass -Wmissing-prototypes */
413 0 XS_EUPXS(XS_Punk__Queue_tasks)
414 {
415 0 dVAR; dXSARGS;
416 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
417 0 croak_xs_usage(cv, "self");
418 PERL_UNUSED_VAR(ax); /* -Wall */
419 0 SP -= items;
420 {
421 0 SV * self = ST(0)
422 ;
423 #line 115 "./xs/queue.xs"
424 {
425 HV *t = pq_tasks(aTHX_ self);
426 HE *he;
427 hv_iterinit(t);
428 while ((he = hv_iternext(t)))
429 XPUSHs(sv_2mortal(newSVsv(HeSVKEY_force(he))));
430 }
431 #line 432 "Queue.c"
432 0 PUTBACK;
433 0 return;
434 }
435 }
436  
437  
438 XS_EUPXS(XS_Punk__Queue_queue_defaults); /* prototype to pass -Wmissing-prototypes */
439 4 XS_EUPXS(XS_Punk__Queue_queue_defaults)
440 {
441 4 dVAR; dXSARGS;
442 4 dXSI32;
443 4 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 4 0 4
if (items < 2 || items > 3) 0 4 4
444 0 croak_xs_usage(cv, "self, name, defaults = NULL");
445 {
446 4 SV * self = ST(0)
447 ;
448 4 SV * name = ST(1)
449 ;
450 SV * defaults;
451 #line 135 "./xs/queue.xs"
452 HV *slot;
453 HE *he;
454 #line 455 "Queue.c"
455 SV * RETVAL;
456  
457 4 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 1 3 4
458 1 defaults = NULL;
459 else {
460 3 defaults = ST(2)
461 ;
462 }
463 #line 138 "./xs/queue.xs"
464 {
465 pq_name_check(aTHX_ name, ix == 1 ? "task" : "queue");
466 slot = pq_defaults_slot(aTHX_ self,
467 ix == 1 ? "task_defaults" : "queue_defaults");
468 if (defaults) {
469 if (!(SvROK(defaults) && SvTYPE(SvRV(defaults)) == SVt_PVHV))
470 croak("Punk::Queue: defaults must be a hash reference");
471 (void)hv_store_ent(slot, name, newSVsv(defaults), 0);
472 RETVAL = newSVsv(self); /* chainable */
473 }
474 else {
475 he = hv_fetch_ent(slot, name, 0, 0);
476 if (!he) XSRETURN_UNDEF;
477 RETVAL = newSVsv(HeVAL(he));
478 }
479 }
480 #line 481 "Queue.c"
481 4 RETVAL = sv_2mortal(RETVAL);
482 4 ST(0) = RETVAL;
483 }
484 4 XSRETURN(1);
485 }
486  
487  
488 XS_EUPXS(XS_Punk__Queue_enqueue); /* prototype to pass -Wmissing-prototypes */
489 992 XS_EUPXS(XS_Punk__Queue_enqueue)
490 {
491 992 dVAR; dXSARGS;
492 992 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 992 992
493 0 croak_xs_usage(cv, "self, task, args = NULL, ...");
494 {
495 992 SV * self = ST(0)
496 ;
497 992 SV * task = ST(1)
498 ;
499 SV * args;
500 #line 163 "./xs/queue.xs"
501 HV *opts;
502 int i;
503 #line 504 "Queue.c"
504 IV RETVAL;
505 992 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 992 0 992
506  
507 992 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 287 705 992
508 287 args = NULL;
509 else {
510 705 args = ST(2)
511 ;
512 }
513 #line 166 "./xs/queue.xs"
514 {
515 /* items is 2 when args was defaulted away, so guard the subtraction
516 * before taking the modulus - C's % keeps the sign of a negative
517 * left operand, and (2 - 3) % 2 is -1, not 1. */
518 if (items > 3 && (items - 3) % 2)
519 croak("Punk::Queue->enqueue: odd number of options");
520 if (args && SvOK(args)
521 && !(SvROK(args) && SvTYPE(SvRV(args)) == SVt_PVAV))
522 croak("Punk::Queue->enqueue: args must be an array reference");
523  
524 opts = (HV *)sv_2mortal((SV *)newHV());
525 for (i = 3; i < items; i += 2)
526 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
527  
528 pq_merge_defaults(aTHX_ self, task, opts);
529 pq_ensure_migrated(aTHX_ self);
530 RETVAL = pq_enqueue(aTHX_ pq_backend_of(aTHX_ self), task, args, opts);
531 }
532 #line 533 "Queue.c"
533 971 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 810 161 971
534 971 ST(0) = TARG;
535 }
536 971 XSRETURN(1);
537 }
538  
539  
540 XS_EUPXS(XS_Punk__Queue_dequeue); /* prototype to pass -Wmissing-prototypes */
541 200 XS_EUPXS(XS_Punk__Queue_dequeue)
542 {
543 200 dVAR; dXSARGS;
544 200 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 200 200
545 0 croak_xs_usage(cv, "self, ...");
546 {
547 200 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 200 200
548 ;
549 #line 192 "./xs/queue.xs"
550 HV *opts;
551 SV *backend, *row;
552 AV *queues, *tasks;
553 IV worker_id = 0;
554 int i;
555 #line 556 "Queue.c"
556 SV * RETVAL;
557 #line 198 "./xs/queue.xs"
558 {
559 if ((items - 1) % 2)
560 croak("Punk::Queue->dequeue: odd number of options");
561 opts = (HV *)sv_2mortal((SV *)newHV());
562 for (i = 1; i < items; i += 2)
563 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
564  
565 {
566 SV *w = pq_get(aTHX_ opts, "worker");
567 if (w && SvOK(w)) worker_id = SvIV(w);
568 }
569  
570 queues = pq_sql_list(aTHX_ pq_get(aTHX_ opts, "queues"));
571 if (av_len(queues) < 0) av_push(queues, newSVpvs("default"));
572 tasks = pq_sql_list(aTHX_ pq_get(aTHX_ opts, "tasks"));
573  
574 pq_ensure_migrated(aTHX_ self);
575 backend = pq_backend_of(aTHX_ self);
576 row = pq_dequeue(aTHX_ backend, worker_id, queues, tasks);
577 if (!row) XSRETURN_UNDEF;
578  
579 RETVAL = pq_job_new(aTHX_ self, (HV *)SvRV(row));
580 SvREFCNT_dec(row);
581 }
582 #line 583 "Queue.c"
583 179 RETVAL = sv_2mortal(RETVAL);
584 179 ST(0) = RETVAL;
585 }
586 179 XSRETURN(1);
587 }
588  
589  
590 XS_EUPXS(XS_Punk__Queue_job_info); /* prototype to pass -Wmissing-prototypes */
591 228 XS_EUPXS(XS_Punk__Queue_job_info)
592 {
593 228 dVAR; dXSARGS;
594 228 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 228 228
595 0 croak_xs_usage(cv, "self, id");
596 {
597 228 SV * self = ST(0)
598 ;
599 228 IV id = (IV)SvIV(ST(1))
600 ;
601 #line 230 "./xs/queue.xs"
602 SV *info;
603 #line 604 "Queue.c"
604 SV * RETVAL;
605 #line 232 "./xs/queue.xs"
606 pq_ensure_migrated(aTHX_ self);
607 info = pq_job_info(aTHX_ pq_backend_of(aTHX_ self), id);
608 if (!info) XSRETURN_UNDEF;
609 RETVAL = info;
610 #line 611 "Queue.c"
611 217 RETVAL = sv_2mortal(RETVAL);
612 217 ST(0) = RETVAL;
613 }
614 217 XSRETURN(1);
615 }
616  
617  
618 XS_EUPXS(XS_Punk__Queue_job_log); /* prototype to pass -Wmissing-prototypes */
619 9 XS_EUPXS(XS_Punk__Queue_job_log)
620 {
621 9 dVAR; dXSARGS;
622 9 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 9 9
623 0 croak_xs_usage(cv, "self, id");
624 {
625 9 SV * self = ST(0)
626 ;
627 9 IV id = (IV)SvIV(ST(1))
628 ;
629 SV * RETVAL;
630 #line 244 "./xs/queue.xs"
631 pq_ensure_migrated(aTHX_ self);
632 RETVAL = newRV_noinc((SV *)pq_job_log_rows(aTHX_
633 pq_backend_of(aTHX_ self), id));
634 #line 635 "Queue.c"
635 9 RETVAL = sv_2mortal(RETVAL);
636 9 ST(0) = RETVAL;
637 }
638 9 XSRETURN(1);
639 }
640  
641  
642 XS_EUPXS(XS_Punk__Queue_finish_job); /* prototype to pass -Wmissing-prototypes */
643 12 XS_EUPXS(XS_Punk__Queue_finish_job)
644 {
645 12 dVAR; dXSARGS;
646 12 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 12 0 12
if (items < 3 || items > 4) 0 12 12
647 0 croak_xs_usage(cv, "self, id, retries, result = NULL");
648 {
649 12 SV * self = ST(0)
650 ;
651 12 IV id = (IV)SvIV(ST(1))
652 ;
653 12 IV retries = (IV)SvIV(ST(2))
654 ;
655 SV * result;
656 IV RETVAL;
657 12 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 12 0 12
658  
659 12 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 3 9 12
660 3 result = NULL;
661 else {
662 9 result = ST(3)
663 ;
664 }
665 #line 257 "./xs/queue.xs"
666 RETVAL = pq_finish_job(aTHX_ pq_backend_of(aTHX_ self), id, retries,
667 result);
668 #line 669 "Queue.c"
669 12 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 12 12
670 12 ST(0) = TARG;
671 }
672 12 XSRETURN(1);
673 }
674  
675  
676 XS_EUPXS(XS_Punk__Queue_fail_job); /* prototype to pass -Wmissing-prototypes */
677 3 XS_EUPXS(XS_Punk__Queue_fail_job)
678 {
679 3 dVAR; dXSARGS;
680 3 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 3 0 3
if (items < 3 || items > 4) 0 3 3
681 0 croak_xs_usage(cv, "self, id, retries, err = NULL");
682 {
683 3 SV * self = ST(0)
684 ;
685 3 IV id = (IV)SvIV(ST(1))
686 ;
687 3 IV retries = (IV)SvIV(ST(2))
688 ;
689 SV * err;
690 IV RETVAL;
691 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 1 3
692  
693 3 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 3 3
694 0 err = NULL;
695 else {
696 3 err = ST(3)
697 ;
698 }
699 #line 269 "./xs/queue.xs"
700 RETVAL = pq_fail_job(aTHX_ pq_backend_of(aTHX_ self), id, retries, err);
701 #line 702 "Queue.c"
702 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 3 3
703 3 ST(0) = TARG;
704 }
705 3 XSRETURN(1);
706 }
707  
708  
709 XS_EUPXS(XS_Punk__Queue_perform); /* prototype to pass -Wmissing-prototypes */
710 66 XS_EUPXS(XS_Punk__Queue_perform)
711 {
712 66 dVAR; dXSARGS;
713 66 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 66 66
714 0 croak_xs_usage(cv, "self, job");
715 {
716 66 SV * self = ST(0)
717 ;
718 66 SV * job = ST(1)
719 ;
720 IV RETVAL;
721 66 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 45 21 66
722 #line 280 "./xs/queue.xs"
723 RETVAL = pq_perform(aTHX_ self, job);
724 #line 725 "Queue.c"
725 59 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 9 50 59
726 59 ST(0) = TARG;
727 }
728 59 XSRETURN(1);
729 }
730  
731  
732 XS_EUPXS(XS_Punk__Queue_dequeue_ref); /* prototype to pass -Wmissing-prototypes */
733 37 XS_EUPXS(XS_Punk__Queue_dequeue_ref)
734 {
735 37 dVAR; dXSARGS;
736 37 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 37 37
737 0 croak_xs_usage(cv, "self, worker_id, queues, tasks");
738 {
739 37 SV * self = ST(0)
740 ;
741 37 IV worker_id = (IV)SvIV(ST(1))
742 ;
743 37 SV * queues = ST(2)
744 ;
745 37 SV * tasks = ST(3)
746 ;
747 #line 295 "./xs/queue.xs"
748 AV *q, *t;
749 SV *row;
750 #line 751 "Queue.c"
751 SV * RETVAL;
752 #line 298 "./xs/queue.xs"
753 {
754 q = pq_sql_list(aTHX_ queues);
755 if (av_len(q) < 0) av_push(q, newSVpvs("default"));
756 t = pq_sql_list(aTHX_ tasks);
757 pq_ensure_migrated(aTHX_ self);
758 row = pq_dequeue(aTHX_ pq_backend_of(aTHX_ self), worker_id, q, t);
759 if (!row) XSRETURN_UNDEF;
760 RETVAL = pq_job_new(aTHX_ self, (HV *)SvRV(row));
761 SvREFCNT_dec(row);
762 }
763 #line 764 "Queue.c"
764 21 RETVAL = sv_2mortal(RETVAL);
765 21 ST(0) = RETVAL;
766 }
767 21 XSRETURN(1);
768 }
769  
770  
771 XS_EUPXS(XS_Punk__Queue_retry_job); /* prototype to pass -Wmissing-prototypes */
772 12 XS_EUPXS(XS_Punk__Queue_retry_job)
773 {
774 12 dVAR; dXSARGS;
775 12 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 12 0 12
if (items < 3 || items > 4) 0 12 12
776 0 croak_xs_usage(cv, "self, id, retries, opts = NULL");
777 {
778 12 SV * self = ST(0)
779 ;
780 12 IV id = (IV)SvIV(ST(1))
781 ;
782 12 IV retries = (IV)SvIV(ST(2))
783 ;
784 SV * opts;
785 #line 321 "./xs/queue.xs"
786 HV *o = NULL;
787 #line 788 "Queue.c"
788 IV RETVAL;
789 12 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 12 0 12
790  
791 12 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 7 5 12
792 7 opts = NULL;
793 else {
794 5 opts = ST(3)
795 ;
796 }
797 #line 323 "./xs/queue.xs"
798 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
799 o = (HV *)SvRV(opts);
800 pq_ensure_migrated(aTHX_ self);
801 RETVAL = pq_retry_job(aTHX_ pq_backend_of(aTHX_ self), id, retries, o);
802 #line 803 "Queue.c"
803 12 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 10 12
804 12 ST(0) = TARG;
805 }
806 12 XSRETURN(1);
807 }
808  
809  
810 XS_EUPXS(XS_Punk__Queue_remove_job); /* prototype to pass -Wmissing-prototypes */
811 13 XS_EUPXS(XS_Punk__Queue_remove_job)
812 {
813 13 dVAR; dXSARGS;
814 13 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 13 13
815 0 croak_xs_usage(cv, "self, id");
816 {
817 13 SV * self = ST(0)
818 ;
819 13 IV id = (IV)SvIV(ST(1))
820 ;
821 IV RETVAL;
822 13 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 13 0 13
823 #line 335 "./xs/queue.xs"
824 pq_ensure_migrated(aTHX_ self);
825 RETVAL = pq_remove_job(aTHX_ pq_backend_of(aTHX_ self), id);
826 #line 827 "Queue.c"
827 13 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 12 13
828 13 ST(0) = TARG;
829 }
830 13 XSRETURN(1);
831 }
832  
833  
834 XS_EUPXS(XS_Punk__Queue_list_jobs); /* prototype to pass -Wmissing-prototypes */
835 55 XS_EUPXS(XS_Punk__Queue_list_jobs)
836 {
837 55 dVAR; dXSARGS;
838 55 ▶ if (items < 1 || items > 6)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 6) 55 0 55
if (items < 1 || items > 6) 0 55 55
839 0 croak_xs_usage(cv, "self, offset = 0, limit = 0, filter = NULL, sort_col = NULL, sort_dir = NULL");
840 {
841 55 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 2 53 55
842 ;
843 IV offset;
844 IV limit;
845 SV * filter;
846 SV * sort_col;
847 SV * sort_dir;
848 #line 349 "./xs/queue.xs"
849 HV *f = NULL;
850 #line 851 "Queue.c"
851 SV * RETVAL;
852  
853 55 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 2 53 55
854 2 offset = 0;
855 else {
856 53 offset = (IV)SvIV(ST(1))
857 ;
858 }
859  
860 55 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 2 53 55
861 2 limit = 0;
862 else {
863 53 limit = (IV)SvIV(ST(2))
864 ;
865 }
866  
867 55 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 3 52 55
868 3 filter = NULL;
869 else {
870 52 filter = ST(3)
871 ;
872 }
873  
874 55 ▶ if (items < 5)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 5) 46 9 55
875 46 sort_col = NULL;
876 else {
877 9 sort_col = ST(4)
878 ;
879 }
880  
881 55 ▶ if (items < 6)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 6) 46 9 55
882 46 sort_dir = NULL;
883 else {
884 9 sort_dir = ST(5)
885 ;
886 }
887 #line 351 "./xs/queue.xs"
888 if (filter && SvROK(filter) && SvTYPE(SvRV(filter)) == SVt_PVHV)
889 f = (HV *)SvRV(filter);
890 pq_ensure_migrated(aTHX_ self);
891 RETVAL = pq_list_jobs(aTHX_ pq_backend_of(aTHX_ self), offset, limit, f, sort_col, sort_dir);
892 #line 893 "Queue.c"
893 54 RETVAL = sv_2mortal(RETVAL);
894 54 ST(0) = RETVAL;
895 }
896 54 XSRETURN(1);
897 }
898  
899  
900 XS_EUPXS(XS_Punk__Queue_list_workers); /* prototype to pass -Wmissing-prototypes */
901 124 XS_EUPXS(XS_Punk__Queue_list_workers)
902 {
903 124 dVAR; dXSARGS;
904 124 ▶ if (items < 1 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 4) 124 0 124
if (items < 1 || items > 4) 0 124 124
905 0 croak_xs_usage(cv, "self, offset = 0, limit = 0, filter = NULL");
906 {
907 124 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 116 8 124
908 ;
909 IV offset;
910 IV limit;
911 SV * filter;
912 #line 365 "./xs/queue.xs"
913 HV *f = NULL;
914 #line 915 "Queue.c"
915 SV * RETVAL;
916  
917 124 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 116 8 124
918 116 offset = 0;
919 else {
920 8 offset = (IV)SvIV(ST(1))
921 ;
922 }
923  
924 124 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 116 8 124
925 116 limit = 0;
926 else {
927 8 limit = (IV)SvIV(ST(2))
928 ;
929 }
930  
931 124 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 116 8 124
932 116 filter = NULL;
933 else {
934 8 filter = ST(3)
935 ;
936 }
937 #line 367 "./xs/queue.xs"
938 if (filter && SvROK(filter) && SvTYPE(SvRV(filter)) == SVt_PVHV)
939 f = (HV *)SvRV(filter);
940 pq_ensure_migrated(aTHX_ self);
941 RETVAL = pq_list_workers(aTHX_ pq_backend_of(aTHX_ self), offset,
942 limit, f);
943 #line 944 "Queue.c"
944 124 RETVAL = sv_2mortal(RETVAL);
945 124 ST(0) = RETVAL;
946 }
947 124 XSRETURN(1);
948 }
949  
950  
951 XS_EUPXS(XS_Punk__Queue_stats); /* prototype to pass -Wmissing-prototypes */
952 97 XS_EUPXS(XS_Punk__Queue_stats)
953 {
954 97 dVAR; dXSARGS;
955 97 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 97 97
956 0 croak_xs_usage(cv, "self");
957 {
958 97 SV * self = ST(0)
959 ;
960 SV * RETVAL;
961 #line 379 "./xs/queue.xs"
962 pq_ensure_migrated(aTHX_ self);
963 RETVAL = pq_stats(aTHX_ pq_backend_of(aTHX_ self));
964 #line 965 "Queue.c"
965 97 RETVAL = sv_2mortal(RETVAL);
966 97 ST(0) = RETVAL;
967 }
968 97 XSRETURN(1);
969 }
970  
971  
972 XS_EUPXS(XS_Punk__Queue_reset); /* prototype to pass -Wmissing-prototypes */
973 2 XS_EUPXS(XS_Punk__Queue_reset)
974 {
975 2 dVAR; dXSARGS;
976 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
977 0 croak_xs_usage(cv, "self");
978 {
979 2 SV * self = ST(0)
980 ;
981 #line 388 "./xs/queue.xs"
982 pq_ensure_migrated(aTHX_ self);
983 pq_reset(aTHX_ pq_backend_of(aTHX_ self));
984 #line 985 "Queue.c"
985 }
986 2 XSRETURN_EMPTY;
987 }
988  
989  
990 XS_EUPXS(XS_Punk__Queue_repair); /* prototype to pass -Wmissing-prototypes */
991 5 XS_EUPXS(XS_Punk__Queue_repair)
992 {
993 5 dVAR; dXSARGS;
994 5 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 5 5
995 0 croak_xs_usage(cv, "self, ...");
996 {
997 5 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 5 5
998 ;
999 #line 395 "./xs/queue.xs"
1000 HV *opts;
1001 SV *v;
1002 int i, deep = 0;
1003 #line 1004 "Queue.c"
1004 SV * RETVAL;
1005 #line 399 "./xs/queue.xs"
1006 {
1007 if ((items - 1) % 2)
1008 croak("Punk::Queue->repair: odd number of options");
1009 opts = (HV *)sv_2mortal((SV *)newHV());
1010 for (i = 1; i < items; i += 2)
1011 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
1012 if ((v = pq_get(aTHX_ opts, "deep")) && SvTRUE(v)) deep = 1;
1013 pq_ensure_migrated(aTHX_ self);
1014 RETVAL = pq_repair(aTHX_ pq_backend_of(aTHX_ self), deep);
1015 }
1016 #line 1017 "Queue.c"
1017 5 RETVAL = sv_2mortal(RETVAL);
1018 5 ST(0) = RETVAL;
1019 }
1020 5 XSRETURN(1);
1021 }
1022  
1023  
1024 XS_EUPXS(XS_Punk__Queue_history); /* prototype to pass -Wmissing-prototypes */
1025 2 XS_EUPXS(XS_Punk__Queue_history)
1026 {
1027 2 dVAR; dXSARGS;
1028 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
1029 0 croak_xs_usage(cv, "self");
1030 {
1031 2 SV * self = ST(0)
1032 ;
1033 SV * RETVAL;
1034 #line 416 "./xs/queue.xs"
1035 pq_ensure_migrated(aTHX_ self);
1036 RETVAL = pq_history(aTHX_ pq_backend_of(aTHX_ self));
1037 #line 1038 "Queue.c"
1038 2 RETVAL = sv_2mortal(RETVAL);
1039 2 ST(0) = RETVAL;
1040 }
1041 2 XSRETURN(1);
1042 }
1043  
1044  
1045 XS_EUPXS(XS_Punk__Queue_list_locks); /* prototype to pass -Wmissing-prototypes */
1046 10 XS_EUPXS(XS_Punk__Queue_list_locks)
1047 {
1048 10 dVAR; dXSARGS;
1049 10 ▶ if (items < 1 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 4) 10 0 10
if (items < 1 || items > 4) 0 10 10
1050 0 croak_xs_usage(cv, "self, offset = 0, limit = 0, filter = NULL");
1051 {
1052 10 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 10 10
1053 ;
1054 IV offset;
1055 IV limit;
1056 SV * filter;
1057 #line 428 "./xs/queue.xs"
1058 HV *f = NULL;
1059 #line 1060 "Queue.c"
1060 SV * RETVAL;
1061  
1062 10 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 10 10
1063 0 offset = 0;
1064 else {
1065 10 offset = (IV)SvIV(ST(1))
1066 ;
1067 }
1068  
1069 10 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 10 10
1070 0 limit = 0;
1071 else {
1072 10 limit = (IV)SvIV(ST(2))
1073 ;
1074 }
1075  
1076 10 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 10 10
1077 0 filter = NULL;
1078 else {
1079 10 filter = ST(3)
1080 ;
1081 }
1082 #line 430 "./xs/queue.xs"
1083 if (filter && SvROK(filter) && SvTYPE(SvRV(filter)) == SVt_PVHV)
1084 f = (HV *)SvRV(filter);
1085 pq_ensure_migrated(aTHX_ self);
1086 RETVAL = pq_list_locks(aTHX_ pq_backend_of(aTHX_ self), offset,
1087 limit, f);
1088 #line 1089 "Queue.c"
1089 10 RETVAL = sv_2mortal(RETVAL);
1090 10 ST(0) = RETVAL;
1091 }
1092 10 XSRETURN(1);
1093 }
1094  
1095  
1096 XS_EUPXS(XS_Punk__Queue_lock); /* prototype to pass -Wmissing-prototypes */
1097 13 XS_EUPXS(XS_Punk__Queue_lock)
1098 {
1099 13 dVAR; dXSARGS;
1100 13 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 13 13
1101 0 croak_xs_usage(cv, "self, name, duration, ...");
1102 {
1103 13 SV * self = ST(0)
1104 ;
1105 13 SV * name = ST(1)
1106 ;
1107 13 NV duration = (NV)SvNV(ST(2))
1108 ;
1109 #line 444 "./xs/queue.xs"
1110 HV *opts;
1111 SV *v;
1112 int i;
1113 IV limit = 1, owner = 0;
1114 #line 1115 "Queue.c"
1115 IV RETVAL;
1116 13 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 13 0 13
dXSTARG; 0 13 13
1117 #line 449 "./xs/queue.xs"
1118 {
1119 if ((items - 3) % 2 && items > 3)
1120 croak("Punk::Queue->lock: odd number of options");
1121 opts = (HV *)sv_2mortal((SV *)newHV());
1122 for (i = 3; i < items; i += 2)
1123 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
1124 if ((v = pq_get(aTHX_ opts, "limit")) && SvOK(v)) limit = SvIV(v);
1125 if ((v = pq_get(aTHX_ opts, "owner")) && SvOK(v)) owner = SvIV(v);
1126 pq_ensure_migrated(aTHX_ self);
1127 RETVAL = pq_lock(aTHX_ pq_backend_of(aTHX_ self), name, duration,
1128 limit, owner);
1129 }
1130 #line 1131 "Queue.c"
1131 13 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 11 13
1132 13 ST(0) = TARG;
1133 }
1134 13 XSRETURN(1);
1135 }
1136  
1137  
1138 XS_EUPXS(XS_Punk__Queue_unlock); /* prototype to pass -Wmissing-prototypes */
1139 3 XS_EUPXS(XS_Punk__Queue_unlock)
1140 {
1141 3 dVAR; dXSARGS;
1142 3 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 3 0 3
if (items < 2 || items > 3) 0 3 3
1143 0 croak_xs_usage(cv, "self, name, owner = NULL");
1144 {
1145 3 SV * self = ST(0)
1146 ;
1147 3 SV * name = ST(1)
1148 ;
1149 SV * owner;
1150 IV RETVAL;
1151 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1152  
1153 3 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 1 2 3
1154 1 owner = NULL;
1155 else {
1156 2 owner = ST(2)
1157 ;
1158 }
1159 #line 470 "./xs/queue.xs"
1160 pq_ensure_migrated(aTHX_ self);
1161 RETVAL = pq_unlock(aTHX_ pq_backend_of(aTHX_ self), name,
1162 (owner && SvOK(owner)) ? SvIV(owner) : 0,
1163 (owner && SvOK(owner)) ? 1 : 0);
1164 #line 1165 "Queue.c"
1165 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 3 3
1166 3 ST(0) = TARG;
1167 }
1168 3 XSRETURN(1);
1169 }
1170  
1171  
1172 XS_EUPXS(XS_Punk__Queue_renew_lock); /* prototype to pass -Wmissing-prototypes */
1173 3 XS_EUPXS(XS_Punk__Queue_renew_lock)
1174 {
1175 3 dVAR; dXSARGS;
1176 3 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 3 3
1177 0 croak_xs_usage(cv, "self, name, owner, duration");
1178 {
1179 3 SV * self = ST(0)
1180 ;
1181 3 SV * name = ST(1)
1182 ;
1183 3 IV owner = (IV)SvIV(ST(2))
1184 ;
1185 3 NV duration = (NV)SvNV(ST(3))
1186 ;
1187 IV RETVAL;
1188 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1189 #line 484 "./xs/queue.xs"
1190 pq_ensure_migrated(aTHX_ self);
1191 RETVAL = pq_renew_lock(aTHX_ pq_backend_of(aTHX_ self), name,
1192 owner, duration);
1193 #line 1194 "Queue.c"
1194 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 3 3
1195 3 ST(0) = TARG;
1196 }
1197 3 XSRETURN(1);
1198 }
1199  
1200  
1201 XS_EUPXS(XS_Punk__Queue_broadcast); /* prototype to pass -Wmissing-prototypes */
1202 6 XS_EUPXS(XS_Punk__Queue_broadcast)
1203 {
1204 6 dVAR; dXSARGS;
1205 6 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 6 0 6
if (items < 2 || items > 4) 0 6 6
1206 0 croak_xs_usage(cv, "self, cmd, args = NULL, ids = NULL");
1207 {
1208 6 SV * self = ST(0)
1209 ;
1210 6 ▶ SV * cmd = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * cmd = ST(1) 6 0 6
1211 ;
1212 SV * args;
1213 SV * ids;
1214 #line 497 "./xs/queue.xs"
1215 AV *a = NULL, *w = NULL;
1216 #line 1217 "Queue.c"
1217 IV RETVAL;
1218 6 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 6 0 6
1219  
1220 6 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 1 5 6
1221 1 args = NULL;
1222 else {
1223 5 args = ST(2)
1224 ;
1225 }
1226  
1227 6 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 1 5 6
1228 1 ids = NULL;
1229 else {
1230 5 ids = ST(3)
1231 ;
1232 }
1233 #line 499 "./xs/queue.xs"
1234 if (args && SvROK(args) && SvTYPE(SvRV(args)) == SVt_PVAV)
1235 a = (AV *)SvRV(args);
1236 if (ids && SvROK(ids) && SvTYPE(SvRV(ids)) == SVt_PVAV)
1237 w = (AV *)SvRV(ids);
1238 pq_ensure_migrated(aTHX_ self);
1239 RETVAL = pq_broadcast(aTHX_ pq_backend_of(aTHX_ self), cmd, a, w);
1240 #line 1241 "Queue.c"
1241 6 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 6 6
1242 6 ST(0) = TARG;
1243 }
1244 6 XSRETURN(1);
1245 }
1246  
1247  
1248 XS_EUPXS(XS_Punk__Queue_worker); /* prototype to pass -Wmissing-prototypes */
1249 14 XS_EUPXS(XS_Punk__Queue_worker)
1250 {
1251 14 dVAR; dXSARGS;
1252 14 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 14 14
1253 0 croak_xs_usage(cv, "self, ...");
1254 {
1255 14 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 14 14
1256 ;
1257 #line 514 "./xs/queue.xs"
1258 HV *opts, *w;
1259 SV *rv;
1260 int i;
1261 #line 1262 "Queue.c"
1262 SV * RETVAL;
1263 #line 518 "./xs/queue.xs"
1264 {
1265 if ((items - 1) % 2)
1266 croak("Punk::Queue->worker: odd number of options");
1267 opts = newHV();
1268 for (i = 1; i < items; i += 2)
1269 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
1270  
1271 w = newHV();
1272 (void)hv_stores(w, "queue", newSVsv(self));
1273 (void)hv_stores(w, "opts", newRV_noinc((SV *)opts));
1274 rv = newRV_noinc((SV *)w);
1275 sv_bless(rv, gv_stashpvs("Punk::Queue::Worker", GV_ADD));
1276 RETVAL = rv;
1277 }
1278 #line 1279 "Queue.c"
1279 14 RETVAL = sv_2mortal(RETVAL);
1280 14 ST(0) = RETVAL;
1281 }
1282 14 XSRETURN(1);
1283 }
1284  
1285  
1286 XS_EUPXS(XS_Punk__Queue__inserver_attach); /* prototype to pass -Wmissing-prototypes */
1287 3 XS_EUPXS(XS_Punk__Queue__inserver_attach)
1288 {
1289 3 dVAR; dXSARGS;
1290 3 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 3 0 3
if (items < 1 || items > 2) 0 3 3
1291 0 croak_xs_usage(cv, "queue, opts = NULL");
1292 {
1293 3 ▶ SV * queue = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * queue = ST(0) 3 0 3
1294 ;
1295 SV * opts;
1296 #line 545 "./xs/queue.xs"
1297 HV *o = NULL;
1298 #line 1299 "Queue.c"
1299 IV RETVAL;
1300 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1301  
1302 3 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 3 3
1303 0 opts = NULL;
1304 else {
1305 3 opts = ST(1)
1306 ;
1307 }
1308 #line 547 "./xs/queue.xs"
1309 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
1310 o = (HV *)SvRV(opts);
1311 RETVAL = pq_inserver_attach(aTHX_ queue, o);
1312 #line 1313 "Queue.c"
1313 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 3 3
1314 3 ST(0) = TARG;
1315 }
1316 3 XSRETURN(1);
1317 }
1318  
1319  
1320 XS_EUPXS(XS_Punk__Queue_upsert_cron); /* prototype to pass -Wmissing-prototypes */
1321 29 XS_EUPXS(XS_Punk__Queue_upsert_cron)
1322 {
1323 29 dVAR; dXSARGS;
1324 29 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 29 29
1325 0 croak_xs_usage(cv, "self, def");
1326 {
1327 29 SV * self = ST(0)
1328 ;
1329 29 ▶ SV * def = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * def = ST(1) 29 0 29
1330 ;
1331 #line 560 "./xs/queue.xs"
1332 HV *d = NULL;
1333 #line 1334 "Queue.c"
1334 IV RETVAL;
1335 29 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 29 0 29
dXSTARG; 29 0 29
1336 #line 562 "./xs/queue.xs"
1337 if (def && SvROK(def) && SvTYPE(SvRV(def)) == SVt_PVHV)
1338 d = (HV *)SvRV(def);
1339 if (!d) croak("Punk::Queue: upsert_cron needs a hash reference");
1340 pq_ensure_migrated(aTHX_ self);
1341 RETVAL = pq_upsert_cron(aTHX_ pq_backend_of(aTHX_ self), d);
1342 #line 1343 "Queue.c"
1343 26 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 6 20 26
1344 26 ST(0) = TARG;
1345 }
1346 26 XSRETURN(1);
1347 }
1348  
1349  
1350 XS_EUPXS(XS_Punk__Queue_disable_missing_crons); /* prototype to pass -Wmissing-prototypes */
1351 20 XS_EUPXS(XS_Punk__Queue_disable_missing_crons)
1352 {
1353 20 dVAR; dXSARGS;
1354 20 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 20 0 20
if (items < 1 || items > 2) 0 20 20
1355 0 croak_xs_usage(cv, "self, names = NULL");
1356 {
1357 20 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 20 0 20
1358 ;
1359 SV * names;
1360 #line 575 "./xs/queue.xs"
1361 AV *n = NULL;
1362 #line 1363 "Queue.c"
1363 IV RETVAL;
1364 20 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 20 0 20
1365  
1366 20 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 20 20
1367 0 names = NULL;
1368 else {
1369 20 names = ST(1)
1370 ;
1371 }
1372 #line 577 "./xs/queue.xs"
1373 if (names && SvROK(names) && SvTYPE(SvRV(names)) == SVt_PVAV)
1374 n = (AV *)SvRV(names);
1375 pq_ensure_migrated(aTHX_ self);
1376 RETVAL = pq_disable_missing_crons(aTHX_ pq_backend_of(aTHX_ self), n);
1377 #line 1378 "Queue.c"
1378 20 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 9 11 20
1379 20 ST(0) = TARG;
1380 }
1381 20 XSRETURN(1);
1382 }
1383  
1384  
1385 XS_EUPXS(XS_Punk__Queue_enable_cron); /* prototype to pass -Wmissing-prototypes */
1386 8 XS_EUPXS(XS_Punk__Queue_enable_cron)
1387 {
1388 8 dVAR; dXSARGS;
1389 8 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 8 0 8
if (items < 2 || items > 3) 0 8 8
1390 0 croak_xs_usage(cv, "self, name, on = 1");
1391 {
1392 8 SV * self = ST(0)
1393 ;
1394 8 SV * name = ST(1)
1395 ;
1396 IV on;
1397 IV RETVAL;
1398 8 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 8 0 8
1399  
1400 8 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 8 8
1401 0 on = 1;
1402 else {
1403 8 on = (IV)SvIV(ST(2))
1404 ;
1405 }
1406 #line 590 "./xs/queue.xs"
1407 pq_ensure_migrated(aTHX_ self);
1408 RETVAL = pq_enable_cron(aTHX_ pq_backend_of(aTHX_ self), name,
1409 on ? 1 : 0);
1410 #line 1411 "Queue.c"
1411 8 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 8 8
1412 8 ST(0) = TARG;
1413 }
1414 8 XSRETURN(1);
1415 }
1416  
1417  
1418 XS_EUPXS(XS_Punk__Queue_cron_info); /* prototype to pass -Wmissing-prototypes */
1419 33 XS_EUPXS(XS_Punk__Queue_cron_info)
1420 {
1421 33 dVAR; dXSARGS;
1422 33 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 33 33
1423 0 croak_xs_usage(cv, "self, name");
1424 {
1425 33 SV * self = ST(0)
1426 ;
1427 33 SV * name = ST(1)
1428 ;
1429 #line 601 "./xs/queue.xs"
1430 SV *info;
1431 #line 1432 "Queue.c"
1432 SV * RETVAL;
1433 #line 603 "./xs/queue.xs"
1434 pq_ensure_migrated(aTHX_ self);
1435 info = pq_cron_info(aTHX_ pq_backend_of(aTHX_ self), name);
1436 if (!info) XSRETURN_UNDEF;
1437 RETVAL = info;
1438 #line 1439 "Queue.c"
1439 30 RETVAL = sv_2mortal(RETVAL);
1440 30 ST(0) = RETVAL;
1441 }
1442 30 XSRETURN(1);
1443 }
1444  
1445  
1446 XS_EUPXS(XS_Punk__Queue_list_crons); /* prototype to pass -Wmissing-prototypes */
1447 6 XS_EUPXS(XS_Punk__Queue_list_crons)
1448 {
1449 6 dVAR; dXSARGS;
1450 6 ▶ if (items < 1 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 3) 6 0 6
if (items < 1 || items > 3) 0 6 6
1451 0 croak_xs_usage(cv, "self, offset = 0, limit = 0");
1452 {
1453 6 SV * self = ST(0)
1454 ;
1455 IV offset;
1456 IV limit;
1457 SV * RETVAL;
1458  
1459 6 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 6 0 6
1460 6 offset = 0;
1461 else {
1462 0 offset = (IV)SvIV(ST(1))
1463 ;
1464 }
1465  
1466 6 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 6 0 6
1467 6 limit = 0;
1468 else {
1469 0 limit = (IV)SvIV(ST(2))
1470 ;
1471 }
1472 #line 616 "./xs/queue.xs"
1473 pq_ensure_migrated(aTHX_ self);
1474 RETVAL = pq_list_crons(aTHX_ pq_backend_of(aTHX_ self), offset,
1475 limit);
1476 #line 1477 "Queue.c"
1477 6 RETVAL = sv_2mortal(RETVAL);
1478 6 ST(0) = RETVAL;
1479 }
1480 6 XSRETURN(1);
1481 }
1482  
1483  
1484 /* INCLUDE: Returning to 'Queue.xs' from 'xs/queue.xs' */
1485  
1486  
1487 /* INCLUDE: Including 'xs/backend.xs' from 'Queue.xs' */
1488  
1489  
1490 XS_EUPXS(XS_Punk__Queue__Backend_dbh); /* prototype to pass -Wmissing-prototypes */
1491 0 XS_EUPXS(XS_Punk__Queue__Backend_dbh)
1492 {
1493 0 dVAR; dXSARGS;
1494 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
1495 0 croak_xs_usage(cv, "self");
1496 {
1497 0 SV * self = ST(0)
1498 ;
1499 SV * RETVAL;
1500 #line 15 "./xs/backend.xs"
1501 RETVAL = newSVsv(pq_dbh(aTHX_ self));
1502 #line 1503 "Queue.c"
1503 0 RETVAL = sv_2mortal(RETVAL);
1504 0 ST(0) = RETVAL;
1505 }
1506 0 XSRETURN(1);
1507 }
1508  
1509  
1510 XS_EUPXS(XS_Punk__Queue__Backend_migrate); /* prototype to pass -Wmissing-prototypes */
1511 0 XS_EUPXS(XS_Punk__Queue__Backend_migrate)
1512 {
1513 0 dVAR; dXSARGS;
1514 0 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 0 0 0
if (items < 1 || items > 2) 0 0 0
1515 0 croak_xs_usage(cv, "self, to = 0");
1516 {
1517 0 SV * self = ST(0)
1518 ;
1519 IV to;
1520 IV RETVAL;
1521 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1522  
1523 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
1524 0 to = 0;
1525 else {
1526 0 to = (IV)SvIV(ST(1))
1527 ;
1528 }
1529 #line 24 "./xs/backend.xs"
1530 RETVAL = pq_migrate(aTHX_ self, to);
1531 #line 1532 "Queue.c"
1532 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1533 0 ST(0) = TARG;
1534 }
1535 0 XSRETURN(1);
1536 }
1537  
1538  
1539 XS_EUPXS(XS_Punk__Queue__Backend_schema_version); /* prototype to pass -Wmissing-prototypes */
1540 0 XS_EUPXS(XS_Punk__Queue__Backend_schema_version)
1541 {
1542 0 dVAR; dXSARGS;
1543 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
1544 0 croak_xs_usage(cv, "self");
1545 {
1546 0 SV * self = ST(0)
1547 ;
1548 IV RETVAL;
1549 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1550 #line 32 "./xs/backend.xs"
1551 RETVAL = pq_schema_version(aTHX_ self);
1552 #line 1553 "Queue.c"
1553 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1554 0 ST(0) = TARG;
1555 }
1556 0 XSRETURN(1);
1557 }
1558  
1559  
1560 XS_EUPXS(XS_Punk__Queue__Backend_latest_version); /* prototype to pass -Wmissing-prototypes */
1561 4 XS_EUPXS(XS_Punk__Queue__Backend_latest_version)
1562 {
1563 4 dVAR; dXSARGS;
1564 4 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 4 4
1565 0 croak_xs_usage(cv, "self");
1566 {
1567 4 SV * self = ST(0)
1568 ;
1569 IV RETVAL;
1570 4 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 4 0 4
1571 #line 43 "./xs/backend.xs"
1572 RETVAL = pq_migration_count(aTHX_ self);
1573 #line 1574 "Queue.c"
1574 4 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 4 4
1575 4 ST(0) = TARG;
1576 }
1577 4 XSRETURN(1);
1578 }
1579  
1580  
1581 XS_EUPXS(XS_Punk__Queue__Backend_now); /* prototype to pass -Wmissing-prototypes */
1582 3 XS_EUPXS(XS_Punk__Queue__Backend_now)
1583 {
1584 3 dVAR; dXSARGS;
1585 3 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 3 3
1586 0 croak_xs_usage(cv, "self");
1587 {
1588 3 SV * self = ST(0)
1589 ;
1590 NV RETVAL;
1591 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1592 #line 53 "./xs/backend.xs"
1593 RETVAL = pq_now(aTHX_ self);
1594 #line 1595 "Queue.c"
1595 3 ▶ TARGn((NV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGn((NV)RETVAL, 1); 0 3 3
1596 3 ST(0) = TARG;
1597 }
1598 3 XSRETURN(1);
1599 }
1600  
1601  
1602 XS_EUPXS(XS_Punk__Queue__Backend_clock_delta); /* prototype to pass -Wmissing-prototypes */
1603 2 XS_EUPXS(XS_Punk__Queue__Backend_clock_delta)
1604 {
1605 2 dVAR; dXSARGS;
1606 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
1607 0 croak_xs_usage(cv, "self");
1608 {
1609 2 SV * self = ST(0)
1610 ;
1611 #line 61 "./xs/backend.xs"
1612 SV *d;
1613 #line 1614 "Queue.c"
1614 NV RETVAL;
1615 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1616 #line 63 "./xs/backend.xs"
1617 (void)pq_dbh(aTHX_ self);
1618 d = pq_get(aTHX_ pq_hv(aTHX_ self, "Punk::Queue::Backend"),
1619 PQ_DELTA_KEY);
1620 RETVAL = d ? SvNV(d) : 0.0;
1621 #line 1622 "Queue.c"
1622 2 ▶ TARGn((NV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGn((NV)RETVAL, 1); 0 2 2
1623 2 ST(0) = TARG;
1624 }
1625 2 XSRETURN(1);
1626 }
1627  
1628  
1629 XS_EUPXS(XS_Punk__Queue__Backend_has_returning); /* prototype to pass -Wmissing-prototypes */
1630 0 XS_EUPXS(XS_Punk__Queue__Backend_has_returning)
1631 {
1632 0 dVAR; dXSARGS;
1633 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
1634 0 croak_xs_usage(cv, "self");
1635 {
1636 0 SV * self = ST(0)
1637 ;
1638 IV RETVAL;
1639 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1640 #line 74 "./xs/backend.xs"
1641 RETVAL = pq_has_returning(aTHX_ self);
1642 #line 1643 "Queue.c"
1643 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1644 0 ST(0) = TARG;
1645 }
1646 0 XSRETURN(1);
1647 }
1648  
1649  
1650 XS_EUPXS(XS_Punk__Queue__Backend_enqueue); /* prototype to pass -Wmissing-prototypes */
1651 10 XS_EUPXS(XS_Punk__Queue__Backend_enqueue)
1652 {
1653 10 dVAR; dXSARGS;
1654 10 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 10 0 10
if (items < 2 || items > 4) 0 10 10
1655 0 croak_xs_usage(cv, "self, task, args = NULL, opts = NULL");
1656 {
1657 10 SV * self = ST(0)
1658 ;
1659 10 ▶ SV * task = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * task = ST(1) 0 10 10
1660 ;
1661 SV * args;
1662 SV * opts;
1663 #line 85 "./xs/backend.xs"
1664 HV *o = NULL;
1665 #line 1666 "Queue.c"
1666 IV RETVAL;
1667 10 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 10 10
1668  
1669 10 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 10 10
1670 0 args = NULL;
1671 else {
1672 10 args = ST(2)
1673 ;
1674 }
1675  
1676 10 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 10 10
1677 0 opts = NULL;
1678 else {
1679 10 opts = ST(3)
1680 ;
1681 }
1682 #line 87 "./xs/backend.xs"
1683 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
1684 o = (HV *)SvRV(opts);
1685 RETVAL = pq_enqueue(aTHX_ self, task, args, o);
1686 #line 1687 "Queue.c"
1687 10 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 10 10
1688 10 ST(0) = TARG;
1689 }
1690 10 XSRETURN(1);
1691 }
1692  
1693  
1694 XS_EUPXS(XS_Punk__Queue__Backend_job_info); /* prototype to pass -Wmissing-prototypes */
1695 0 XS_EUPXS(XS_Punk__Queue__Backend_job_info)
1696 {
1697 0 dVAR; dXSARGS;
1698 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
1699 0 croak_xs_usage(cv, "self, id");
1700 {
1701 0 SV * self = ST(0)
1702 ;
1703 0 IV id = (IV)SvIV(ST(1))
1704 ;
1705 #line 98 "./xs/backend.xs"
1706 SV *info;
1707 #line 1708 "Queue.c"
1708 SV * RETVAL;
1709 #line 100 "./xs/backend.xs"
1710 info = pq_job_info(aTHX_ self, id);
1711 if (!info) XSRETURN_UNDEF;
1712 RETVAL = info;
1713 #line 1714 "Queue.c"
1714 0 RETVAL = sv_2mortal(RETVAL);
1715 0 ST(0) = RETVAL;
1716 }
1717 0 XSRETURN(1);
1718 }
1719  
1720  
1721 XS_EUPXS(XS_Punk__Queue__Backend_finish_job); /* prototype to pass -Wmissing-prototypes */
1722 0 XS_EUPXS(XS_Punk__Queue__Backend_finish_job)
1723 {
1724 0 dVAR; dXSARGS;
1725 0 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 0 0 0
if (items < 3 || items > 4) 0 0 0
1726 0 croak_xs_usage(cv, "self, id, retries, result = NULL");
1727 {
1728 0 SV * self = ST(0)
1729 ;
1730 0 IV id = (IV)SvIV(ST(1))
1731 ;
1732 0 IV retries = (IV)SvIV(ST(2))
1733 ;
1734 SV * result;
1735 IV RETVAL;
1736 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1737  
1738 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
1739 0 result = NULL;
1740 else {
1741 0 result = ST(3)
1742 ;
1743 }
1744 #line 113 "./xs/backend.xs"
1745 RETVAL = pq_finish_job(aTHX_ self, id, retries, result);
1746 #line 1747 "Queue.c"
1747 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1748 0 ST(0) = TARG;
1749 }
1750 0 XSRETURN(1);
1751 }
1752  
1753  
1754 XS_EUPXS(XS_Punk__Queue__Backend_fail_job); /* prototype to pass -Wmissing-prototypes */
1755 0 XS_EUPXS(XS_Punk__Queue__Backend_fail_job)
1756 {
1757 0 dVAR; dXSARGS;
1758 0 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 0 0 0
if (items < 3 || items > 4) 0 0 0
1759 0 croak_xs_usage(cv, "self, id, retries, err = NULL");
1760 {
1761 0 SV * self = ST(0)
1762 ;
1763 0 IV id = (IV)SvIV(ST(1))
1764 ;
1765 0 IV retries = (IV)SvIV(ST(2))
1766 ;
1767 SV * err;
1768 IV RETVAL;
1769 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1770  
1771 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
1772 0 err = NULL;
1773 else {
1774 0 err = ST(3)
1775 ;
1776 }
1777 #line 124 "./xs/backend.xs"
1778 RETVAL = pq_fail_job(aTHX_ self, id, retries, err);
1779 #line 1780 "Queue.c"
1780 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1781 0 ST(0) = TARG;
1782 }
1783 0 XSRETURN(1);
1784 }
1785  
1786  
1787 XS_EUPXS(XS_Punk__Queue__Backend_retry_job); /* prototype to pass -Wmissing-prototypes */
1788 0 XS_EUPXS(XS_Punk__Queue__Backend_retry_job)
1789 {
1790 0 dVAR; dXSARGS;
1791 0 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 0 0 0
if (items < 3 || items > 4) 0 0 0
1792 0 croak_xs_usage(cv, "self, id, retries, opts = NULL");
1793 {
1794 0 SV * self = ST(0)
1795 ;
1796 0 IV id = (IV)SvIV(ST(1))
1797 ;
1798 0 IV retries = (IV)SvIV(ST(2))
1799 ;
1800 SV * opts;
1801 #line 135 "./xs/backend.xs"
1802 HV *o = NULL;
1803 #line 1804 "Queue.c"
1804 IV RETVAL;
1805 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1806  
1807 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
1808 0 opts = NULL;
1809 else {
1810 0 opts = ST(3)
1811 ;
1812 }
1813 #line 137 "./xs/backend.xs"
1814 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
1815 o = (HV *)SvRV(opts);
1816 RETVAL = pq_retry_job(aTHX_ self, id, retries, o);
1817 #line 1818 "Queue.c"
1818 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1819 0 ST(0) = TARG;
1820 }
1821 0 XSRETURN(1);
1822 }
1823  
1824  
1825 XS_EUPXS(XS_Punk__Queue__Backend_remove_job); /* prototype to pass -Wmissing-prototypes */
1826 0 XS_EUPXS(XS_Punk__Queue__Backend_remove_job)
1827 {
1828 0 dVAR; dXSARGS;
1829 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
1830 0 croak_xs_usage(cv, "self, id");
1831 {
1832 0 SV * self = ST(0)
1833 ;
1834 0 IV id = (IV)SvIV(ST(1))
1835 ;
1836 IV RETVAL;
1837 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1838 #line 148 "./xs/backend.xs"
1839 RETVAL = pq_remove_job(aTHX_ self, id);
1840 #line 1841 "Queue.c"
1841 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1842 0 ST(0) = TARG;
1843 }
1844 0 XSRETURN(1);
1845 }
1846  
1847  
1848 XS_EUPXS(XS_Punk__Queue__Backend_register_worker); /* prototype to pass -Wmissing-prototypes */
1849 11 XS_EUPXS(XS_Punk__Queue__Backend_register_worker)
1850 {
1851 11 dVAR; dXSARGS;
1852 11 ▶ if (items < 1 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 3) 11 0 11
if (items < 1 || items > 3) 0 11 11
1853 0 croak_xs_usage(cv, "self, id = 0, opts = NULL");
1854 {
1855 11 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 11 0 11
1856 ;
1857 IV id;
1858 SV * opts;
1859 #line 158 "./xs/backend.xs"
1860 HV *o = NULL;
1861 #line 1862 "Queue.c"
1862 IV RETVAL;
1863 11 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 11 0 11
1864  
1865 11 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 11 11
1866 0 id = 0;
1867 else {
1868 11 id = (IV)SvIV(ST(1))
1869 ;
1870 }
1871  
1872 11 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 1 10 11
1873 1 opts = NULL;
1874 else {
1875 10 opts = ST(2)
1876 ;
1877 }
1878 #line 160 "./xs/backend.xs"
1879 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
1880 o = (HV *)SvRV(opts);
1881 RETVAL = pq_register_worker(aTHX_ self, id, o);
1882 #line 1883 "Queue.c"
1883 11 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 11 11
1884 11 ST(0) = TARG;
1885 }
1886 11 XSRETURN(1);
1887 }
1888  
1889  
1890 XS_EUPXS(XS_Punk__Queue__Backend_unregister_worker); /* prototype to pass -Wmissing-prototypes */
1891 35 XS_EUPXS(XS_Punk__Queue__Backend_unregister_worker)
1892 {
1893 35 dVAR; dXSARGS;
1894 35 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 35 35
1895 0 croak_xs_usage(cv, "self, id");
1896 {
1897 35 SV * self = ST(0)
1898 ;
1899 35 IV id = (IV)SvIV(ST(1))
1900 ;
1901 IV RETVAL;
1902 35 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 7 28 35
1903 #line 171 "./xs/backend.xs"
1904 RETVAL = pq_unregister_worker(aTHX_ self, id);
1905 #line 1906 "Queue.c"
1906 35 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 34 35
1907 35 ST(0) = TARG;
1908 }
1909 35 XSRETURN(1);
1910 }
1911  
1912  
1913 XS_EUPXS(XS_Punk__Queue__Backend_worker_heartbeat); /* prototype to pass -Wmissing-prototypes */
1914 29 XS_EUPXS(XS_Punk__Queue__Backend_worker_heartbeat)
1915 {
1916 29 dVAR; dXSARGS;
1917 29 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 29 0 29
if (items < 2 || items > 3) 0 29 29
1918 0 croak_xs_usage(cv, "self, id, status = NULL");
1919 {
1920 29 SV * self = ST(0)
1921 ;
1922 29 IV id = (IV)SvIV(ST(1))
1923 ;
1924 SV * status;
1925 IV RETVAL;
1926 29 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 28 29
1927  
1928 29 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 20 9 29
1929 20 status = NULL;
1930 else {
1931 9 status = ST(2)
1932 ;
1933 }
1934 #line 181 "./xs/backend.xs"
1935 RETVAL = pq_worker_heartbeat(aTHX_ self, id, status);
1936 #line 1937 "Queue.c"
1937 29 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 29 29
1938 29 ST(0) = TARG;
1939 }
1940 29 XSRETURN(1);
1941 }
1942  
1943  
1944 XS_EUPXS(XS_Punk__Queue__Backend_list_jobs); /* prototype to pass -Wmissing-prototypes */
1945 0 XS_EUPXS(XS_Punk__Queue__Backend_list_jobs)
1946 {
1947 0 dVAR; dXSARGS;
1948 0 ▶ if (items < 1 || items > 6)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 6) 0 0 0
if (items < 1 || items > 6) 0 0 0
1949 0 croak_xs_usage(cv, "self, offset = 0, limit = 0, filter = NULL, sort_col = NULL, sort_dir = NULL");
1950 {
1951 0 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 0 0
1952 ;
1953 IV offset;
1954 IV limit;
1955 SV * filter;
1956 SV * sort_col;
1957 SV * sort_dir;
1958 #line 194 "./xs/backend.xs"
1959 HV *f = NULL;
1960 #line 1961 "Queue.c"
1961 SV * RETVAL;
1962  
1963 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
1964 0 offset = 0;
1965 else {
1966 0 offset = (IV)SvIV(ST(1))
1967 ;
1968 }
1969  
1970 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
1971 0 limit = 0;
1972 else {
1973 0 limit = (IV)SvIV(ST(2))
1974 ;
1975 }
1976  
1977 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
1978 0 filter = NULL;
1979 else {
1980 0 filter = ST(3)
1981 ;
1982 }
1983  
1984 0 ▶ if (items < 5)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 5) 0 0 0
1985 0 sort_col = NULL;
1986 else {
1987 0 sort_col = ST(4)
1988 ;
1989 }
1990  
1991 0 ▶ if (items < 6)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 6) 0 0 0
1992 0 sort_dir = NULL;
1993 else {
1994 0 sort_dir = ST(5)
1995 ;
1996 }
1997 #line 196 "./xs/backend.xs"
1998 if (filter && SvROK(filter) && SvTYPE(SvRV(filter)) == SVt_PVHV)
1999 f = (HV *)SvRV(filter);
2000 RETVAL = pq_list_jobs(aTHX_ self, offset, limit, f, sort_col, sort_dir);
2001 #line 2002 "Queue.c"
2002 0 RETVAL = sv_2mortal(RETVAL);
2003 0 ST(0) = RETVAL;
2004 }
2005 0 XSRETURN(1);
2006 }
2007  
2008  
2009 XS_EUPXS(XS_Punk__Queue__Backend_list_workers); /* prototype to pass -Wmissing-prototypes */
2010 0 XS_EUPXS(XS_Punk__Queue__Backend_list_workers)
2011 {
2012 0 dVAR; dXSARGS;
2013 0 ▶ if (items < 1 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 4) 0 0 0
if (items < 1 || items > 4) 0 0 0
2014 0 croak_xs_usage(cv, "self, offset = 0, limit = 0, filter = NULL");
2015 {
2016 0 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 0 0
2017 ;
2018 IV offset;
2019 IV limit;
2020 SV * filter;
2021 #line 209 "./xs/backend.xs"
2022 HV *f = NULL;
2023 #line 2024 "Queue.c"
2024 SV * RETVAL;
2025  
2026 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2027 0 offset = 0;
2028 else {
2029 0 offset = (IV)SvIV(ST(1))
2030 ;
2031 }
2032  
2033 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2034 0 limit = 0;
2035 else {
2036 0 limit = (IV)SvIV(ST(2))
2037 ;
2038 }
2039  
2040 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
2041 0 filter = NULL;
2042 else {
2043 0 filter = ST(3)
2044 ;
2045 }
2046 #line 211 "./xs/backend.xs"
2047 if (filter && SvROK(filter) && SvTYPE(SvRV(filter)) == SVt_PVHV)
2048 f = (HV *)SvRV(filter);
2049 RETVAL = pq_list_workers(aTHX_ self, offset, limit, f);
2050 #line 2051 "Queue.c"
2051 0 RETVAL = sv_2mortal(RETVAL);
2052 0 ST(0) = RETVAL;
2053 }
2054 0 XSRETURN(1);
2055 }
2056  
2057  
2058 XS_EUPXS(XS_Punk__Queue__Backend_stats); /* prototype to pass -Wmissing-prototypes */
2059 0 XS_EUPXS(XS_Punk__Queue__Backend_stats)
2060 {
2061 0 dVAR; dXSARGS;
2062 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2063 0 croak_xs_usage(cv, "self");
2064 {
2065 0 SV * self = ST(0)
2066 ;
2067 SV * RETVAL;
2068 #line 221 "./xs/backend.xs"
2069 RETVAL = pq_stats(aTHX_ self);
2070 #line 2071 "Queue.c"
2071 0 RETVAL = sv_2mortal(RETVAL);
2072 0 ST(0) = RETVAL;
2073 }
2074 0 XSRETURN(1);
2075 }
2076  
2077  
2078 XS_EUPXS(XS_Punk__Queue__Backend_note); /* prototype to pass -Wmissing-prototypes */
2079 3 XS_EUPXS(XS_Punk__Queue__Backend_note)
2080 {
2081 3 dVAR; dXSARGS;
2082 3 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 3 3
2083 0 croak_xs_usage(cv, "self, id, merge");
2084 {
2085 3 SV * self = ST(0)
2086 ;
2087 3 IV id = (IV)SvIV(ST(1))
2088 ;
2089 3 ▶ SV * merge = ST(2)
Branch: 1 branch
BranchTrueFalseTotal
SV * merge = ST(2) 3 0 3
2090 ;
2091 #line 233 "./xs/backend.xs"
2092 HV *m = NULL;
2093 #line 2094 "Queue.c"
2094 IV RETVAL;
2095 3 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 3 0 3
dXSTARG; 3 0 3
2096 #line 235 "./xs/backend.xs"
2097 if (merge && SvROK(merge) && SvTYPE(SvRV(merge)) == SVt_PVHV)
2098 m = (HV *)SvRV(merge);
2099 if (!m)
2100 croak("Punk::Queue: note needs a hash reference to merge");
2101 RETVAL = pq_note(aTHX_ self, id, m);
2102 #line 2103 "Queue.c"
2103 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 3 3
2104 3 ST(0) = TARG;
2105 }
2106 3 XSRETURN(1);
2107 }
2108  
2109  
2110 XS_EUPXS(XS_Punk__Queue__Backend_log_job); /* prototype to pass -Wmissing-prototypes */
2111 1 XS_EUPXS(XS_Punk__Queue__Backend_log_job)
2112 {
2113 1 dVAR; dXSARGS;
2114 1 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 1 0 1
if (items < 3 || items > 4) 0 1 1
2115 0 croak_xs_usage(cv, "self, id, message, level = NULL");
2116 {
2117 1 SV * self = ST(0)
2118 ;
2119 1 IV id = (IV)SvIV(ST(1))
2120 ;
2121 1 SV * message = ST(2)
2122 ;
2123 SV * level;
2124 IV RETVAL;
2125 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
2126  
2127 1 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 1 1
2128 0 level = NULL;
2129 else {
2130 1 level = ST(3)
2131 ;
2132 }
2133 #line 253 "./xs/backend.xs"
2134 pq_log_add(aTHX_ self, id, level && SvOK(level)
2135 ? SvPV_nolen(level) : NULL, message);
2136 RETVAL = 1;
2137 #line 2138 "Queue.c"
2138 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
2139 0 ST(0) = TARG;
2140 }
2141 0 XSRETURN(1);
2142 }
2143  
2144  
2145 XS_EUPXS(XS_Punk__Queue__Backend_job_log); /* prototype to pass -Wmissing-prototypes */
2146 0 XS_EUPXS(XS_Punk__Queue__Backend_job_log)
2147 {
2148 0 dVAR; dXSARGS;
2149 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
2150 0 croak_xs_usage(cv, "self, id");
2151 {
2152 0 SV * self = ST(0)
2153 ;
2154 0 IV id = (IV)SvIV(ST(1))
2155 ;
2156 SV * RETVAL;
2157 #line 267 "./xs/backend.xs"
2158 RETVAL = newRV_noinc((SV *)pq_job_log_rows(aTHX_ self, id));
2159 #line 2160 "Queue.c"
2160 0 RETVAL = sv_2mortal(RETVAL);
2161 0 ST(0) = RETVAL;
2162 }
2163 0 XSRETURN(1);
2164 }
2165  
2166  
2167 XS_EUPXS(XS_Punk__Queue__Backend_reset); /* prototype to pass -Wmissing-prototypes */
2168 0 XS_EUPXS(XS_Punk__Queue__Backend_reset)
2169 {
2170 0 dVAR; dXSARGS;
2171 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2172 0 croak_xs_usage(cv, "self");
2173 {
2174 0 SV * self = ST(0)
2175 ;
2176 #line 275 "./xs/backend.xs"
2177 pq_reset(aTHX_ self);
2178 #line 2179 "Queue.c"
2179 }
2180 0 XSRETURN_EMPTY;
2181 }
2182  
2183  
2184 XS_EUPXS(XS_Punk__Queue__Backend_lock); /* prototype to pass -Wmissing-prototypes */
2185 14 XS_EUPXS(XS_Punk__Queue__Backend_lock)
2186 {
2187 14 dVAR; dXSARGS;
2188 14 ▶ if (items < 3 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 3 || items > 4) 14 0 14
if (items < 3 || items > 4) 0 14 14
2189 0 croak_xs_usage(cv, "self, name, duration, opts = NULL");
2190 {
2191 14 SV * self = ST(0)
2192 ;
2193 14 SV * name = ST(1)
2194 ;
2195 14 NV duration = (NV)SvNV(ST(2))
2196 ;
2197 SV * opts;
2198 #line 286 "./xs/backend.xs"
2199 HV *o = NULL;
2200 SV *v;
2201 IV limit = 1, owner = 0;
2202 #line 2203 "Queue.c"
2203 IV RETVAL;
2204 14 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 14 14
2205  
2206 14 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 14 14
2207 0 opts = NULL;
2208 else {
2209 14 opts = ST(3)
2210 ;
2211 }
2212 #line 290 "./xs/backend.xs"
2213 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
2214 o = (HV *)SvRV(opts);
2215 if (o && (v = pq_get(aTHX_ o, "limit")) && SvOK(v)) limit = SvIV(v);
2216 if (o && (v = pq_get(aTHX_ o, "owner")) && SvOK(v)) owner = SvIV(v);
2217 RETVAL = pq_lock(aTHX_ self, name, duration, limit, owner);
2218 #line 2219 "Queue.c"
2219 14 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 14 14
2220 14 ST(0) = TARG;
2221 }
2222 14 XSRETURN(1);
2223 }
2224  
2225  
2226 XS_EUPXS(XS_Punk__Queue__Backend_renew_lock); /* prototype to pass -Wmissing-prototypes */
2227 3 XS_EUPXS(XS_Punk__Queue__Backend_renew_lock)
2228 {
2229 3 dVAR; dXSARGS;
2230 3 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 3 3
2231 0 croak_xs_usage(cv, "self, name, owner, duration");
2232 {
2233 3 SV * self = ST(0)
2234 ;
2235 3 SV * name = ST(1)
2236 ;
2237 3 IV owner = (IV)SvIV(ST(2))
2238 ;
2239 3 NV duration = (NV)SvNV(ST(3))
2240 ;
2241 IV RETVAL;
2242 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 3 3
2243 #line 305 "./xs/backend.xs"
2244 RETVAL = pq_renew_lock(aTHX_ self, name, owner, duration);
2245 #line 2246 "Queue.c"
2246 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 3 3
2247 3 ST(0) = TARG;
2248 }
2249 3 XSRETURN(1);
2250 }
2251  
2252  
2253 XS_EUPXS(XS_Punk__Queue__Backend_unlock); /* prototype to pass -Wmissing-prototypes */
2254 13 XS_EUPXS(XS_Punk__Queue__Backend_unlock)
2255 {
2256 13 dVAR; dXSARGS;
2257 13 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 13 0 13
if (items < 2 || items > 3) 0 13 13
2258 0 croak_xs_usage(cv, "self, name, owner = NULL");
2259 {
2260 13 SV * self = ST(0)
2261 ;
2262 13 SV * name = ST(1)
2263 ;
2264 SV * owner;
2265 IV RETVAL;
2266 13 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 13 13
2267  
2268 13 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 13 13
2269 0 owner = NULL;
2270 else {
2271 13 owner = ST(2)
2272 ;
2273 }
2274 #line 315 "./xs/backend.xs"
2275 RETVAL = pq_unlock(aTHX_ self, name,
2276 (owner && SvOK(owner)) ? SvIV(owner) : 0,
2277 (owner && SvOK(owner)) ? 1 : 0);
2278 #line 2279 "Queue.c"
2279 13 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 13 13
2280 13 ST(0) = TARG;
2281 }
2282 13 XSRETURN(1);
2283 }
2284  
2285  
2286 XS_EUPXS(XS_Punk__Queue__Backend_list_locks); /* prototype to pass -Wmissing-prototypes */
2287 0 XS_EUPXS(XS_Punk__Queue__Backend_list_locks)
2288 {
2289 0 dVAR; dXSARGS;
2290 0 ▶ if (items < 1 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 4) 0 0 0
if (items < 1 || items > 4) 0 0 0
2291 0 croak_xs_usage(cv, "self, offset = 0, limit = 0, filter = NULL");
2292 {
2293 0 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 0 0
2294 ;
2295 IV offset;
2296 IV limit;
2297 SV * filter;
2298 #line 328 "./xs/backend.xs"
2299 HV *f = NULL;
2300 #line 2301 "Queue.c"
2301 SV * RETVAL;
2302  
2303 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2304 0 offset = 0;
2305 else {
2306 0 offset = (IV)SvIV(ST(1))
2307 ;
2308 }
2309  
2310 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2311 0 limit = 0;
2312 else {
2313 0 limit = (IV)SvIV(ST(2))
2314 ;
2315 }
2316  
2317 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
2318 0 filter = NULL;
2319 else {
2320 0 filter = ST(3)
2321 ;
2322 }
2323 #line 330 "./xs/backend.xs"
2324 if (filter && SvROK(filter) && SvTYPE(SvRV(filter)) == SVt_PVHV)
2325 f = (HV *)SvRV(filter);
2326 RETVAL = pq_list_locks(aTHX_ self, offset, limit, f);
2327 #line 2328 "Queue.c"
2328 0 RETVAL = sv_2mortal(RETVAL);
2329 0 ST(0) = RETVAL;
2330 }
2331 0 XSRETURN(1);
2332 }
2333  
2334  
2335 XS_EUPXS(XS_Punk__Queue__Backend_broadcast); /* prototype to pass -Wmissing-prototypes */
2336 0 XS_EUPXS(XS_Punk__Queue__Backend_broadcast)
2337 {
2338 0 dVAR; dXSARGS;
2339 0 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 0 0 0
if (items < 2 || items > 4) 0 0 0
2340 0 croak_xs_usage(cv, "self, cmd, args = NULL, ids = NULL");
2341 {
2342 0 SV * self = ST(0)
2343 ;
2344 0 ▶ SV * cmd = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * cmd = ST(1) 0 0 0
2345 ;
2346 SV * args;
2347 SV * ids;
2348 #line 345 "./xs/backend.xs"
2349 AV *a = NULL, *w = NULL;
2350 #line 2351 "Queue.c"
2351 IV RETVAL;
2352 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
2353  
2354 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2355 0 args = NULL;
2356 else {
2357 0 args = ST(2)
2358 ;
2359 }
2360  
2361 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
2362 0 ids = NULL;
2363 else {
2364 0 ids = ST(3)
2365 ;
2366 }
2367 #line 347 "./xs/backend.xs"
2368 if (args && SvROK(args) && SvTYPE(SvRV(args)) == SVt_PVAV)
2369 a = (AV *)SvRV(args);
2370 if (ids && SvROK(ids) && SvTYPE(SvRV(ids)) == SVt_PVAV)
2371 w = (AV *)SvRV(ids);
2372 RETVAL = pq_broadcast(aTHX_ self, cmd, a, w);
2373 #line 2374 "Queue.c"
2374 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
2375 0 ST(0) = TARG;
2376 }
2377 0 XSRETURN(1);
2378 }
2379  
2380  
2381 XS_EUPXS(XS_Punk__Queue__Backend_receive); /* prototype to pass -Wmissing-prototypes */
2382 13 XS_EUPXS(XS_Punk__Queue__Backend_receive)
2383 {
2384 13 dVAR; dXSARGS;
2385 13 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 13 13
2386 0 croak_xs_usage(cv, "self, worker_id");
2387 {
2388 13 SV * self = ST(0)
2389 ;
2390 13 IV worker_id = (IV)SvIV(ST(1))
2391 ;
2392 SV * RETVAL;
2393 #line 360 "./xs/backend.xs"
2394 RETVAL = pq_receive(aTHX_ self, worker_id);
2395 #line 2396 "Queue.c"
2396 13 RETVAL = sv_2mortal(RETVAL);
2397 13 ST(0) = RETVAL;
2398 }
2399 13 XSRETURN(1);
2400 }
2401  
2402  
2403 XS_EUPXS(XS_Punk__Queue__Backend_repair); /* prototype to pass -Wmissing-prototypes */
2404 0 XS_EUPXS(XS_Punk__Queue__Backend_repair)
2405 {
2406 0 dVAR; dXSARGS;
2407 0 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 0 0 0
if (items < 1 || items > 2) 0 0 0
2408 0 croak_xs_usage(cv, "self, opts = NULL");
2409 {
2410 0 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 0 0
2411 ;
2412 SV * opts;
2413 #line 371 "./xs/backend.xs"
2414 HV *o = NULL;
2415 SV *v;
2416 int deep = 0;
2417 #line 2418 "Queue.c"
2418 SV * RETVAL;
2419  
2420 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2421 0 opts = NULL;
2422 else {
2423 0 opts = ST(1)
2424 ;
2425 }
2426 #line 375 "./xs/backend.xs"
2427 if (opts && SvROK(opts) && SvTYPE(SvRV(opts)) == SVt_PVHV)
2428 o = (HV *)SvRV(opts);
2429 if (o && (v = pq_get(aTHX_ o, "deep")) && SvTRUE(v)) deep = 1;
2430 RETVAL = pq_repair(aTHX_ self, deep);
2431 #line 2432 "Queue.c"
2432 0 RETVAL = sv_2mortal(RETVAL);
2433 0 ST(0) = RETVAL;
2434 }
2435 0 XSRETURN(1);
2436 }
2437  
2438  
2439 XS_EUPXS(XS_Punk__Queue__Backend_history); /* prototype to pass -Wmissing-prototypes */
2440 0 XS_EUPXS(XS_Punk__Queue__Backend_history)
2441 {
2442 0 dVAR; dXSARGS;
2443 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2444 0 croak_xs_usage(cv, "self");
2445 {
2446 0 SV * self = ST(0)
2447 ;
2448 SV * RETVAL;
2449 #line 386 "./xs/backend.xs"
2450 RETVAL = pq_history(aTHX_ self);
2451 #line 2452 "Queue.c"
2452 0 RETVAL = sv_2mortal(RETVAL);
2453 0 ST(0) = RETVAL;
2454 }
2455 0 XSRETURN(1);
2456 }
2457  
2458  
2459 XS_EUPXS(XS_Punk__Queue__Backend__ready_horizon); /* prototype to pass -Wmissing-prototypes */
2460 15 XS_EUPXS(XS_Punk__Queue__Backend__ready_horizon)
2461 {
2462 15 dVAR; dXSARGS;
2463 15 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 15 15
2464 0 croak_xs_usage(cv, "self, queues");
2465 {
2466 15 SV * self = ST(0)
2467 ;
2468 15 SV * queues = ST(1)
2469 ;
2470 #line 398 "./xs/backend.xs"
2471 AV *q;
2472 double h;
2473 #line 2474 "Queue.c"
2474 SV * RETVAL;
2475 #line 401 "./xs/backend.xs"
2476 q = pq_sql_list(aTHX_ queues);
2477 if (av_len(q) < 0) av_push(q, newSVpvs("default"));
2478 h = pq_ready_horizon(aTHX_ self, q);
2479 if (h < 0) XSRETURN_UNDEF;
2480 RETVAL = newSVnv(h);
2481 #line 2482 "Queue.c"
2482 0 RETVAL = sv_2mortal(RETVAL);
2483 0 ST(0) = RETVAL;
2484 }
2485 0 XSRETURN(1);
2486 }
2487  
2488  
2489 XS_EUPXS(XS_Punk__Queue__Backend_upsert_cron); /* prototype to pass -Wmissing-prototypes */
2490 0 XS_EUPXS(XS_Punk__Queue__Backend_upsert_cron)
2491 {
2492 0 dVAR; dXSARGS;
2493 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
2494 0 croak_xs_usage(cv, "self, def");
2495 {
2496 0 SV * self = ST(0)
2497 ;
2498 0 ▶ SV * def = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * def = ST(1) 0 0 0
2499 ;
2500 #line 416 "./xs/backend.xs"
2501 HV *d = NULL;
2502 #line 2503 "Queue.c"
2503 IV RETVAL;
2504 0 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 0 0 0
dXSTARG; 0 0 0
2505 #line 418 "./xs/backend.xs"
2506 if (def && SvROK(def) && SvTYPE(SvRV(def)) == SVt_PVHV)
2507 d = (HV *)SvRV(def);
2508 if (!d) croak("Punk::Queue: upsert_cron needs a hash reference");
2509 RETVAL = pq_upsert_cron(aTHX_ self, d);
2510 #line 2511 "Queue.c"
2511 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
2512 0 ST(0) = TARG;
2513 }
2514 0 XSRETURN(1);
2515 }
2516  
2517  
2518 XS_EUPXS(XS_Punk__Queue__Backend_disable_missing_crons); /* prototype to pass -Wmissing-prototypes */
2519 0 XS_EUPXS(XS_Punk__Queue__Backend_disable_missing_crons)
2520 {
2521 0 dVAR; dXSARGS;
2522 0 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 0 0 0
if (items < 1 || items > 2) 0 0 0
2523 0 croak_xs_usage(cv, "self, names = NULL");
2524 {
2525 0 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 0 0 0
2526 ;
2527 SV * names;
2528 #line 430 "./xs/backend.xs"
2529 AV *n = NULL;
2530 #line 2531 "Queue.c"
2531 IV RETVAL;
2532 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
2533  
2534 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2535 0 names = NULL;
2536 else {
2537 0 names = ST(1)
2538 ;
2539 }
2540 #line 432 "./xs/backend.xs"
2541 if (names && SvROK(names) && SvTYPE(SvRV(names)) == SVt_PVAV)
2542 n = (AV *)SvRV(names);
2543 RETVAL = pq_disable_missing_crons(aTHX_ self, n);
2544 #line 2545 "Queue.c"
2545 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
2546 0 ST(0) = TARG;
2547 }
2548 0 XSRETURN(1);
2549 }
2550  
2551  
2552 XS_EUPXS(XS_Punk__Queue__Backend_enable_cron); /* prototype to pass -Wmissing-prototypes */
2553 0 XS_EUPXS(XS_Punk__Queue__Backend_enable_cron)
2554 {
2555 0 dVAR; dXSARGS;
2556 0 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 0 0 0
if (items < 2 || items > 3) 0 0 0
2557 0 croak_xs_usage(cv, "self, name, on = 1");
2558 {
2559 0 SV * self = ST(0)
2560 ;
2561 0 SV * name = ST(1)
2562 ;
2563 IV on;
2564 IV RETVAL;
2565 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
2566  
2567 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2568 0 on = 1;
2569 else {
2570 0 on = (IV)SvIV(ST(2))
2571 ;
2572 }
2573 #line 444 "./xs/backend.xs"
2574 RETVAL = pq_enable_cron(aTHX_ self, name, on ? 1 : 0);
2575 #line 2576 "Queue.c"
2576 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
2577 0 ST(0) = TARG;
2578 }
2579 0 XSRETURN(1);
2580 }
2581  
2582  
2583 XS_EUPXS(XS_Punk__Queue__Backend_cron_info); /* prototype to pass -Wmissing-prototypes */
2584 0 XS_EUPXS(XS_Punk__Queue__Backend_cron_info)
2585 {
2586 0 dVAR; dXSARGS;
2587 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
2588 0 croak_xs_usage(cv, "self, name");
2589 {
2590 0 SV * self = ST(0)
2591 ;
2592 0 SV * name = ST(1)
2593 ;
2594 #line 453 "./xs/backend.xs"
2595 SV *info;
2596 #line 2597 "Queue.c"
2597 SV * RETVAL;
2598 #line 455 "./xs/backend.xs"
2599 info = pq_cron_info(aTHX_ self, name);
2600 if (!info) XSRETURN_UNDEF;
2601 RETVAL = info;
2602 #line 2603 "Queue.c"
2603 0 RETVAL = sv_2mortal(RETVAL);
2604 0 ST(0) = RETVAL;
2605 }
2606 0 XSRETURN(1);
2607 }
2608  
2609  
2610 XS_EUPXS(XS_Punk__Queue__Backend_list_crons); /* prototype to pass -Wmissing-prototypes */
2611 0 XS_EUPXS(XS_Punk__Queue__Backend_list_crons)
2612 {
2613 0 dVAR; dXSARGS;
2614 0 ▶ if (items < 1 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 3) 0 0 0
if (items < 1 || items > 3) 0 0 0
2615 0 croak_xs_usage(cv, "self, offset = 0, limit = 0");
2616 {
2617 0 SV * self = ST(0)
2618 ;
2619 IV offset;
2620 IV limit;
2621 SV * RETVAL;
2622  
2623 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2624 0 offset = 0;
2625 else {
2626 0 offset = (IV)SvIV(ST(1))
2627 ;
2628 }
2629  
2630 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2631 0 limit = 0;
2632 else {
2633 0 limit = (IV)SvIV(ST(2))
2634 ;
2635 }
2636 #line 467 "./xs/backend.xs"
2637 RETVAL = pq_list_crons(aTHX_ self, offset, limit);
2638 #line 2639 "Queue.c"
2639 0 RETVAL = sv_2mortal(RETVAL);
2640 0 ST(0) = RETVAL;
2641 }
2642 0 XSRETURN(1);
2643 }
2644  
2645  
2646 XS_EUPXS(XS_Punk__Queue__Backend__cron_tick); /* prototype to pass -Wmissing-prototypes */
2647 26 XS_EUPXS(XS_Punk__Queue__Backend__cron_tick)
2648 {
2649 26 dVAR; dXSARGS;
2650 26 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 26 0 26
if (items < 1 || items > 2) 0 26 26
2651 0 croak_xs_usage(cv, "self, limit = 100");
2652 {
2653 26 SV * self = ST(0)
2654 ;
2655 IV limit;
2656 IV RETVAL;
2657 26 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 10 16 26
2658  
2659 26 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 10 16 26
2660 10 limit = 100;
2661 else {
2662 16 limit = (IV)SvIV(ST(1))
2663 ;
2664 }
2665 #line 479 "./xs/backend.xs"
2666 RETVAL = pq_cron_tick(aTHX_ self, limit);
2667 #line 2668 "Queue.c"
2668 26 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 26 26
2669 26 ST(0) = TARG;
2670 }
2671 26 XSRETURN(1);
2672 }
2673  
2674  
2675 /* INCLUDE: Returning to 'Queue.xs' from 'xs/backend.xs' */
2676  
2677  
2678 /* INCLUDE: Including 'xs/backend_sqlite.xs' from 'Queue.xs' */
2679  
2680  
2681 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_dequeue); /* prototype to pass -Wmissing-prototypes */
2682 0 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_dequeue)
2683 {
2684 0 dVAR; dXSARGS;
2685 0 ▶ if (items < 1 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 4) 0 0 0
if (items < 1 || items > 4) 0 0 0
2686 0 croak_xs_usage(cv, "self, worker_id = 0, queues = NULL, tasks = NULL");
2687 {
2688 0 SV * self = ST(0)
2689 ;
2690 IV worker_id;
2691 SV * queues;
2692 SV * tasks;
2693 #line 13 "./xs/backend_sqlite.xs"
2694 AV *q, *t;
2695 SV *row;
2696 #line 2697 "Queue.c"
2697 SV * RETVAL;
2698  
2699 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2700 0 worker_id = 0;
2701 else {
2702 0 worker_id = (IV)SvIV(ST(1))
2703 ;
2704 }
2705  
2706 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2707 0 queues = NULL;
2708 else {
2709 0 queues = ST(2)
2710 ;
2711 }
2712  
2713 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
2714 0 tasks = NULL;
2715 else {
2716 0 tasks = ST(3)
2717 ;
2718 }
2719 #line 16 "./xs/backend_sqlite.xs"
2720 {
2721 q = pq_sql_list(aTHX_ queues);
2722 if (av_len(q) < 0) av_push(q, newSVpvs("default"));
2723 t = pq_sql_list(aTHX_ tasks);
2724  
2725 row = pq_sqlite_dequeue(aTHX_ self, worker_id, q, t);
2726 if (!row) XSRETURN_UNDEF;
2727 RETVAL = row;
2728 }
2729 #line 2730 "Queue.c"
2730 0 RETVAL = sv_2mortal(RETVAL);
2731 0 ST(0) = RETVAL;
2732 }
2733 0 XSRETURN(1);
2734 }
2735  
2736  
2737 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_begin_immediate); /* prototype to pass -Wmissing-prototypes */
2738 0 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_begin_immediate)
2739 {
2740 0 dVAR; dXSARGS;
2741 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2742 0 croak_xs_usage(cv, "self");
2743 {
2744 0 SV * self = ST(0)
2745 ;
2746 #line 35 "./xs/backend_sqlite.xs"
2747 pq_sqlite_begin_exclusive(aTHX_ self);
2748 #line 2749 "Queue.c"
2749 }
2750 0 XSRETURN_EMPTY;
2751 }
2752  
2753  
2754 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_commit); /* prototype to pass -Wmissing-prototypes */
2755 0 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_commit)
2756 {
2757 0 dVAR; dXSARGS;
2758 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2759 0 croak_xs_usage(cv, "self");
2760 {
2761 0 SV * self = ST(0)
2762 ;
2763 #line 41 "./xs/backend_sqlite.xs"
2764 pq_sqlite_commit(aTHX_ self);
2765 #line 2766 "Queue.c"
2766 }
2767 0 XSRETURN_EMPTY;
2768 }
2769  
2770  
2771 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_rollback); /* prototype to pass -Wmissing-prototypes */
2772 0 XS_EUPXS(XS_Punk__Queue__Backend__SQLite_rollback)
2773 {
2774 0 dVAR; dXSARGS;
2775 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2776 0 croak_xs_usage(cv, "self");
2777 {
2778 0 SV * self = ST(0)
2779 ;
2780 #line 47 "./xs/backend_sqlite.xs"
2781 pq_sqlite_rollback(aTHX_ self);
2782 #line 2783 "Queue.c"
2783 }
2784 0 XSRETURN_EMPTY;
2785 }
2786  
2787  
2788 /* INCLUDE: Returning to 'Queue.xs' from 'xs/backend_sqlite.xs' */
2789  
2790  
2791 /* INCLUDE: Including 'xs/backend_pg.xs' from 'Queue.xs' */
2792  
2793  
2794 XS_EUPXS(XS_Punk__Queue__Backend__Pg_dequeue); /* prototype to pass -Wmissing-prototypes */
2795 0 XS_EUPXS(XS_Punk__Queue__Backend__Pg_dequeue)
2796 {
2797 0 dVAR; dXSARGS;
2798 0 ▶ if (items < 1 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 4) 0 0 0
if (items < 1 || items > 4) 0 0 0
2799 0 croak_xs_usage(cv, "self, worker_id = 0, queues = NULL, tasks = NULL");
2800 {
2801 0 SV * self = ST(0)
2802 ;
2803 IV worker_id;
2804 SV * queues;
2805 SV * tasks;
2806 #line 13 "./xs/backend_pg.xs"
2807 AV *q, *t;
2808 SV *row;
2809 #line 2810 "Queue.c"
2810 SV * RETVAL;
2811  
2812 0 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 0 0
2813 0 worker_id = 0;
2814 else {
2815 0 worker_id = (IV)SvIV(ST(1))
2816 ;
2817 }
2818  
2819 0 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 0 0
2820 0 queues = NULL;
2821 else {
2822 0 queues = ST(2)
2823 ;
2824 }
2825  
2826 0 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 0 0 0
2827 0 tasks = NULL;
2828 else {
2829 0 tasks = ST(3)
2830 ;
2831 }
2832 #line 16 "./xs/backend_pg.xs"
2833 {
2834 q = pq_sql_list(aTHX_ queues);
2835 if (av_len(q) < 0) av_push(q, newSVpvs("default"));
2836 t = pq_sql_list(aTHX_ tasks);
2837  
2838 row = pq_pg_dequeue(aTHX_ self, worker_id, q, t);
2839 if (!row) XSRETURN_UNDEF;
2840 RETVAL = row;
2841 }
2842 #line 2843 "Queue.c"
2843 0 RETVAL = sv_2mortal(RETVAL);
2844 0 ST(0) = RETVAL;
2845 }
2846 0 XSRETURN(1);
2847 }
2848  
2849  
2850 XS_EUPXS(XS_Punk__Queue__Backend__Pg_notify); /* prototype to pass -Wmissing-prototypes */
2851 0 XS_EUPXS(XS_Punk__Queue__Backend__Pg_notify)
2852 {
2853 0 dVAR; dXSARGS;
2854 0 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 0 0
2855 0 croak_xs_usage(cv, "self, queue, id");
2856 {
2857 0 SV * self = ST(0)
2858 ;
2859 0 SV * queue = ST(1)
2860 ;
2861 0 IV id = (IV)SvIV(ST(2))
2862 ;
2863 #line 36 "./xs/backend_pg.xs"
2864 pq_pg_notify(aTHX_ self, queue, id);
2865 #line 2866 "Queue.c"
2866 }
2867 0 XSRETURN_EMPTY;
2868 }
2869  
2870  
2871 XS_EUPXS(XS_Punk__Queue__Backend__Pg_begin_immediate); /* prototype to pass -Wmissing-prototypes */
2872 0 XS_EUPXS(XS_Punk__Queue__Backend__Pg_begin_immediate)
2873 {
2874 0 dVAR; dXSARGS;
2875 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2876 0 croak_xs_usage(cv, "self");
2877 {
2878 0 SV * self = ST(0)
2879 ;
2880 #line 45 "./xs/backend_pg.xs"
2881 pq_pg_begin_exclusive(aTHX_ self);
2882 #line 2883 "Queue.c"
2883 }
2884 0 XSRETURN_EMPTY;
2885 }
2886  
2887  
2888 XS_EUPXS(XS_Punk__Queue__Backend__Pg_commit); /* prototype to pass -Wmissing-prototypes */
2889 0 XS_EUPXS(XS_Punk__Queue__Backend__Pg_commit)
2890 {
2891 0 dVAR; dXSARGS;
2892 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2893 0 croak_xs_usage(cv, "self");
2894 {
2895 0 SV * self = ST(0)
2896 ;
2897 #line 51 "./xs/backend_pg.xs"
2898 pq_pg_commit(aTHX_ self);
2899 #line 2900 "Queue.c"
2900 }
2901 0 XSRETURN_EMPTY;
2902 }
2903  
2904  
2905 XS_EUPXS(XS_Punk__Queue__Backend__Pg_rollback); /* prototype to pass -Wmissing-prototypes */
2906 0 XS_EUPXS(XS_Punk__Queue__Backend__Pg_rollback)
2907 {
2908 0 dVAR; dXSARGS;
2909 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
2910 0 croak_xs_usage(cv, "self");
2911 {
2912 0 SV * self = ST(0)
2913 ;
2914 #line 57 "./xs/backend_pg.xs"
2915 pq_pg_rollback(aTHX_ self);
2916 #line 2917 "Queue.c"
2917 }
2918 0 XSRETURN_EMPTY;
2919 }
2920  
2921  
2922 /* INCLUDE: Returning to 'Queue.xs' from 'xs/backend_pg.xs' */
2923  
2924  
2925 /* INCLUDE: Including 'xs/job.xs' from 'Queue.xs' */
2926  
2927  
2928 XS_EUPXS(XS_Punk__Queue__Job_id); /* prototype to pass -Wmissing-prototypes */
2929 123 XS_EUPXS(XS_Punk__Queue__Job_id)
2930 {
2931 123 dVAR; dXSARGS;
2932 123 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 123 123
2933 0 croak_xs_usage(cv, "self");
2934 {
2935 123 SV * self = ST(0)
2936 ;
2937 #line 11 "./xs/job.xs"
2938 SV *v;
2939 #line 2940 "Queue.c"
2940 SV * RETVAL;
2941 #line 13 "./xs/job.xs"
2942 v = pq_job_field(aTHX_ self, "id");
2943 RETVAL = newSViv(v ? SvIV(v) : 0);
2944 #line 2945 "Queue.c"
2945 123 RETVAL = sv_2mortal(RETVAL);
2946 123 ST(0) = RETVAL;
2947 }
2948 123 XSRETURN(1);
2949 }
2950  
2951  
2952 XS_EUPXS(XS_Punk__Queue__Job_task); /* prototype to pass -Wmissing-prototypes */
2953 7 XS_EUPXS(XS_Punk__Queue__Job_task)
2954 {
2955 7 dVAR; dXSARGS;
2956 7 dXSI32;
2957 7 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 7 7
2958 0 croak_xs_usage(cv, "self");
2959 {
2960 7 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 5 2 7
2961 ;
2962 #line 25 "./xs/job.xs"
2963 SV *v;
2964 const char *k;
2965 #line 2966 "Queue.c"
2966 SV * RETVAL;
2967 #line 28 "./xs/job.xs"
2968 k = (ix == 1) ? "queue" : (ix == 2) ? "state" : "task";
2969 v = pq_job_field(aTHX_ self, k);
2970 RETVAL = newSVsv(v ? v : &PL_sv_undef);
2971 #line 2972 "Queue.c"
2972 7 RETVAL = sv_2mortal(RETVAL);
2973 7 ST(0) = RETVAL;
2974 }
2975 7 XSRETURN(1);
2976 }
2977  
2978  
2979 XS_EUPXS(XS_Punk__Queue__Job_retries); /* prototype to pass -Wmissing-prototypes */
2980 6 XS_EUPXS(XS_Punk__Queue__Job_retries)
2981 {
2982 6 dVAR; dXSARGS;
2983 6 dXSI32;
2984 6 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 6 6
2985 0 croak_xs_usage(cv, "self");
2986 {
2987 6 SV * self = ST(0)
2988 ;
2989 #line 41 "./xs/job.xs"
2990 SV *v;
2991 const char *k;
2992 #line 2993 "Queue.c"
2993 IV RETVAL;
2994 6 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 6 0 6
dXSTARG; 4 2 6
2995 #line 44 "./xs/job.xs"
2996 k = (ix == 1) ? "attempts" : (ix == 2) ? "priority" : "retries";
2997 v = pq_job_field(aTHX_ self, k);
2998 RETVAL = v ? SvIV(v) : 0;
2999 #line 3000 "Queue.c"
3000 6 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 6 6
3001 6 ST(0) = TARG;
3002 }
3003 6 XSRETURN(1);
3004 }
3005  
3006  
3007 XS_EUPXS(XS_Punk__Queue__Job_args); /* prototype to pass -Wmissing-prototypes */
3008 5 XS_EUPXS(XS_Punk__Queue__Job_args)
3009 {
3010 5 dVAR; dXSARGS;
3011 5 dXSI32;
3012 5 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 5 5
3013 0 croak_xs_usage(cv, "self");
3014 {
3015 5 ▶ SV * self = ST(0)
Branch: 1 branch
BranchTrueFalseTotal
SV * self = ST(0) 3 2 5
3016 ;
3017 #line 56 "./xs/job.xs"
3018 SV *v;
3019 #line 3020 "Queue.c"
3020 SV * RETVAL;
3021 #line 58 "./xs/job.xs"
3022 v = pq_job_field(aTHX_ self, ix == 1 ? "notes" : "args");
3023 RETVAL = newSVsv(v ? v : &PL_sv_undef);
3024 #line 3025 "Queue.c"
3025 5 RETVAL = sv_2mortal(RETVAL);
3026 5 ST(0) = RETVAL;
3027 }
3028 5 XSRETURN(1);
3029 }
3030  
3031  
3032 XS_EUPXS(XS_Punk__Queue__Job_info); /* prototype to pass -Wmissing-prototypes */
3033 0 XS_EUPXS(XS_Punk__Queue__Job_info)
3034 {
3035 0 dVAR; dXSARGS;
3036 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
3037 0 croak_xs_usage(cv, "self");
3038 {
3039 0 SV * self = ST(0)
3040 ;
3041 #line 69 "./xs/job.xs"
3042 HV *h, *row;
3043 #line 3044 "Queue.c"
3044 SV * RETVAL;
3045 #line 71 "./xs/job.xs"
3046 h = pq_hv(aTHX_ self, "Punk::Queue::Job");
3047 row = pq_get_hv(aTHX_ h, "row");
3048 if (!row) XSRETURN_UNDEF;
3049 RETVAL = newRV_inc((SV *)row);
3050 #line 3051 "Queue.c"
3051 0 RETVAL = sv_2mortal(RETVAL);
3052 0 ST(0) = RETVAL;
3053 }
3054 0 XSRETURN(1);
3055 }
3056  
3057  
3058 XS_EUPXS(XS_Punk__Queue__Job_queue_object); /* prototype to pass -Wmissing-prototypes */
3059 0 XS_EUPXS(XS_Punk__Queue__Job_queue_object)
3060 {
3061 0 dVAR; dXSARGS;
3062 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
3063 0 croak_xs_usage(cv, "self");
3064 {
3065 0 SV * self = ST(0)
3066 ;
3067 #line 83 "./xs/job.xs"
3068 HV *h;
3069 SV *q;
3070 #line 3071 "Queue.c"
3071 SV * RETVAL;
3072 #line 86 "./xs/job.xs"
3073 h = pq_hv(aTHX_ self, "Punk::Queue::Job");
3074 q = pq_get(aTHX_ h, "queue");
3075 if (!(q && SvROK(q))) XSRETURN_UNDEF;
3076 RETVAL = newSVsv(q);
3077 #line 3078 "Queue.c"
3078 0 RETVAL = sv_2mortal(RETVAL);
3079 0 ST(0) = RETVAL;
3080 }
3081 0 XSRETURN(1);
3082 }
3083  
3084  
3085 XS_EUPXS(XS_Punk__Queue__Job_note); /* prototype to pass -Wmissing-prototypes */
3086 1 XS_EUPXS(XS_Punk__Queue__Job_note)
3087 {
3088 1 dVAR; dXSARGS;
3089 1 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 1 1
3090 0 croak_xs_usage(cv, "self, ...");
3091 {
3092 1 SV * self = ST(0)
3093 ;
3094 #line 100 "./xs/job.xs"
3095 HV *h, *row, *merge, *notes;
3096 SV *q, *backend, *nv;
3097 IV id;
3098 int i;
3099 #line 3100 "Queue.c"
3100 IV RETVAL;
3101 1 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 1 0 1
dXSTARG; 0 1 1
3102 #line 105 "./xs/job.xs"
3103 {
3104 if ((items - 1) % 2)
3105 croak("Punk::Queue::Job->note: odd number of key/value pairs");
3106 h = pq_hv(aTHX_ self, "Punk::Queue::Job");
3107 row = pq_get_hv(aTHX_ h, "row");
3108 q = pq_get(aTHX_ h, "queue");
3109 if (!(row && q && SvROK(q)))
3110 croak("Punk::Queue::Job: detached job object");
3111 backend = pq_backend_of(aTHX_ q);
3112 id = pq_get(aTHX_ row, "id") ? SvIV(pq_get(aTHX_ row, "id")) : 0;
3113  
3114 merge = (HV *)sv_2mortal((SV *)newHV());
3115 for (i = 1; i < items; i += 2)
3116 (void)hv_store_ent(merge, ST(i), newSVsv(ST(i + 1)), 0);
3117  
3118 RETVAL = pq_note(aTHX_ backend, id, merge);
3119  
3120 /* mirror the merge onto the in-memory row */
3121 nv = pq_get(aTHX_ row, "notes");
3122 notes = (nv && SvROK(nv) && SvTYPE(SvRV(nv)) == SVt_PVHV)
3123 ? (HV *)SvRV(nv) : NULL;
3124 if (RETVAL && notes) {
3125 HE *he;
3126 hv_iterinit(merge);
3127 while ((he = hv_iternext(merge))) {
3128 SV *val = HeVAL(he);
3129 if (val && SvOK(val))
3130 (void)hv_store_ent(notes, HeSVKEY_force(he),
3131 newSVsv(val), 0);
3132 else
3133 (void)hv_delete_ent(notes, HeSVKEY_force(he),
3134 G_DISCARD, 0);
3135 }
3136 }
3137 }
3138 #line 3139 "Queue.c"
3139 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
3140 1 ST(0) = TARG;
3141 }
3142 1 XSRETURN(1);
3143 }
3144  
3145  
3146 XS_EUPXS(XS_Punk__Queue__Job_log); /* prototype to pass -Wmissing-prototypes */
3147 5 XS_EUPXS(XS_Punk__Queue__Job_log)
3148 {
3149 5 dVAR; dXSARGS;
3150 5 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 5 0 5
if (items < 2 || items > 3) 0 5 5
3151 0 croak_xs_usage(cv, "self, first, second = NULL");
3152 {
3153 5 SV * self = ST(0)
3154 ;
3155 5 ▶ SV * first = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * first = ST(1) 5 0 5
3156 ;
3157 SV * second;
3158 #line 154 "./xs/job.xs"
3159 HV *h, *row;
3160 SV *q, *backend, *msg;
3161 const char *level = NULL;
3162 IV id;
3163 #line 3164 "Queue.c"
3164 IV RETVAL;
3165 5 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 5 0 5
3166  
3167 5 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 3 2 5
3168 3 second = NULL;
3169 else {
3170 2 second = ST(2)
3171 ;
3172 }
3173 #line 159 "./xs/job.xs"
3174 {
3175 h = pq_hv(aTHX_ self, "Punk::Queue::Job");
3176 row = pq_get_hv(aTHX_ h, "row");
3177 q = pq_get(aTHX_ h, "queue");
3178 if (!(row && q && SvROK(q)))
3179 croak("Punk::Queue::Job: detached job object");
3180 backend = pq_backend_of(aTHX_ q);
3181 id = pq_get(aTHX_ row, "id") ? SvIV(pq_get(aTHX_ row, "id")) : 0;
3182  
3183 if (second && SvOK(second)) {
3184 level = SvPV_nolen(first);
3185 msg = second;
3186 }
3187 else msg = first;
3188 pq_log_add(aTHX_ backend, id, level, msg);
3189 RETVAL = 1;
3190 }
3191 #line 3192 "Queue.c"
3192 5 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 5 5
3193 5 ST(0) = TARG;
3194 }
3195 5 XSRETURN(1);
3196 }
3197  
3198  
3199 XS_EUPXS(XS_Punk__Queue__Job_finish); /* prototype to pass -Wmissing-prototypes */
3200 2 XS_EUPXS(XS_Punk__Queue__Job_finish)
3201 {
3202 2 dVAR; dXSARGS;
3203 2 dXSI32;
3204 2 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 2 0 2
if (items < 1 || items > 2) 0 2 2
3205 0 croak_xs_usage(cv, "self, result = NULL");
3206 {
3207 2 SV * self = ST(0)
3208 ;
3209 SV * result;
3210 #line 186 "./xs/job.xs"
3211 HV *h, *row;
3212 SV *q, *backend;
3213 IV id, retries;
3214 #line 3215 "Queue.c"
3215 IV RETVAL;
3216 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
3217  
3218 2 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 2 2
3219 0 result = NULL;
3220 else {
3221 2 result = ST(1)
3222 ;
3223 }
3224 #line 190 "./xs/job.xs"
3225 {
3226 h = pq_hv(aTHX_ self, "Punk::Queue::Job");
3227 row = pq_get_hv(aTHX_ h, "row");
3228 q = pq_get(aTHX_ h, "queue");
3229 if (!(row && q && SvROK(q)))
3230 croak("Punk::Queue::Job: detached job object");
3231 backend = pq_backend_of(aTHX_ q);
3232 id = pq_get(aTHX_ row, "id") ? SvIV(pq_get(aTHX_ row, "id")) : 0;
3233 retries = pq_get(aTHX_ row, "retries") ? SvIV(pq_get(aTHX_ row, "retries")) : 0;
3234 RETVAL = ix == 1 ? pq_fail_job(aTHX_ backend, id, retries, result)
3235 : pq_finish_job(aTHX_ backend, id, retries, result);
3236 }
3237 #line 3238 "Queue.c"
3238 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 2 2
3239 2 ST(0) = TARG;
3240 }
3241 2 XSRETURN(1);
3242 }
3243  
3244  
3245 /* INCLUDE: Returning to 'Queue.xs' from 'xs/job.xs' */
3246  
3247  
3248 /* INCLUDE: Including 'xs/worker.xs' from 'Queue.xs' */
3249  
3250  
3251 XS_EUPXS(XS_Punk__Queue__Worker_run); /* prototype to pass -Wmissing-prototypes */
3252 21 XS_EUPXS(XS_Punk__Queue__Worker_run)
3253 {
3254 21 dVAR; dXSARGS;
3255 21 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 21 21
3256 0 croak_xs_usage(cv, "self");
3257 {
3258 21 SV * self = ST(0)
3259 ;
3260 IV RETVAL;
3261 21 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 14 7 21
3262 #line 11 "./xs/worker.xs"
3263 RETVAL = pqw_run(aTHX_ self);
3264 #line 3265 "Queue.c"
3265 14 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 14 14
3266 14 ST(0) = TARG;
3267 }
3268 14 XSRETURN(1);
3269 }
3270  
3271  
3272 XS_EUPXS(XS_Punk__Queue__Worker_id); /* prototype to pass -Wmissing-prototypes */
3273 1 XS_EUPXS(XS_Punk__Queue__Worker_id)
3274 {
3275 1 dVAR; dXSARGS;
3276 1 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 1 1
3277 0 croak_xs_usage(cv, "self");
3278 {
3279 1 SV * self = ST(0)
3280 ;
3281 #line 19 "./xs/worker.xs"
3282 HV *h;
3283 SV *v;
3284 #line 3285 "Queue.c"
3285 SV * RETVAL;
3286 #line 22 "./xs/worker.xs"
3287 h = pq_hv(aTHX_ self, "Punk::Queue::Worker");
3288 v = pq_get(aTHX_ h, "worker_id");
3289 if (!v) XSRETURN_UNDEF;
3290 RETVAL = newSVsv(v);
3291 #line 3292 "Queue.c"
3292 1 RETVAL = sv_2mortal(RETVAL);
3293 1 ST(0) = RETVAL;
3294 }
3295 1 XSRETURN(1);
3296 }
3297  
3298  
3299 XS_EUPXS(XS_Punk__Queue__Worker_queue); /* prototype to pass -Wmissing-prototypes */
3300 0 XS_EUPXS(XS_Punk__Queue__Worker_queue)
3301 {
3302 0 dVAR; dXSARGS;
3303 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
3304 0 croak_xs_usage(cv, "self");
3305 {
3306 0 SV * self = ST(0)
3307 ;
3308 #line 33 "./xs/worker.xs"
3309 HV *h;
3310 SV *v;
3311 #line 3312 "Queue.c"
3312 SV * RETVAL;
3313 #line 36 "./xs/worker.xs"
3314 h = pq_hv(aTHX_ self, "Punk::Queue::Worker");
3315 v = pq_get(aTHX_ h, "queue");
3316 if (!(v && SvROK(v))) XSRETURN_UNDEF;
3317 RETVAL = newSVsv(v);
3318 #line 3319 "Queue.c"
3319 0 RETVAL = sv_2mortal(RETVAL);
3320 0 ST(0) = RETVAL;
3321 }
3322 0 XSRETURN(1);
3323 }
3324  
3325  
3326 XS_EUPXS(XS_Punk__Queue__Supervisor_run); /* prototype to pass -Wmissing-prototypes */
3327 14 XS_EUPXS(XS_Punk__Queue__Supervisor_run)
3328 {
3329 14 dVAR; dXSARGS;
3330 14 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 14 14
3331 0 croak_xs_usage(cv, "class, queue, ...");
3332 {
3333 14 SV * class = ST(0)
3334 ;
3335 14 ▶ SV * queue = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * queue = ST(1) 14 0 14
3336 ;
3337 #line 54 "./xs/worker.xs"
3338 HV *opts, *wopts;
3339 SV *wopts_rv;
3340 int i, nworkers = 1, fail_fast = 0, scheduler = 1;
3341 double graceful = 60.0;
3342 #line 3343 "Queue.c"
3343 IV RETVAL;
3344 14 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 14 0 14
dXSTARG; 0 14 14
3345 #line 59 "./xs/worker.xs"
3346 {
3347 PERL_UNUSED_ARG(class);
3348 if ((items - 2) % 2)
3349 croak("Punk::Queue::Supervisor->run: odd number of options");
3350 opts = (HV *)sv_2mortal((SV *)newHV());
3351 for (i = 2; i < items; i += 2)
3352 (void)hv_store_ent(opts, ST(i), newSVsv(ST(i + 1)), 0);
3353  
3354 {
3355 SV *v;
3356 if ((v = pq_get(aTHX_ opts, "workers")) && SvOK(v))
3357 nworkers = (int)SvIV(v);
3358 if ((v = pq_get(aTHX_ opts, "graceful_timeout")) && SvOK(v))
3359 graceful = SvNV(v);
3360 if ((v = pq_get(aTHX_ opts, "fail_fast")) && SvOK(v))
3361 fail_fast = SvTRUE(v) ? 1 : 0;
3362 }
3363 {
3364 SV *v;
3365 if ((v = pq_get(aTHX_ opts, "scheduler")) && SvOK(v))
3366 scheduler = SvTRUE(v) ? 1 : 0;
3367 }
3368  
3369 /* everything else in opts is the children's worker options */
3370 wopts = newHV();
3371 {
3372 HE *he;
3373 hv_iterinit(opts);
3374 while ((he = hv_iternext(opts))) {
3375 SV *k = HeSVKEY_force(he);
3376 const char *ks = SvPV_nolen(k);
3377 if (strEQ(ks, "workers") || strEQ(ks, "graceful_timeout")
3378 || strEQ(ks, "fail_fast") || strEQ(ks, "scheduler"))
3379 continue;
3380 (void)hv_store_ent(wopts, k, newSVsv(HeVAL(he)), 0);
3381 }
3382 }
3383 wopts_rv = sv_2mortal(newRV_noinc((SV *)wopts));
3384  
3385 RETVAL = pqs_run(aTHX_ queue, wopts_rv, nworkers, graceful,
3386 fail_fast, scheduler);
3387 }
3388 #line 3389 "Queue.c"
3389 14 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 14 14
3390 14 ST(0) = TARG;
3391 }
3392 14 XSRETURN(1);
3393 }
3394  
3395  
3396 /* INCLUDE: Returning to 'Queue.xs' from 'xs/worker.xs' */
3397  
3398  
3399 /* INCLUDE: Including 'xs/cron.xs' from 'Queue.xs' */
3400  
3401  
3402 XS_EUPXS(XS_Punk__Queue__Cron_check); /* prototype to pass -Wmissing-prototypes */
3403 26 XS_EUPXS(XS_Punk__Queue__Cron_check)
3404 {
3405 26 dVAR; dXSARGS;
3406 26 ▶ if (items < 2 || items > 3)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 3) 26 0 26
if (items < 2 || items > 3) 0 26 26
3407 0 croak_xs_usage(cv, "class, expr, tz = NULL");
3408 {
3409 26 SV * class = ST(0)
3410 ;
3411 26 ▶ SV * expr = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * expr = ST(1) 26 0 26
3412 ;
3413 SV * tz;
3414 #line 14 "./xs/cron.xs"
3415 pq_cron c;
3416 pq_tz z;
3417 STRLEN el, tl = 0;
3418 const char *es, *ts = NULL;
3419 #line 3420 "Queue.c"
3420 IV RETVAL;
3421 26 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 26 0 26
3422  
3423 26 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 17 9 26
3424 17 tz = NULL;
3425 else {
3426 9 tz = ST(2)
3427 ;
3428 }
3429 #line 19 "./xs/cron.xs"
3430 PERL_UNUSED_ARG(class);
3431 es = SvPV_const(expr, el);
3432 if (tz && SvOK(tz)) ts = SvPV_const(tz, tl);
3433 pq_cron_compile(aTHX_ es, el, ts, tl, &c, &z);
3434 RETVAL = 1;
3435 #line 3436 "Queue.c"
3436 5 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 5 5
3437 5 ST(0) = TARG;
3438 }
3439 5 XSRETURN(1);
3440 }
3441  
3442  
3443 XS_EUPXS(XS_Punk__Queue__Cron_next_after); /* prototype to pass -Wmissing-prototypes */
3444 445 XS_EUPXS(XS_Punk__Queue__Cron_next_after)
3445 {
3446 445 dVAR; dXSARGS;
3447 445 ▶ if (items < 2 || items > 4)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 2 || items > 4) 445 0 445
if (items < 2 || items > 4) 0 445 445
3448 0 croak_xs_usage(cv, "class, expr, from = NULL, tz = NULL");
3449 {
3450 445 SV * class = ST(0)
3451 ;
3452 445 ▶ SV * expr = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * expr = ST(1) 0 445 445
3453 ;
3454 SV * from;
3455 SV * tz;
3456 #line 36 "./xs/cron.xs"
3457 pq_cron c;
3458 pq_tz z;
3459 STRLEN el, tl = 0;
3460 const char *es, *ts = NULL;
3461 double f, n;
3462 #line 3463 "Queue.c"
3463 SV * RETVAL;
3464  
3465 445 ▶ if (items < 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 3) 0 445 445
3466 0 from = NULL;
3467 else {
3468 445 from = ST(2)
3469 ;
3470 }
3471  
3472 445 ▶ if (items < 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 4) 29 416 445
3473 29 tz = NULL;
3474 else {
3475 416 tz = ST(3)
3476 ;
3477 }
3478 #line 42 "./xs/cron.xs"
3479 PERL_UNUSED_ARG(class);
3480 es = SvPV_const(expr, el);
3481 if (tz && SvOK(tz)) ts = SvPV_const(tz, tl);
3482 pq_cron_parse(aTHX_ es, el, &c);
3483 pq_tz_parse(aTHX_ ts, tl, &z);
3484 f = (from && SvOK(from)) ? SvNV(from) : (double)time(NULL);
3485 n = pq_cron_next(aTHX_ &c, f, &z);
3486 if (n < 0) XSRETURN_UNDEF;
3487 RETVAL = newSVnv(n);
3488 #line 3489 "Queue.c"
3489 443 RETVAL = sv_2mortal(RETVAL);
3490 443 ST(0) = RETVAL;
3491 }
3492 443 XSRETURN(1);
3493 }
3494  
3495  
3496 /* INCLUDE: Returning to 'Queue.xs' from 'xs/cron.xs' */
3497  
3498 #ifdef __cplusplus
3499 extern "C" {
3500 #endif
3501 XS_EXTERNAL(boot_Punk__Queue); /* prototype to pass -Wmissing-prototypes */
3502 100 XS_EXTERNAL(boot_Punk__Queue)
3503 {
3504 #if PERL_VERSION_LE(5, 21, 5)
3505 dVAR; dXSARGS;
3506 #else
3507 100 dVAR; dXSBOOTARGSXSAPIVERCHK;
3508 #endif
3509 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
3510 char* file = __FILE__;
3511 #else
3512 100 const char* file = __FILE__;
3513 #endif
3514  
3515 PERL_UNUSED_VAR(file);
3516  
3517 PERL_UNUSED_VAR(cv); /* -W */
3518 PERL_UNUSED_VAR(items); /* -W */
3519 #if PERL_VERSION_LE(5, 21, 5)
3520 XS_VERSION_BOOTCHECK;
3521 # ifdef XS_APIVERSION_BOOTCHECK
3522 XS_APIVERSION_BOOTCHECK;
3523 # endif
3524 #endif
3525  
3526 {
3527 CV * cv;
3528  
3529 100 newXS_deffile("Punk::Queue::new", XS_Punk__Queue_new);
3530 100 newXS_deffile("Punk::Queue::backend", XS_Punk__Queue_backend);
3531 100 newXS_deffile("Punk::Queue::dbh", XS_Punk__Queue_dbh);
3532 100 newXS_deffile("Punk::Queue::migrate", XS_Punk__Queue_migrate);
3533 100 newXS_deffile("Punk::Queue::schema_version", XS_Punk__Queue_schema_version);
3534 100 newXS_deffile("Punk::Queue::task", XS_Punk__Queue_task);
3535 100 newXS_deffile("Punk::Queue::tasks", XS_Punk__Queue_tasks);
3536 100 cv = newXS_deffile("Punk::Queue::queue_defaults", XS_Punk__Queue_queue_defaults);
3537 100 XSANY.any_i32 = 0;
3538 100 cv = newXS_deffile("Punk::Queue::task_defaults", XS_Punk__Queue_queue_defaults);
3539 100 XSANY.any_i32 = 1;
3540 100 newXS_deffile("Punk::Queue::enqueue", XS_Punk__Queue_enqueue);
3541 100 newXS_deffile("Punk::Queue::dequeue", XS_Punk__Queue_dequeue);
3542 100 newXS_deffile("Punk::Queue::job_info", XS_Punk__Queue_job_info);
3543 100 newXS_deffile("Punk::Queue::job_log", XS_Punk__Queue_job_log);
3544 100 newXS_deffile("Punk::Queue::finish_job", XS_Punk__Queue_finish_job);
3545 100 newXS_deffile("Punk::Queue::fail_job", XS_Punk__Queue_fail_job);
3546 100 newXS_deffile("Punk::Queue::perform", XS_Punk__Queue_perform);
3547 100 newXS_deffile("Punk::Queue::dequeue_ref", XS_Punk__Queue_dequeue_ref);
3548 100 newXS_deffile("Punk::Queue::retry_job", XS_Punk__Queue_retry_job);
3549 100 newXS_deffile("Punk::Queue::remove_job", XS_Punk__Queue_remove_job);
3550 100 newXS_deffile("Punk::Queue::list_jobs", XS_Punk__Queue_list_jobs);
3551 100 newXS_deffile("Punk::Queue::list_workers", XS_Punk__Queue_list_workers);
3552 100 newXS_deffile("Punk::Queue::stats", XS_Punk__Queue_stats);
3553 100 newXS_deffile("Punk::Queue::reset", XS_Punk__Queue_reset);
3554 100 newXS_deffile("Punk::Queue::repair", XS_Punk__Queue_repair);
3555 100 newXS_deffile("Punk::Queue::history", XS_Punk__Queue_history);
3556 100 newXS_deffile("Punk::Queue::list_locks", XS_Punk__Queue_list_locks);
3557 100 newXS_deffile("Punk::Queue::lock", XS_Punk__Queue_lock);
3558 100 newXS_deffile("Punk::Queue::unlock", XS_Punk__Queue_unlock);
3559 100 newXS_deffile("Punk::Queue::renew_lock", XS_Punk__Queue_renew_lock);
3560 100 newXS_deffile("Punk::Queue::broadcast", XS_Punk__Queue_broadcast);
3561 100 newXS_deffile("Punk::Queue::worker", XS_Punk__Queue_worker);
3562 100 newXS_deffile("Punk::Queue::_inserver_attach", XS_Punk__Queue__inserver_attach);
3563 100 newXS_deffile("Punk::Queue::upsert_cron", XS_Punk__Queue_upsert_cron);
3564 100 newXS_deffile("Punk::Queue::disable_missing_crons", XS_Punk__Queue_disable_missing_crons);
3565 100 newXS_deffile("Punk::Queue::enable_cron", XS_Punk__Queue_enable_cron);
3566 100 newXS_deffile("Punk::Queue::cron_info", XS_Punk__Queue_cron_info);
3567 100 newXS_deffile("Punk::Queue::list_crons", XS_Punk__Queue_list_crons);
3568 100 newXS_deffile("Punk::Queue::Backend::dbh", XS_Punk__Queue__Backend_dbh);
3569 100 newXS_deffile("Punk::Queue::Backend::migrate", XS_Punk__Queue__Backend_migrate);
3570 100 newXS_deffile("Punk::Queue::Backend::schema_version", XS_Punk__Queue__Backend_schema_version);
3571 100 newXS_deffile("Punk::Queue::Backend::latest_version", XS_Punk__Queue__Backend_latest_version);
3572 100 newXS_deffile("Punk::Queue::Backend::now", XS_Punk__Queue__Backend_now);
3573 100 newXS_deffile("Punk::Queue::Backend::clock_delta", XS_Punk__Queue__Backend_clock_delta);
3574 100 newXS_deffile("Punk::Queue::Backend::has_returning", XS_Punk__Queue__Backend_has_returning);
3575 100 newXS_deffile("Punk::Queue::Backend::enqueue", XS_Punk__Queue__Backend_enqueue);
3576 100 newXS_deffile("Punk::Queue::Backend::job_info", XS_Punk__Queue__Backend_job_info);
3577 100 newXS_deffile("Punk::Queue::Backend::finish_job", XS_Punk__Queue__Backend_finish_job);
3578 100 newXS_deffile("Punk::Queue::Backend::fail_job", XS_Punk__Queue__Backend_fail_job);
3579 100 newXS_deffile("Punk::Queue::Backend::retry_job", XS_Punk__Queue__Backend_retry_job);
3580 100 newXS_deffile("Punk::Queue::Backend::remove_job", XS_Punk__Queue__Backend_remove_job);
3581 100 newXS_deffile("Punk::Queue::Backend::register_worker", XS_Punk__Queue__Backend_register_worker);
3582 100 newXS_deffile("Punk::Queue::Backend::unregister_worker", XS_Punk__Queue__Backend_unregister_worker);
3583 100 newXS_deffile("Punk::Queue::Backend::worker_heartbeat", XS_Punk__Queue__Backend_worker_heartbeat);
3584 100 newXS_deffile("Punk::Queue::Backend::list_jobs", XS_Punk__Queue__Backend_list_jobs);
3585 100 newXS_deffile("Punk::Queue::Backend::list_workers", XS_Punk__Queue__Backend_list_workers);
3586 100 newXS_deffile("Punk::Queue::Backend::stats", XS_Punk__Queue__Backend_stats);
3587 100 newXS_deffile("Punk::Queue::Backend::note", XS_Punk__Queue__Backend_note);
3588 100 newXS_deffile("Punk::Queue::Backend::log_job", XS_Punk__Queue__Backend_log_job);
3589 100 newXS_deffile("Punk::Queue::Backend::job_log", XS_Punk__Queue__Backend_job_log);
3590 100 newXS_deffile("Punk::Queue::Backend::reset", XS_Punk__Queue__Backend_reset);
3591 100 newXS_deffile("Punk::Queue::Backend::lock", XS_Punk__Queue__Backend_lock);
3592 100 newXS_deffile("Punk::Queue::Backend::renew_lock", XS_Punk__Queue__Backend_renew_lock);
3593 100 newXS_deffile("Punk::Queue::Backend::unlock", XS_Punk__Queue__Backend_unlock);
3594 100 newXS_deffile("Punk::Queue::Backend::list_locks", XS_Punk__Queue__Backend_list_locks);
3595 100 newXS_deffile("Punk::Queue::Backend::broadcast", XS_Punk__Queue__Backend_broadcast);
3596 100 newXS_deffile("Punk::Queue::Backend::receive", XS_Punk__Queue__Backend_receive);
3597 100 newXS_deffile("Punk::Queue::Backend::repair", XS_Punk__Queue__Backend_repair);
3598 100 newXS_deffile("Punk::Queue::Backend::history", XS_Punk__Queue__Backend_history);
3599 100 newXS_deffile("Punk::Queue::Backend::_ready_horizon", XS_Punk__Queue__Backend__ready_horizon);
3600 100 newXS_deffile("Punk::Queue::Backend::upsert_cron", XS_Punk__Queue__Backend_upsert_cron);
3601 100 newXS_deffile("Punk::Queue::Backend::disable_missing_crons", XS_Punk__Queue__Backend_disable_missing_crons);
3602 100 newXS_deffile("Punk::Queue::Backend::enable_cron", XS_Punk__Queue__Backend_enable_cron);
3603 100 newXS_deffile("Punk::Queue::Backend::cron_info", XS_Punk__Queue__Backend_cron_info);
3604 100 newXS_deffile("Punk::Queue::Backend::list_crons", XS_Punk__Queue__Backend_list_crons);
3605 100 newXS_deffile("Punk::Queue::Backend::_cron_tick", XS_Punk__Queue__Backend__cron_tick);
3606 100 newXS_deffile("Punk::Queue::Backend::SQLite::dequeue", XS_Punk__Queue__Backend__SQLite_dequeue);
3607 100 newXS_deffile("Punk::Queue::Backend::SQLite::begin_immediate", XS_Punk__Queue__Backend__SQLite_begin_immediate);
3608 100 newXS_deffile("Punk::Queue::Backend::SQLite::commit", XS_Punk__Queue__Backend__SQLite_commit);
3609 100 newXS_deffile("Punk::Queue::Backend::SQLite::rollback", XS_Punk__Queue__Backend__SQLite_rollback);
3610 100 newXS_deffile("Punk::Queue::Backend::Pg::dequeue", XS_Punk__Queue__Backend__Pg_dequeue);
3611 100 newXS_deffile("Punk::Queue::Backend::Pg::notify", XS_Punk__Queue__Backend__Pg_notify);
3612 100 newXS_deffile("Punk::Queue::Backend::Pg::begin_immediate", XS_Punk__Queue__Backend__Pg_begin_immediate);
3613 100 newXS_deffile("Punk::Queue::Backend::Pg::commit", XS_Punk__Queue__Backend__Pg_commit);
3614 100 newXS_deffile("Punk::Queue::Backend::Pg::rollback", XS_Punk__Queue__Backend__Pg_rollback);
3615 100 newXS_deffile("Punk::Queue::Job::id", XS_Punk__Queue__Job_id);
3616 100 cv = newXS_deffile("Punk::Queue::Job::queue", XS_Punk__Queue__Job_task);
3617 100 XSANY.any_i32 = 1;
3618 100 cv = newXS_deffile("Punk::Queue::Job::state", XS_Punk__Queue__Job_task);
3619 100 XSANY.any_i32 = 2;
3620 100 cv = newXS_deffile("Punk::Queue::Job::task", XS_Punk__Queue__Job_task);
3621 100 XSANY.any_i32 = 0;
3622 100 cv = newXS_deffile("Punk::Queue::Job::attempts", XS_Punk__Queue__Job_retries);
3623 100 XSANY.any_i32 = 1;
3624 100 cv = newXS_deffile("Punk::Queue::Job::priority", XS_Punk__Queue__Job_retries);
3625 100 XSANY.any_i32 = 2;
3626 100 cv = newXS_deffile("Punk::Queue::Job::retries", XS_Punk__Queue__Job_retries);
3627 100 XSANY.any_i32 = 0;
3628 100 cv = newXS_deffile("Punk::Queue::Job::args", XS_Punk__Queue__Job_args);
3629 100 XSANY.any_i32 = 0;
3630 100 cv = newXS_deffile("Punk::Queue::Job::notes", XS_Punk__Queue__Job_args);
3631 100 XSANY.any_i32 = 1;
3632 100 newXS_deffile("Punk::Queue::Job::info", XS_Punk__Queue__Job_info);
3633 100 newXS_deffile("Punk::Queue::Job::queue_object", XS_Punk__Queue__Job_queue_object);
3634 100 newXS_deffile("Punk::Queue::Job::note", XS_Punk__Queue__Job_note);
3635 100 newXS_deffile("Punk::Queue::Job::log", XS_Punk__Queue__Job_log);
3636 100 cv = newXS_deffile("Punk::Queue::Job::fail", XS_Punk__Queue__Job_finish);
3637 100 XSANY.any_i32 = 1;
3638 100 cv = newXS_deffile("Punk::Queue::Job::finish", XS_Punk__Queue__Job_finish);
3639 100 XSANY.any_i32 = 0;
3640 100 newXS_deffile("Punk::Queue::Worker::run", XS_Punk__Queue__Worker_run);
3641 100 newXS_deffile("Punk::Queue::Worker::id", XS_Punk__Queue__Worker_id);
3642 100 newXS_deffile("Punk::Queue::Worker::queue", XS_Punk__Queue__Worker_queue);
3643 100 newXS_deffile("Punk::Queue::Supervisor::run", XS_Punk__Queue__Supervisor_run);
3644 100 newXS_deffile("Punk::Queue::Cron::check", XS_Punk__Queue__Cron_check);
3645 100 newXS_deffile("Punk::Queue::Cron::next_after", XS_Punk__Queue__Cron_next_after);
3646 }
3647 #if PERL_VERSION_LE(5, 21, 5)
3648 # if PERL_VERSION_GE(5, 9, 0)
3649 if (PL_unitcheckav)
3650 call_list(PL_scopestack_ix, PL_unitcheckav);
3651 # endif
3652 XSRETURN_YES;
3653 #else
3654 100 Perl_xs_boot_epilog(aTHX_ ax);
3655 #endif
3656 100 }
3657  
3658 #ifdef __cplusplus
3659 }
3660 #endif
« include/pq_worker.h ↑ Summary xs/job.xs »