Tahinli/forge
public0 watching
★ 0
| 1 | //! Repo webhooks: the event names, the hook and delivery shapes. The stored shape is in |
| 2 | //! migrations/0011_webhooks.sql; the store functions live in store/webhooks.rs. |
| 3 | //! |
| 4 | //! A hook never carries its secret. The secret is sealed with the instance key (see `secret.rs`) |
| 5 | //! by the caller and stored as `secret_sealed`; it is read back only through |
| 6 | //! `Store::webhook_secret`. |
| 7 | |
| 8 | /// Every event a hook can subscribe to. The `as_str` names are stored and sent in `X-Forge-Event`. |
| 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 | /// Delivery state. Stored as the `as_str` name. |
| 55 | /// `Pending`: queued, never attempted. `Failed`: an attempt failed and a retry is scheduled. |
| 56 | /// `Ok`: a 2xx response was received. `GaveUp`: no further attempts. |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | /// A repo webhook. Has no secret field; see `Store::webhook_secret`. |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | /// One delivery attempt chain for one event. `request_*` is immutable; the rest is updated as |
| 99 | /// attempts happen. |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | /// The outcome of one attempt, recorded by `Store::record_delivery_result`. |
| 130 | /// |
| 131 | /// `ok` true sets the state to `Ok`. `ok` false with `next_attempt_at` set sets it to `Failed` |
| 132 | /// and schedules a retry. `ok` false with `next_attempt_at` `None` sets it to `GaveUp`. |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | /// Largest response body kept, in bytes. |
| 150 | pub const MAX_RESPONSE_BODY_BYTES: usize = 64 * 1024; |