[Bro-Dev] Broker status update

Matthias Vallentin vallentin at icir.org
Fri May 27 10:35:23 PDT 2016


> >         peer(x, y); // Create a peering between the two endpoints.
> >         peer(y, x); // Idempotent. Peerings are symmetric.
> 
> >         x.peer(y); // Create a peering between the two endpoints.
> >         y.peer(x); // Idempotent. Peerings are symmetric.
> 
> I would prefer the 2nd way for consistenct, as all the other
> operations use the method-based scheme. The idempotency seems
> secondary to that I would say.

Okay, after mulling over this a bit more, I think the second version
makes sense also for another reason: overloads. Both of these statements
should be valid:

    x.peer("127.0.0.1", 42000);
    x.peer(y);

With a free function, this becomes not as clear anymore.

> Related question: what exactly are the semantics if only one side of
> the peering is set up?

The peering occurs asynchronously. The function endpoint::peer returns
void, and when the peering result (failure/success) becomes available, a
dedicated status message will be enqueued in the endpoint's mailbox.
This message has to be extracted via endpoint::receive, or in the
asynchronous case, there needs to be handler for the status present
(otherwise the message gets dropped).

> Hmm ... I see the appeal but it would introduce a new dependency and
> its Python-specific (I assume), whereas with SWIG it's easier to add
> more languages later. Is that worth the benefit of switching?

We already need SWIG and its Python-specific bindings, which are two
separate packages. Since every language has its idiosyncrasies, it's
quite unwieldy to have one framework to rule them all. At least SWIG
feels not like a productive toolkit for modern C++.

Also, since pybind11 is a small header-only package, we can easily ship
it directly with Broker, which would render the existing package
dependencies obsolete. That is, we would not introducing a new
dependency, but remove two instead ;-).

That said, this is my impression after just briefly looking at the
bindings space. I'll perform a more thorough evaluation once I'll
actually start delving into writing the bindings.

    Matthias


More information about the bro-dev mailing list