isocontract

    Object contract kernel for Isochronon

    contract
    fieldbus
    moonbit
    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    3 months ago
    Downloads
    49

    #IsoContract

    mokomoking2501/isocontract is the local Object Contract package for Isochronon. It owns protocol-neutral object contracts, binding records, contract lint, and trace-backed object monitoring.

    ///|
    test "axis contracts lint" {
    let registry = axis_authority_contracts()
    assert_true(registry.lint().passes())
    }

    ContractIngestError

    pub(all) suberror ContractIngestError {
    ParseFailed(String)
    MissingField(String)
    InvalidField(String, String)
    } derive(
    Debug
    )

    Authority

    pub(all) enum Authority {
    Any
    ReadOnly
    Role(String)
    } derive(Eq,
    Debug
    )

    Authority::allows

    fn Authority::allows(self : Authority, node_id : String) -> Bool

    Authority::label

    fn Authority::label(self : Authority) -> String

    BindingKind

    pub(all) enum BindingKind {
    TraceLabel
    EtherCatPdo
    CoeSdo
    CanopenSdo
    CanopenPdo
    ZenohKey
    ModbusRegister
    } derive(Eq,
    Debug
    )

    BindingKind::label

    fn BindingKind::label(self : BindingKind) -> String

    ContractLintIssue

    pub(all) struct ContractLintIssue {
    object_id : String?
    binding_id : String?
    message : String
    } derive(Eq,
    Debug
    )

    ContractLintReport

    pub(all) struct ContractLintReport {
    issues : Array[ContractLintIssue]
    } derive(Eq,
    Debug
    )

    ContractLintReport::passes

    fn ContractLintReport::passes(self : ContractLintReport) -> Bool

    ContractRegistry

    pub(all) struct ContractRegistry {
    objects : Array[ObjectContract]
    } derive(
    Debug
    )

    ContractRegistry::contains_object

    fn ContractRegistry::contains_object(self : ContractRegistry, object_id : String) -> Bool

    ContractRegistry::copy

    ContractRegistry::lint

    ContractRegistry::new

    ContractRegistry::register

    fn ContractRegistry::register(self : ContractRegistry, contract : ObjectContract) -> Unit

    ContractRegistry::with_object

    fn ContractRegistry::with_object(self : ContractRegistry, contract : ObjectContract) -> ContractRegistry

    ObjectBinding

    pub(all) struct ObjectBinding {
    object_id : String
    binding_id : String
    medium_id : String
    label : String
    direction :
    TraceDirection
    ?
    kind : BindingKind
    index : UInt?
    subindex : Byte?
    channel : String
    key : String
    authority : Authority
    } derive(Eq,
    Debug
    )

    ObjectBinding::make

    fn ObjectBinding::make(object_id~ : String, binding_id~ : String, medium_id? : String, label~ : String, direction? :
    TraceDirection
    , kind? : BindingKind, index? : UInt, subindex? : Byte, channel? : String, key? : String, authority? : Authority) -> ObjectBinding

    ObjectBinding::matches

    ObjectClockRequirement

    pub(all) enum ObjectClockRequirement {
    AnyClock
    PhysicalClock
    } derive(Eq,
    Debug
    )

    ObjectClockRequirement::label

    ObjectContract

    pub(all) struct ObjectContract {
    id : String
    kind : ObjectKind
    schema : Schema
    timing : TimingContract
    safety : SafetyContract
    bindings : Array[ObjectBinding]
    } derive(Eq,
    Debug
    )

    ObjectContract::make

    fn ObjectContract::make(id~ : String, kind~ : ObjectKind, schema~ : Schema, timing~ : TimingContract, safety~ : SafetyContract) -> ObjectContract

    ObjectContract::with_binding

    fn ObjectContract::with_binding(self : ObjectContract, binding : ObjectBinding) -> ObjectContract

    ObjectKind

    pub(all) enum ObjectKind {
    Signal
    Command
    Query
    Event
    Lifecycle
    } derive(Eq,
    Debug
    )

    ObjectKind::label

    fn ObjectKind::label(self : ObjectKind) -> String

    ObjectMonitor

    pub(all) struct ObjectMonitor {
    registry : ContractRegistry
    } derive(
    Debug
    )

    ObjectMonitor::new

    ObjectMonitorAssessment

    pub(all) struct ObjectMonitorAssessment {
    object_report : ObjectMonitorReport
    timeout_action_observation_count : Int
    timeout_action_evaluations : Array[ObjectTimeoutActionEvaluation]
    timeout_action_matched_count : Int
    timeout_action_missing_count : Int
    timeout_action_mismatch_count : Int
    timeout_action_duplicate_count : Int
    timeout_action_orphan_count : Int
    } derive(Eq,
    Debug
    )

    ObjectMonitorAssessment::passes

    ObjectMonitorReport

    pub(all) struct ObjectMonitorReport {
    checked_events : Int
    violations : Array[ObjectViolation]
    } derive(Eq,
    Debug
    )

    ObjectMonitorReport::passes

    fn ObjectMonitorReport::passes(self : ObjectMonitorReport) -> Bool

    ObjectTimeoutActionEvaluation

    pub(all) struct ObjectTimeoutActionEvaluation {
    object_id : String
    trigger_event_id : Int
    expected_action : String
    observed_action : String
    observation_count : Int
    status : ObjectTimeoutActionStatus
    } derive(Eq,
    Debug
    )

    ObjectTimeoutActionObservation

    pub(all) struct ObjectTimeoutActionObservation {
    object_id : String
    trigger_event_id : Int
    action : String
    } derive(Eq,
    Debug
    )

    ObjectTimeoutActionObservation::make

    fn ObjectTimeoutActionObservation::make(object_id~ : String, trigger_event_id~ : Int, action~ : String) -> ObjectTimeoutActionObservation

    ObjectTimeoutActionStatus

    pub(all) enum ObjectTimeoutActionStatus {
    TimeoutActionMatched
    TimeoutActionMissing
    TimeoutActionMismatch
    TimeoutActionDuplicate
    TimeoutActionOrphan
    } derive(Eq,
    Debug
    )

    ObjectTimeoutActionStatus::label

    ObjectViolation

    pub(all) struct ObjectViolation {
    kind : ObjectViolationKind
    object_id : String
    event_id : Int?
    reason : String
    } derive(Eq,
    Debug
    )

    ObjectViolationKind

    pub(all) enum ObjectViolationKind {
    AuthorityViolation
    TimingViolation
    PayloadRangeViolation
    TerminalFaultViolation
    } derive(Eq,
    Debug
    )

    ObjectViolationKind::label

    fn ObjectViolationKind::label(self : ObjectViolationKind) -> String

    SafetyContract

    pub(all) struct SafetyContract {
    authority : Authority
    min_payload_digest : Int?
    max_payload_digest : Int?
    timeout_action : String
    } derive(Eq,
    Debug
    )

    SafetyContract::make

    fn SafetyContract::make(authority? : Authority, min_payload_digest? : Int, max_payload_digest? : Int, timeout_action? : String) -> SafetyContract

    Schema

    pub(all) enum Schema {
    Bool
    I8
    I32
    U16
    State
    Text
    } derive(Eq,
    Debug
    )

    Schema::label

    fn Schema::label(self : Schema) -> String

    TimingContract

    pub(all) struct TimingContract {
    period_ns : Int64?
    max_age_ns : Int64?
    deadline_ns : Int64?
    valid_for_ns : Int64?
    clock_requirement : ObjectClockRequirement
    } derive(Eq,
    Debug
    )

    TimingContract::empty

    TimingContract::make

    fn TimingContract::make(period_ns? : Int64, max_age_ns? : Int64, deadline_ns? : Int64, valid_for_ns? : Int64, clock_requirement? : ObjectClockRequirement) -> TimingContract

    axis_authority_contracts

    fn axis_authority_contracts() -> ContractRegistry

    package_id

    fn package_id() -> String

    parse_contract_registry_json

    fn parse_contract_registry_json(text : String) -> ContractRegistry raise ContractIngestError

    parse_contract_registry_text

    fn parse_contract_registry_text(text : String) -> ContractRegistry raise ContractIngestError

    parse_contract_registry_yaml

    fn parse_contract_registry_yaml(text : String) -> ContractRegistry raise ContractIngestError

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io