SQLite engine: scheduler + outbox — schedule/unschedule/run_schedules leader loop, outbox enqueue/run_once (task sqlite-engine-scheduler-outbox)
This commit is contained in:
1 parent
1edcb0e27d
commit
8502a51af7
11 files changed
+1548
-36
No files matched your search
@@ -29,6 +29,12 @@ use alkstore::{BoxedFuture, Lock, Result, validate_local_name, validate_shared_n
|
||||
use crate::seam::{closed_store_error, sqlite_error, with_writer};
|
||||
use crate::substrate::{Writer, lock_acquire, lock_release, lock_renew};
|
||||
|
||||
/// The scheduler's leadership-lock name (ADR-009 §4 — the reserved-
|
||||
/// prefix derived name in the lock namespace; engine-internal: every
|
||||
/// consumer entry point rejects the same prefix, so a consumer can
|
||||
/// never collide with it).
|
||||
pub(crate) const SCHEDULER_LEADER_LOCK: &str = concat!("__alkstore_", "scheduler");
|
||||
|
||||
/// The acquire path (see the module docs): validation, guard, then the
|
||||
/// substrate's `lock_acquire` through the writer slot. `Ok(None)` is
|
||||
/// the held-by-someone-else arm.
|
||||
@@ -94,6 +100,22 @@ impl std::fmt::Debug for SqliteLockHandle {
|
||||
}
|
||||
}
|
||||
|
||||
impl SqliteLockHandle {
|
||||
pub(crate) fn new_internal(
|
||||
name: &str,
|
||||
owner: &str,
|
||||
writer: Arc<Writer>,
|
||||
closed: Arc<AtomicBool>,
|
||||
) -> Self {
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
owner: owner.to_string(),
|
||||
writer,
|
||||
closed,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Lock for SqliteLockHandle {
|
||||
fn name(&self) -> &str {
|
||||
&self.name
|
||||
|
||||
Reference in new issue
Block a user