tractor icon indicating copy to clipboard operation
tractor copied to clipboard

Toying with a message type for "object references"

Open goodboy opened this issue 3 years ago • 1 comments

As a future requirement and probably large convenience for many users looking to "pass around remote python objects" (in a message native way) in actors (https://github.com/goodboy/tractor/issues/191, https://github.com/goodboy/tractor/issues/5) i've started toying with some ideas for making a built-in message-serialization compatible type that we can offer as part of our public sugar apis.

The main set of tools include

  • msgpack type extensions (since that's our only official codec atm):
    • https://jcristharif.com/msgspec/extending.html
      • alternatively we could go full struct style https://jcristharif.com/msgspec/api.html#struct
    • https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type
  • the new pkgutils.resolve_name() resolver in py 3.9

I have a draft implementation for a str derivative which gets us a nice compact api for conversion between str and object references and could likely be integrated with our enable_modules:list[str] "module capability per actor" system to get us moving in the cap-based-sec direction.

I'll put up a matching PR shortly 😎

goodboy avatar Jan 27 '22 18:01 goodboy

Also added a couple todo lists in the module for any aspiring messageers to have a go at 😉

goodboy avatar Jan 30 '22 17:01 goodboy