Rework low-level-runtime to enforce a msgspec
-defined, SC-supervision-protocol for IPC Context
s #7
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "runtime_to_msgspec"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Now rebase-synced and up to date / ready for merge!
Synopsis
This is a heavy rework and refinement of the internal runtime to use a new
msgspec.Struct
derived message-set to encapsulate all RPC dialogs, i.e.trio.Task
-level IPC messaging, in a rigorous “SC-transitive supervision protocol”; a strict set of message-types now enforce that RPC transactions/dialogs between parallel executing tasks adhere to a WIP SC-applied-to-RPC protocol specification.Such a thing was previously desired/described in,
High level concept(s) summary
a new IPC msg set defined in
.msg.types
which are required to encapsulate any actor-runtime-related IPC msg-packet exchange between actor tasks.the type hierarchy is from a
MsgType[msgspec.Struct]
and subsequent derivedPayloadMsg[PayloadT]
which are msgs which encapsulate a “payload” field:PayloadMsg.pld: msgspec.Raw
:use of
Raw
is so thattractor
application code can declare a type-spec for various RPC payload msgs which then limits the allowed types for.pld: MyType1|MyType2
IPC ctx endpoints can now declare a new
@tractor.context(pld_spec=MyType1|MyType2)
which then configures an underlyingtractor.msg._ops.PldRx
: a so called “payload receiver” which is configured to thetractor.Context
currently in use/scope (read bytractor.current_ipc_ctx()
)the reason to have a separate
PldRx.pld_dec: MsgDec
is that it has the job of decoding the “payloads from user code” as defined by anypld_spec: Union[Type]
defined on the ctx-endpoint (as above).further, in the future this allows us to let user code define a msg-state-machine as needed throughout the lifetime of a
Portal.open_context()
call such that you can write very pedantic and dynamic IPC msg-flows if needed say within aContext.open_stream()
phase - user code can define their sub-msg-spec throughout the IPC dialog.a fairly serious rework of the core RPC-msg-processing-loop to only expect and allow this
MsgType
set on the wire guaranteeing that any IPCContext
adheres to SC from initialStart
,Started[PayloadT]
request to finalError[Exception|ContextCancelled]|Return[PayloadT]
as part of this moving the core RPC machinery to a new
tractor._rpc
isolating it from the._runtime.Actor
-primitive code which is it’s main task-parent and caller.integrating various IPC msgs with our
._exceptions.RemoteActorError
that remote errors and “inceptions” are relayed in a consistent, boxed approach via._exceptions.[un]pack_error()
.and a new
MsgTypeError
(MTE) such that the._ipc.Channel/MsgTransport
layer can block nonMsgType
msgs before they reach user code which instead will raise an MTE indicating the violation in the.msg.types
sense.similarly
MsgTypeError
will be raised by the currentPldRx
based on the configured pld-spec further preventing bad IPC deliveredPayloadT
input from ever reaching user (app) code.TODOs: docs, diagrams and follow-ups detailing the mechanics
msgspec
set# TODO
throughout the latest code (likely taken from #19) and broken into follow up issues!f2ce4a3
, timeout bump322e015d
Fix `mk_codec()` input arg77a15eb
use `DebugStatus` in `._rpc`goodboy referenced this pull request from pikers/piker2025-02-18 22:06:10 +00:00
3d12a7e005
to5a0524641a
5a0524641a
to904d8ce8ff
runtime_to_msgspec..to Rework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sRework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sto Rework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sRework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sto Rework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sRework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sto Rework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`s904d8ce8ff
to4b92e14c92
Rework entire runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sto Rework low-level-runtime to enforce a `msgspec`-defined, SC-supervision-protocol for IPC `Context`sWell if @guille approves..