Module timeout

Module timeout 

Source
Expand description

Timeout context for query execution

This module provides a lightweight timeout checking mechanism that can be passed to query execution functions (joins, scans, etc.) without requiring the full SelectExecutor reference.

§Design Rationale

The SelectExecutor owns the timeout configuration but many query execution functions (especially joins) don’t have access to it. Rather than threading the executor through all call chains, we extract just the timeout-related state into this lightweight struct.

§Usage Pattern

// Create from executor
let timeout_ctx = TimeoutContext::from_executor(executor);

// Pass to join/scan functions
nested_loop_join(left, right, condition, database, &timeout_ctx)?;

// Check periodically in hot loops
for row in rows {
    if iteration % CHECK_INTERVAL == 0 {
        timeout_ctx.check()?;
    }
    // ... process row ...
}

Structs§

TimeoutContext
Lightweight timeout context for query execution.

Constants§

CHECK_INTERVAL
Recommended interval for timeout checks in hot loops. Checking every 1000 iterations balances responsiveness with overhead.