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

[RFC] A iterator style poll CQ interface #18

Open
FujiZ opened this issue Sep 1, 2024 · 2 comments
Open

[RFC] A iterator style poll CQ interface #18

FujiZ opened this issue Sep 1, 2024 · 2 comments

Comments

@FujiZ
Copy link
Contributor

FujiZ commented Sep 1, 2024

Consider defining an iterator style poll CQ interface, which is more idiomatic and may be able to unify the old-style ibv_poll_cq interface with the new ibv_start_poll interface.

// create a iterator on cq; maybe we can pass some parameters to it
let mut iter = cq.poll();
// get one wc from the iterator
let wc = iter.next().unwrap();
// access the fields in wc through methods; 
let wr_id = wc.wr_id();
// for new-style poll interface, drop iterator will invoke `ibv_end_poll`
drop(iter);
@FujiZ
Copy link
Contributor Author

FujiZ commented Sep 2, 2024

We may need to return a reference to the WorkCompletion in this case, so https://stackoverflow.com/questions/68606470/how-to-return-a-reference-when-implementing-an-iterator might be helpful.

@dragonJACson
Copy link
Contributor

9e0c959, for cq_ex, there is no real WorkCompletion object, all wr_id, opcode things are got from cq_ex or function calls.

That would be pretty different for basic cq.

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

2 participants