PhotonLibOS icon indicating copy to clipboard operation
PhotonLibOS copied to clipboard

It would be great if it supports various clients, such as grpc, redis, mysql..

Open jiangdongzi opened this issue 11 months ago • 4 comments

Hah..it's nearly an impossible thing. :D.

jiangdongzi avatar Feb 27 '24 06:02 jiangdongzi

gRPC had been talked before, but there were no actual needs. gRPC has async client/server API, which might be working with Photon together.

Do you know if the other two have the equivalents?

beef9999 avatar Feb 28 '24 14:02 beef9999

gRPC had been talked before, but there were no actual needs. gRPC has async client/server API, which might be working with Photon together.

Do you know if the other two have the equivalents?

If we use gRPC async api, then we go back callback mechanism.. redis-plus-plus have async api and partially support c++20 coroutine

jiangdongzi avatar Mar 01 '24 06:03 jiangdongzi

gRPC had been talked before, but there were no actual needs. gRPC has async client/server API, which might be working with Photon together.

Do you know if the other two have the equivalents?

Or you mean, call gRPC async then suspend photon and later resume photon in gRPC callback?

jiangdongzi avatar Mar 01 '24 07:03 jiangdongzi

gRPC had been talked before, but there were no actual needs. gRPC has async client/server API, which might be working with Photon together. Do you know if the other two have the equivalents?

Or you mean, call gRPC async then suspend photon and later resume photon in gRPC callback?

Yes, you can use eventfd to communicate between Photon thread and gRPC loop thread, by using Photon's wait_for_fd API.

Or you can pass a Photon semaphore into gRPC's call back and do semaphore.Wait in your caller thread.

The main reason is that gRPC does not allow to run on an external event loop by far.

beef9999 avatar Mar 01 '24 07:03 beef9999

@jiangdongzi https://github.com/alibaba/PhotonLibOS/pull/424 can be potentially used for redis-cpp

lihuiba avatar Mar 23 '24 03:03 lihuiba