Invoking of Inspector function,

52 views
Skip to first unread message

Saravanan Palanisamy

unread,
Nov 25, 2019, 8:44:25 AM11/25/19
to actor-framework
Hello,

I started working with C++ Actor framework very recently for one of my projects.  I came across type inspector example. I could not understand when and where is the serialization is happening in the example by invoking inspector function?

Dominik Charousset

unread,
Nov 25, 2019, 4:40:27 PM11/25/19
to actor-f...@googlegroups.com
Hi,

> I started working with C++ Actor framework very recently for one of my projects. I came across type inspector example. I could not understand when and where is the serialization is happening in the example by invoking inspector function?

do you mean the examples under examples/custom_type?

Generally, CAF uses the inspect-API for string conversion of user-defined types, serializing messages into a byte buffer for sending them over the network, or deserializing received messages from received bytes. The serialization usually takes place in CAF’s networking component. In-process communication in a single actor system does not trigger any serialization.

Hope that helps,
Dominik

Alexander Gagarin

unread,
Nov 26, 2019, 1:15:43 AM11/26/19
to actor-framework
Hi, Dominik!


In-process communication in a single actor system does not trigger any serialization.

But still, all types that are put into messages required to be inspectable/serializable, right? I suppose this is due to stringification inspector always trying to at least validate convertion of every passed message to string.

For example, I found that if I whitelist some of my types as unsafe and remove (make inaccessible) serialization code for them, then stringification inspector still tries to inspect 'em and fails with super-magic compile error that originates from header (!) files =)

Dominik Charousset

unread,
Nov 27, 2019, 3:11:25 PM11/27/19
to actor-f...@googlegroups.com
> In-process communication in a single actor system does not trigger any serialization.
>
> But still, all types that are put into messages required to be inspectable/serializable, right? I suppose this is due to stringification inspector always trying to at least validate convertion of every passed message to string.
>
> For example, I found that if I whitelist some of my types as unsafe and remove (make inaccessible) serialization code for them, then stringification inspector still tries to inspect 'em and fails with super-magic compile error that originates from header (!) files =)

Uh, you shouldn’t get compiler errors. The stringification inspector should fall back to producing “<unprintable>” strings for everything not offering inspect() or to_string(). Do you have a minimal example that reproduces a compiler error? That’d be great!

Dominik

Alexander Gagarin

unread,
Nov 29, 2019, 6:41:45 AM11/29/19
to actor-framework

Uh, you shouldn’t get compiler errors. The stringification inspector should fall back to producing “<unprintable>” strings for everything not offering inspect() or to_string(). Do you have a minimal example that reproduces a compiler error? That’d be great!

I double checked the code and have to say that I wasn't correct.

The type I had troubles with is `boost::uuid`. And I actually didn't whitelist it, just removed headers with it's custom serialization code.
Then, as far as I understand, stringification inspector treats UUID as 'container' (because it provides `begin/end`), tries to unwind it and fails at line 263 of 'data_processor.hpp' on this sentence:
`
xs.clear();
`
because `boost::uuid` don't have `clear()` method.
Reply all
Reply to author
Forward
0 new messages