Prototype native Rust MXAccess worker

This commit is contained in:
Joseph Doherty
2026-11-21 08:25:33 -05:00
parent 30ac3f3225
commit 1a44b5ac31
9 changed files with 1840 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
# Rust MXAccess worker prototype
This crate exercises the gateway's existing worker contract with native 32-bit
Windows COM. Cargo generates the Rust protobuf types from the gateway's canonical
schemas at build time.
The worker authenticates the launch nonce, negotiates a frame limit, activates
LMXProxy on a dedicated message-pumping STA, and reports readiness and heartbeats.
It supports Register, Unregister, AddItem, RemoveItem, and the worker diagnostic
commands. Shutdown unregisters any remaining clients before releasing COM. The
existing C# worker is the gateway default.
COM connection points, event delivery, Advise, value and status conversion beyond
integer handles, writes, bulk commands, alarms, and record-info pinning remain to
be implemented. Unsupported commands return `InvalidRequest`. The prototype
serializes commands and does not interrupt COM calls on cancellation. If a call
exceeds the STA timeout, the worker faults the session and exits.
## Build and test
From this directory on Windows, with Rust, the x86 MSVC target and linker, and
`protoc` on PATH:
```powershell
cargo build --locked --release --target i686-pc-windows-msvc
cargo test --locked --target i686-pc-windows-msvc
```
On a development Windows host with 32-bit System Platform MXAccess registered,
run the opt-in test against a temporary pipe. Set
`MXGATEWAY_RUST_SMOKE_ITEM` to an item available in that host's Galaxy to include
AddItem and RemoveItem in the smoke test.
```powershell
$env:MXGATEWAY_RUST_SMOKE_ITEM = 'TestChildObject.TestInt'
cargo test --locked --target i686-pc-windows-msvc --test live_mxaccess -- --ignored
```
The smoke test starts and terminates its own worker and exercises the pipe
handshake, heartbeat, registration, item lifecycle when configured, and graceful
shutdown. It runs without a gateway service. Portable framing tests also run
with `cargo test --locked` on macOS and Linux.
## COM interface evidence
The native adapter uses the dual `ILMXProxyServer` interface from the installed
`ArchestrA.MxAccess` 3.2.0.0 assembly. REA inspection confirmed the declaration
order and managed signatures for Register, Unregister, AddItem, and RemoveItem.
Windows reflection confirmed the interface IID, dual-interface flag, DISPIDs, and
BSTR input annotations. The live test exercises the corresponding native calls.
- Assembly SHA-256
`cba8b607305ee0c70ca38b09eca645ae3b98c35a7b78ec051eb4381f48d9e0b1`
- REA managed member evidence
`ev_78053da509335e3e3749b8e6bb020f28c45255b54d910546659c6760eb52160b`