pub struct Coordinator {
pub threads: Vec<BThread>,
pub roles: Vec<Role>,
pub partitions: Vec<PartitionDef>,
pub active_locks: HashMap<String, ActiveLock>,
pub event_log: Vec<TimestampedEvent>,
}Expand description
The b-thread coordinator.
Fields§
§threads: Vec<BThread>§roles: Vec<Role>§partitions: Vec<PartitionDef>§active_locks: HashMap<String, ActiveLock>§event_log: Vec<TimestampedEvent>Implementations§
Source§impl Coordinator
impl Coordinator
Sourcepub fn new() -> Coordinator
pub fn new() -> Coordinator
Create an empty coordinator.
Sourcepub fn expire_locks(&mut self)
pub fn expire_locks(&mut self)
Expire any locks that have exceeded their TTL.
Sourcepub fn evaluate(&self, event: &Event) -> Decision
pub fn evaluate(&self, event: &Event) -> Decision
Core evaluation: given a proposed event, check all b-threads.
Evaluation order (by b-thread priority, then rule type): BlockAlways -> Role check -> Partition -> Mutex -> Require -> BlockUntil -> RateLimit -> Timeout
Returns the first blocking/waiting decision found.
Sourcepub fn evaluate_full(&self, event: &Event) -> Decision
pub fn evaluate_full(&self, event: &Event) -> Decision
Full evaluation including role checks.
Sourcepub fn record(&mut self, event: &Event) -> Result<(), Error>
pub fn record(&mut self, event: &Event) -> Result<(), Error>
Record that an event occurred. Updates locks, appends to event log.
Trait Implementations§
Source§impl Default for Coordinator
impl Default for Coordinator
Source§fn default() -> Coordinator
fn default() -> Coordinator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Coordinator
impl RefUnwindSafe for Coordinator
impl Send for Coordinator
impl Sync for Coordinator
impl Unpin for Coordinator
impl UnsafeUnpin for Coordinator
impl UnwindSafe for Coordinator
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
Mutably borrows from an owned value. Read more