fuzz-parser-exposure: doc-hidden re-exports of the @every parsers + skip_forward (three engines); visibility-only — sqlite substrate facade mod.rs line + PROVENANCE D-37; compile-level reachability pins per engine
This commit is contained in:
1 parent
860c5d6129
commit
21ab6fe564
12 files changed
+143
-22
No files matched your search
@@ -0,0 +1,5 @@
|
||||
#[test]
|
||||
fn doc_hidden_reexports_reach_the_crate_root() {
|
||||
assert_eq!(crate::parse_every_interval("@every 5s").unwrap(), 5);
|
||||
assert_eq!(crate::skip_forward(0, 20, 5), 25);
|
||||
}
|
||||
@@ -48,6 +48,9 @@ mod store;
|
||||
mod stream;
|
||||
mod tx;
|
||||
|
||||
#[cfg(test)]
|
||||
mod fuzz_surface_tests;
|
||||
|
||||
pub use opts::{DEFAULT_MAX_SIZE, PgOpts};
|
||||
pub use schema::{
|
||||
BootstrapError, BootstrapResult, DEFAULT_SCHEMA, QualifiedTable, bootstrap, quote_identifier,
|
||||
@@ -55,3 +58,14 @@ pub use schema::{
|
||||
};
|
||||
pub use store::{PgStore, open};
|
||||
pub use tx::PgTxHandle;
|
||||
|
||||
/// Fuzz/test-only surface: the pg engine's `@every` parser — not
|
||||
/// contract surface, not consumer API, no stability guarantee.
|
||||
#[doc(hidden)]
|
||||
pub use scheduler::parse_every_interval;
|
||||
|
||||
/// Fuzz/test-only surface: the pg engine's schedule skip-forward
|
||||
/// arithmetic — not contract surface, not consumer API, no stability
|
||||
/// guarantee.
|
||||
#[doc(hidden)]
|
||||
pub use scheduler::skip_forward;
|
||||
@@ -221,7 +221,7 @@ fn invalid_spec(spec: &str) -> Error {
|
||||
/// with `n` a positive integer and unit in `s|m|h|d`. Everything else
|
||||
/// (cron strings, bare `every 5s`, floats, unknown units) rejects.
|
||||
/// Returns the interval in seconds.
|
||||
pub(crate) fn parse_every_interval(spec: &str) -> Result<i64> {
|
||||
pub fn parse_every_interval(spec: &str) -> Result<i64> {
|
||||
let reject = || invalid_spec(spec);
|
||||
let body = spec.strip_prefix("@every ").ok_or_else(reject)?;
|
||||
if body.is_empty() {
|
||||
@@ -261,7 +261,7 @@ fn next_every_boundary(spec: &str, after: i64) -> Result<i64> {
|
||||
/// `next + (gap / interval + 1) * interval` — strictly beyond `now`
|
||||
/// (the skipped boundaries never enqueue). 128-bit intermediates keep
|
||||
/// the arithmetic saturation-safe; the result clamps at `i64::MAX`.
|
||||
fn skip_forward(next_fire_at: i64, now: i64, interval: i64) -> i64 {
|
||||
pub fn skip_forward(next_fire_at: i64, now: i64, interval: i64) -> i64 {
|
||||
let gap = (now - next_fire_at) as i128;
|
||||
let interval = interval.max(1) as i128;
|
||||
let next = (next_fire_at as i128) + (gap / interval + 1) * interval;
|
||||
|
||||
Reference in new issue
Block a user