pub struct ParentalStore { /* private fields */ }Expand description
Protected installation-level parental policies and conservative usage ledger.
Implementations§
Source§impl ParentalStore
impl ParentalStore
Sourcepub fn check_schedule(
&self,
owner: &str,
now: u64,
media: &Media,
) -> Result<(), String>
pub fn check_schedule( &self, owner: &str, now: u64, media: &Media, ) -> Result<(), String>
Recheck current category and clock windows without spending an existing grant twice.
Sourcepub fn status(
&self,
owner: &str,
now: u64,
media: &Media,
) -> Result<Status, String>
pub fn status( &self, owner: &str, now: u64, media: &Media, ) -> Result<Status, String>
Inspect only one owner’s policy and reserved/settled local calendar budgets.
Sourcepub fn reserve(
&mut self,
owner: &str,
lease_id: &str,
media: Media,
requested_seconds: u32,
now: u64,
) -> Result<LeaseGrant, String>
pub fn reserve( &mut self, owner: &str, lease_id: &str, media: Media, requested_seconds: u32, now: u64, ) -> Result<LeaseGrant, String>
Reserve at most ten seconds before audio is admitted. The caller saves before granting. Overlapping transports share temporal coverage rather than spending their duration twice.
Sourcepub fn settle(
&mut self,
owner: &str,
lease_id: &str,
consumed_ms: u64,
now: u64,
close: bool,
) -> Result<(), String>
pub fn settle( &mut self, owner: &str, lease_id: &str, consumed_ms: u64, now: u64, close: bool, ) -> Result<(), String>
Confirm cumulative consumed milliseconds and close/refund only future activity. Already elapsed time under an active grant is never refunded by a client’s counter. Expired reservations stay fully charged; a crash or late client cannot regain their budget.
Source§impl ParentalStore
impl ParentalStore
Sourcepub fn load(path: &Path) -> Result<Self, String>
pub fn load(path: &Path) -> Result<Self, String>
Load a private regular document; only initial absence yields an empty store.
Sourcepub fn load_optional(path: &Path) -> Result<Option<Self>, String>
pub fn load_optional(path: &Path) -> Result<Option<Self>, String>
Distinguish initial absence from a present private document at the read boundary. Servers can latch observed presence and refuse a subsequent disappearance.
Sourcepub fn save(&self, path: &Path) -> Result<(), String>
pub fn save(&self, path: &Path) -> Result<(), String>
Publish one validated replacement atomically; the caller holds StoreLock.
Sourcepub fn policy(&self, owner: &str) -> PolicySnapshot
pub fn policy(&self, owner: &str) -> PolicySnapshot
Return only the selected owner’s policy, including explicit unrestricted defaults.
Sourcepub fn set_policy(
&mut self,
owner: &str,
policy: Policy,
expected_revision: u64,
) -> Result<PolicySnapshot, String>
pub fn set_policy( &mut self, owner: &str, policy: Policy, expected_revision: u64, ) -> Result<PolicySnapshot, String>
Replace an administrator-approved policy without altering credentials or opinions.
Sourcepub fn set_policy_by(
&mut self,
owner: &str,
administrator: Option<&str>,
policy: Policy,
expected_revision: u64,
) -> Result<PolicySnapshot, String>
pub fn set_policy_by( &mut self, owner: &str, administrator: Option<&str>, policy: Policy, expected_revision: u64, ) -> Result<PolicySnapshot, String>
Apply an authenticated administrator’s edit and claim/release its exclusive lock. Legacy unclaimed rules may be claimed; a local token cannot override a named owner.
Sourcepub fn supervises(&self, administrator: &str) -> bool
pub fn supervises(&self, administrator: &str) -> bool
Whether an administrator still owns at least one active supervision lock.
Trait Implementations§
Source§impl Clone for ParentalStore
impl Clone for ParentalStore
Source§fn clone(&self) -> ParentalStore
fn clone(&self) -> ParentalStore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more