[nanomsg] Re: Bindings for Golang

  • From: Örjan Persson <o@xxxxxxxx>
  • To: Martin Sustrik <sustrik@xxxxxxxxxx>
  • Date: Tue, 14 May 2013 08:58:21 -0700

On Mon, May 13, 2013 at 11:25 PM, Martin Sustrik <sustrik@xxxxxxxxxx> wrote:
> Btw, I've written a blog post with some tips for writing nanomsg bindings.
> If you haven't seen it, maybe it'll help in some minor way:
>
> http://www.250bpm.com/blog:21

Ah, looks very similar to the document[1] I've followed so far. ;)

[1] http://nanomsg.org/development-bindings.html

I actually had a couple of questions but I figured I dig and
experiment some myself first before asking. But anyway, here it goes;

Where can I find more information about the domain? Is SP_RAW only
useful when you want to create a new protocol? As it is now, I've
hidden that from the user except when calling NewSocket. Eg. for a pub
socket, you call NewPubSocket, and there's no way to specify either
the domain or the protocol. I've been thinking of removing it from
NewSocket too, and expose a NewRawSocket method. Feels like not a lot
of users will use the raw socket if they're intended as I understand
it. In the bindings I've created, a user could still use the returned
raw socket and wrap it up as a pub socket, eg.
&nanomsg.PubSocket{rawSocket}, giving the user the possibility to do
whatever a "normal" pub socket can do.

The document mentioned pitfalls for zero-copy. I am utilizing
zero-copy. I didn't want to ask before because I haven't decided if I
like it or not. From some very non-scientifically benchmarks, the
overhead of adding what Go calls "finalizer" (basically a destructor)
is higher than allocating the memory when the message is <1k.

And my final question was about poller. There won't be a poller
similar to the one exposed in zmq? My next item on my TODO list is to
try to integrate the file descriptors into Go somehow. I hope it's
possible. :)

> Also, I'll add the link to your binding to the website.

Oh, sweet!

Other related posts: