feat(host): add object publication and dispatch
This commit is contained in:
@@ -65,3 +65,35 @@ The supported interface slice is deliberately non-generic: public traits,
|
||||
`&self`, named parameters, and `OperationResult<T>`. Generic traits or methods,
|
||||
associated items, custom lifetimes, inheritance, default method bodies, and
|
||||
other receiver forms are rejected at their source spans.
|
||||
|
||||
## Host publication and dispatch
|
||||
|
||||
Applications use `wip-host` to register generated definitions and explicitly
|
||||
choose the ordered interface set for each object publication:
|
||||
|
||||
```rust,ignore
|
||||
let mut interfaces = wip_host::InterfaceRegistry::new();
|
||||
let messenger = interfaces.register(MessengerDefinition, None)?;
|
||||
|
||||
let published = wip_host::PublishedObject::new(request_scoped_object)
|
||||
.expose(&messenger)?;
|
||||
let protocol_object = published.protocol_object();
|
||||
```
|
||||
|
||||
`expose` compiles only when the object implements the generated definition's
|
||||
interface trait. Implementing a trait does not expose it automatically, empty
|
||||
interface sets are valid, insertion order is preserved, and duplicate
|
||||
references are rejected. Registry references are opaque; descriptor names and
|
||||
Rust type names are not used as wire identity.
|
||||
|
||||
Dispatch is qualified by interface reference and operation name. The host checks
|
||||
current object identity and validator policy, current interface membership,
|
||||
interface validator, descriptor operation, arguments, and result while retaining
|
||||
the selected object and registered artifact. Host-private fields and backend
|
||||
handles are never projected by `WipObject`.
|
||||
|
||||
Providers remain responsible for backend atomicity. Enter a transaction, lock,
|
||||
stable-handle scope, or conditional-update primitive before constructing and
|
||||
dispatching the request-scoped `PublishedObject`, and retain it until dispatch
|
||||
returns. The runtime never validates one object and then resolves a second
|
||||
snapshot, but it cannot make an arbitrary external backend atomic by itself.
|
||||
|
||||
Reference in New Issue
Block a user