Commit 5a3bf33
committed
Add lifecycle hooks, pagination, and cache
Introduce an in-process events system and lifecycle hooks (events::EventBus, LifecycleHooks) and integrate on_start/on_shutdown hooks into RustApi (on_start/on_shutdown and invocation in run/run_with_shutdown). Add pagination helpers: Paginate and CursorPaginate extractors, and Paginated / CursorPaginated HATEOAS response wrappers with IntoResponse implementations and OpenAPI-friendly metadata/headers. Extend Route with error_response to annotate typed error responses in generated OpenAPI. Significantly enhance the cache middleware: CacheConfig options (ttl, max_entries, vary_headers, etag), CacheStore with LRU eviction, CacheHandle for invalidation, ETag/If-None-Match handling, vary-by-header keys, builder API (with_handle/build), and tests. Update public exports to expose new types from rustapi-core and adjust rustapi-extras exports accordingly. Added tests and small refactors across core crates to wire these features together.1 parent 189ae08 commit 5a3bf33
24 files changed
Lines changed: 2118 additions & 403 deletions
File tree
- crates
- rustapi-core/src
- rustapi-extras/src
- cache
- rustapi-macros/src
- rustapi-rs
- src
- tests
- docs/.agent
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
301 | 359 | | |
302 | 360 | | |
303 | 361 | | |
| |||
955 | 1013 | | |
956 | 1014 | | |
957 | 1015 | | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
958 | 1021 | | |
959 | 1022 | | |
960 | 1023 | | |
| |||
975 | 1038 | | |
976 | 1039 | | |
977 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
978 | 1056 | | |
979 | | - | |
| 1057 | + | |
980 | 1058 | | |
981 | 1059 | | |
982 | 1060 | | |
| |||
0 commit comments