MCPcopy Create free account
hub / github.com/AimRT/AimRT / PbRpcHandleRefInvoke

Function PbRpcHandleRefInvoke

src/runtime/python_runtime/export_rpc.h:174–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174inline std::tuple<aimrt::rpc::Status, pybind11::bytes> PbRpcHandleRefInvoke(
175 aimrt::rpc::RpcHandleRef& rpc_handle_ref,
176 std::string_view func_name,
177 aimrt::rpc::ContextRef ctx_ref,
178 const std::string& req_buf) {
179 pybind11::gil_scoped_release release;
180
181 std::string rsp_buf;
182 std::promise<uint32_t> status_promise;
183
184 aimrt::rpc::ClientCallback callback([&status_promise](uint32_t status) {
185 status_promise.set_value(status);
186 });
187
188 rpc_handle_ref.Invoke(
189 func_name,
190 ctx_ref,
191 static_cast<const void*>(&req_buf),
192 static_cast<void*>(&rsp_buf),
193 std::move(callback));
194
195 auto fu = status_promise.get_future();
196 fu.wait();
197
198 pybind11::gil_scoped_acquire acquire;
199
200 return {aimrt::rpc::Status(fu.get()), pybind11::bytes(rsp_buf)};
201}
202
203inline void ExportRpcServiceBase(pybind11::object m) {
204 using aimrt::rpc::ServiceBase;

Callers

nothing calls this directly

Calls 2

StatusClass · 0.85
InvokeMethod · 0.45

Tested by

no test coverage detected