1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! honker SQLite loadable extension.
//!
//! Thin wrapper around `honker-core`. Registers:
//!
//! * `notify()` SQL scalar function + `_honker_notifications`
//! table — via `honker_core::attach_notify`.
//! * Every `honker_*` queue / lock / rate-limit / scheduler / result
//! function — via `honker_core::attach_honker_functions`.
//!
//! .load ./libhonker_ext
//! SELECT honker_bootstrap();
//! INSERT INTO _honker_live (queue, payload)
//! VALUES ('emails', '{"to": "alice"}');
//! SELECT honker_claim_batch('emails', 'worker-1', 32, 300);
//! SELECT honker_ack_batch('[1,2,3]', 'worker-1');
//! SELECT notify('orders', '{"id": 42}');
//!
//! Actual SQL implementations live in `honker_core::honker_ops`
//! so the Python (PyO3) and Node (napi-rs) bindings can register the
//! same functions on their own connections without loading this
//! `.dylib`. One source of truth for the SQL.
use Connection;
use ffi;
use ;
/// SQLite entry point. Name must match `sqlite3_<extname>_init`; SQLite
/// derives `<extname>` from the filename — stripping the `lib` prefix
/// and any non-alphabetic characters:
/// `libhonker_ext.dylib` -> `honker_ext` -> `honkerext`
/// -> `sqlite3_honkerext_init`.
///
/// # Safety
/// Called by SQLite. All pointers are SQLite-owned.
pub unsafe extern "C"