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

AFIO-like connection interface #66

Open
tgockel opened this issue Jan 19, 2018 · 1 comment
Open

AFIO-like connection interface #66

tgockel opened this issue Jan 19, 2018 · 1 comment

Comments

@tgockel
Copy link
Owner

tgockel commented Jan 19, 2018

The connection system is a very basic adapter layer to the ZK C API which essentially does everything in a 1:1 manner. This isn't the most wonderful system in the world. A more ideal system would be something AFIO-like (think Linux syscalls __NR_io_setup, __NR_io_destroy, __NR_io_submit, __NR_io_getevents). The real goal is to make the system pollable so users can plug ZK bindings into epoll-driving application frameworks.

class connection
{
public:
    using native_handle_type = int;

    virtual native_handle_type native_handle() = 0;

    virtual void submit(operation) = 0;

    virtual std::size_t receive(ptr<result> out, std::size_t out_size) = 0;

    /** Try to receive a single result from the system. **/
    optional<result> try_receive_one();
};

Ultimately, this puts more of a burden on the client implementation, but given that every call in it is currently just _conn->do_thing(args...), that's probably okay. The general idea is that callbacks, state changes, and watches are a problem of a client, but not of the low-level connection.

@tgockel
Copy link
Owner Author

tgockel commented Mar 1, 2018

So it turns out that either this is a bad idea or I'm going about it completely wrong. I'm moving this to the backburner for future consideration.

@tgockel tgockel removed their assignment Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant