Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flux API: replace zmsg_t with new opaque type #168

Closed
garlick opened this issue Apr 24, 2015 · 7 comments
Closed

Flux API: replace zmsg_t with new opaque type #168

garlick opened this issue Apr 24, 2015 · 7 comments

Comments

@garlick
Copy link
Member

garlick commented Apr 24, 2015

The Flux API should not include parameters of type zmsg_t as this forces a czmq/zmq dependency on all users and forgoes some opportunities for optimization of common Flux use cases (such as matching topic sub-strings) within the message class. Instead introduce a new opaque type flux_msg_t (or similar) and revise API to use that instead.

This is an opportunity to refine the message API and so let's agree on interfaces here before proceeding. The low-level headers in question are

src/common/libflux/message.h
src/common/libflux/request.h
src/common/libflux/handle.h
src/common/libflux/event.h
src/common/libflux/reactor.h

Other interfaces built on these may have to change too but let's tackle the low level first.

@garlick
Copy link
Member Author

garlick commented Apr 24, 2015

See issue #124 for some discussion on reactor API revision

@garlick
Copy link
Member Author

garlick commented Apr 24, 2015

The fact that zmsg_send() takes a (zmsg_t **) and destroys it on success has proliferated though the API. @grondo and I had discussed changing this so that messages are not destroyed by the send function.

@grondo
Copy link
Contributor

grondo commented Apr 24, 2015

Ah yes. This tripped me up because at one point I was trying to save a zmsg_t so that I could send multiple replies to the same sender. If we had a more natural way to connect two endpoints for a multiple message conversation, that issue at least would be resolved. (It is possible, though that in this case i was just doing it wrong) 😦

@garlick
Copy link
Member Author

garlick commented Apr 24, 2015

I'm for losing that idiom. There are few places where we do things like send a response if the zmsg hasn't been destroyed in a request handler and this just gets confusing.

@trws
Copy link
Member

trws commented Apr 27, 2015

I agree, that particular idiom is rather obtuse. How best to deal with it I'm not sure though. Duplicating the message every time it gets passed to CZMQ doesn't feel like the right answer, but I'm not sure there's another one.

I'm putting together a meta-issue for the public API issues at #170.

@garlick
Copy link
Member Author

garlick commented Apr 28, 2015

Thanks @trws for your work on the trackers and milestones.

zmsg_send() can be avoided by building on a lower level function like:

int zmq_send (void *socket, void *buf, size_t len, int flags);

I think that'd be the way to squash the behavior without having to zmsg_dup() messages.

@garlick
Copy link
Member Author

garlick commented Jun 12, 2015

PR #219 solved this for libflux-core. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants