RDMA-Rust / sideway

A better wrapper for using RDMA programming APIs in Rust flavor
Mozilla Public License 2.0
1 stars 0 forks source link

[RFC] A iterator style poll CQ interface #18

Open FujiZ opened 2 weeks ago

FujiZ commented 2 weeks ago

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 commented 2 weeks ago

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 commented 6 days ago

https://github.com/RDMA-Rust/sideway/pull/22/commits/9e0c959cfac8a8128840aba9f6ae7850ba3c4cf6, 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.