RDMA-Rust / sideway

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

feat(cq): implement builder for cq_ex #9

Closed FujiZ closed 2 months ago

FujiZ commented 2 months ago

A draft about using builder pattern to create cq

FujiZ commented 2 months ago

Ref #8

dragonJACson commented 2 months ago

And do we need to provide a generic CQ builder? Like provide a create_ex boolean to let user decide whether normal ibv_cq or ibv_cq_ex should be created, thus we can use a single API for both situations. Though the problem is that some of the attributes in the cq_init_attr would be ignored when use ibv_create_cq, as it doesn't support them.

FujiZ commented 2 months ago

And do we need to provide a generic CQ builder? Like provide a create_ex boolean to let user decide whether normal ibv_cq or ibv_cq_ex should be created, thus we can use a single API for both situations. Though the problem is that some of the attributes in the cq_init_attr would be ignored when use ibv_create_cq, as it doesn't support them.

I think a generic CQ builder is a good idea, but it seems impossible to let the user choose the concrete type of CQ by specifing a boolean parameter, since cq and cq_ex will be wrapped by different struct, and we are not able to return different types from a single build method. Maybe using different method for creating cq and cq_ex (e.g. build and build_ex will be more viable.

BTW, I think it would be helpful to introduce a trait for CQ so that we can use the trait to create other resources (e.g. QP) rather than specifing a concrete type of cq or cq_ex.