pub struct RecorderManager { /* private fields */ }Expand description
Owns and supervises the per-camera recorder tasks.
Implementations§
Source§impl RecorderManager
impl RecorderManager
pub fn new(pool: SqlitePool, cfg: Arc<Config>) -> Arc<Self>
Sourcepub async fn start_all(self: &Arc<Self>) -> Result<()>
pub async fn start_all(self: &Arc<Self>) -> Result<()>
Start recorders for all cameras that should record.
Sourcepub async fn reconcile(self: &Arc<Self>, camera_id: &str)
pub async fn reconcile(self: &Arc<Self>, camera_id: &str)
Reconcile a single camera’s recorder against its current DB state. Starts a recorder when the
camera should record AND its schedule says it should be recording now; otherwise stops it and
marks it idle. Always restarts a running recorder (config may have changed) — callers that
must not churn an actively-recording camera should use Self::reconcile_schedules.
Sourcepub async fn eval_schedule(&self, camera_id: &str) -> bool
pub async fn eval_schedule(&self, camera_id: &str) -> bool
Whether camera_id should be recording at this instant per its record_mode + schedule,
IGNORING event triggers (those are handled by the event supervisor / Self::trigger):
continuousis always on.scheduled/scheduled_eventare on only inside an enabled time-of-day window for today’s weekday, evaluated against the SERVER’s LOCAL timezone (chrono::Local), with overnight wrap.event(and any unknown mode) has no time-based recording, so it is off here; it records only while a trigger window is active.
Sourcepub async fn reconcile_schedules(self: &Arc<Self>)
pub async fn reconcile_schedules(self: &Arc<Self>)
Reconcile only the pure scheduled cameras whose recording state must change because their
window just opened or closed. Called periodically by the schedule watcher. Cameras already in
the correct state are left untouched, so an actively-recording camera is never restarted
mid-window. scheduled_event is deliberately excluded: those tasks are always ARMED and the
event supervisor opens/closes their window itself (so the watcher must not churn them).
Sourcepub async fn stop(self: &Arc<Self>, camera_id: &str)
pub async fn stop(self: &Arc<Self>, camera_id: &str)
Stop a camera’s recorder task, killing its FFmpeg process. Returns only once the task is actually gone (aborting it if it does not stop promptly).
Sourcepub async fn active_ids(&self) -> Vec<String>
pub async fn active_ids(&self) -> Vec<String>
Camera ids currently being supervised.
Sourcepub async fn trigger(
&self,
camera_id: &str,
reason: &str,
) -> Option<DateTime<Utc>>
pub async fn trigger( &self, camera_id: &str, reason: &str, ) -> Option<DateTime<Utc>>
Fire an event recording trigger for a camera: extend its trigger window to
now + post_roll_seconds (repeated triggers keep the later end). No-op (returns None) for a
camera that is not event / scheduled_event, is not recording-enabled, or has no armed task
(e.g. the recorder is globally disabled). Returns the resulting window end. Cheap and
idempotent — safe to call on every zone/breach event.
Auto Trait Implementations§
impl !Freeze for RecorderManager
impl !RefUnwindSafe for RecorderManager
impl !UnwindSafe for RecorderManager
impl Send for RecorderManager
impl Sync for RecorderManager
impl Unpin for RecorderManager
impl UnsafeUnpin for RecorderManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more