alkstore 0.1.0

The alkstore contract crate: one reactive store trait surface — notify, streams, durable queues, TTL locks, outbox, scheduler — implemented by the alkstore-sqlite/-postgres/-mem engine crates; no driver dependencies
Documentation
//! The wake receiver (ADR-008 §3, §8): the `listen(channel)` return.
//!
//! Wakes are best-effort hints, not per-commit delivery promises —
//! possibly coalesced (SQLite) or per-notify (Postgres), possibly
//! repeated after reconnect, possibly absent entirely — recovery is
//! the consumer's re-read, never a guaranteed deliver. Consumers must
//! be idempotent on wake.

use std::time::Duration;

use crate::Result;
use crate::future::BoxedFuture;
use crate::wake::Wake;

/// The wake receiver: the durable-subscription-free listen side of
/// the notify mechanism.
///
/// Close semantics (ADR-008 §3): `recv() -> None` means closed
/// (source death — SQLite's watcher death; terminal). The synthetic
/// reconnect-wake (the reserved channel) covers Postgres connection
/// gaps and arrives as a normal [`Wake`].
pub trait WakeReceiver: Send {
    /// Wait for the next wake. `None` = the source closed (terminal;
    /// a closed receiver never reopens — recovery is a fresh
    /// `listen`).
    fn recv<'a>(&'a mut self) -> BoxedFuture<'a, Option<Wake>>;

    /// Poll without waiting. `Ok(None)` = no wake pending right now
    /// (idle); `Err(Closed)` = the source closed. Closed and idle are
    /// distinguishable states.
    fn try_recv(&mut self) -> Result<Option<Wake>>;

    /// Bounded wait for the next wake. Timeout expiry without a wake
    /// returns `Ok(None)` — idle is the documented `Ok(None)` arm;
    /// the `Err` arm carries `Database` (storage failure) or `Closed`
    /// (source death), never a timeout signal (ADR-008 §3).
    fn recv_timeout<'a>(&'a mut self, timeout: Duration) -> BoxedFuture<'a, Result<Option<Wake>>>;
}