Skip to main content

FxpSimulator

Struct FxpSimulator 

Source
pub struct FxpSimulator {
    pub actors: BTreeMap<String, ActorState>,
    pub outbox: Vec<Message>,
    pub delivered: Vec<Message>,
    /* private fields */
}
Expand description

Barramento FXP simulado e determinístico.

Fields§

§actors: BTreeMap<String, ActorState>§outbox: Vec<Message>

Mensagens serializadas (todo comando, mesmo rejeitado).

§delivered: Vec<Message>

Entregas efetivadas (ator correto).

Implementations§

Source§

impl FxpSimulator

Source

pub fn new() -> Self

Source

pub fn set_sensor(&mut self, name: &str, value: f64)

Source

pub fn fail_sensor(&mut self, name: &str)

Sensor registrado porém inacessível (FORMAL §4.7).

Source

pub fn recover_sensor(&mut self, name: &str)

Source

pub fn unregister_sensor(&mut self, name: &str)

Remove sensor do registro (falha sensor_nao_registrado).

Source

pub fn schedule(&mut self, tick: u64, sensor: &str, value: f64)

Agenda valor absoluto para um tick (1-based).

Source

pub fn fail_actor(&mut self, name: &str)

Ator para de responder (heartbeat falho — BDD Caso 3).

Source

pub fn recover_actor(&mut self, name: &str)

Source

pub fn set_fallback(&mut self, primary: &str, alternativos: &[&str])

Política de fallback fica no REGISTRO do FXP (FORMAL §4.3).

Source

pub fn register_actor(&mut self, name: &str, limits: ActorLimits)

Registra ator extra (extensão opcional, ex.: ReserveFan).

Source

pub fn register_sensor(&mut self, name: &str, info: SensorInfo)

Registra (ou substitui) um sensor no registro/simulador — usado pelo bus da Etapa 3 para sincronizar o DeviceRegistry (fonte única) com o backend simulado; valor inicial plausível é 0.0 até roteirização.

Source

pub fn current_actor(&self, name: &str) -> Option<&Value>

Source

pub fn registry(&self) -> &Registry

Registro atual (sensores/atores + limites) — FORMAL §6.

Source

pub fn sensor_value(&self, name: &str) -> Option<f64>

Trait Implementations§

Source§

impl Clone for FxpSimulator

Source§

fn clone(&self) -> FxpSimulator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FxpSimulator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FxpSimulator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Fxp for FxpSimulator

Source§

fn read_sensor( &mut self, name: &str, ledger: &mut dyn Ledger, ) -> Result<f64, SensorFailure>

Leitura por nome simbólico. Falha → SensorFailure + alerta no Caderno (§4.7: sensor ausente NUNCA é 0.0 — zero é leitura física válida).
Source§

fn act( &mut self, actor: &str, value: Value, ledger: &mut dyn Ledger, ) -> ActOutcome

Comando a ator: serializa, valida limites (inclusivos) e entrega; o Caderno registra tentativa, falha e fallback (§4.3).
Source§

fn cpu_power(&self) -> f64

Potência global do tick (partilha P/N — FORMAL §4.2).
Source§

fn on_tick(&mut self, _ledger: &mut dyn Ledger)

Avanço do tick no mundo (roteirização do simulador; Etapa 3: também re-entrega a fila de comandos, auditada no Caderno).
Source§

fn disk_bytes_used(&self) -> u64

Bytes em suporte estável (persistência — FORMAL §4.1).
Source§

fn add_disk_bytes(&mut self, n: u64)

Source§

fn registry(&self) -> &Registry

Registro (para validação de referências em tempo de carga).
Source§

fn act_with_priority( &mut self, actor: &str, value: Value, priority: u8, ledger: &mut dyn Ledger, ) -> ActOutcome

Comando com prioridade de fila (Etapa 3): default ignora a prioridade e delega a Fxp::act — barramentos com fila prioritária (vbl-fxp) sobrescrevem. O engine usa PRIORITY_SUBVERT para a act que segue um subvert na mesma regra (FORMAL §4.5: sem atraso perceptível).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.