MCPcopy Create free account
hub / github.com/hashintel/hash / rpc_router

Function rpc_router

libs/@local/graph/api/src/rpc/mod.rs:66–96  ·  view source on GitHub ↗
(
    dependencies: Dependencies<S, C>,
    notifications: N,
)

Source from the content-addressed store, hash-verified

64}
65
66pub fn rpc_router<S, C, N>(
67 dependencies: Dependencies<S, C>,
68 notifications: N,
69) -> (
70 Router<impl Route<RequestBody, ResponseBody: Send, Future: Send> + Send>,
71 Task<Account, N>,
72)
73where
74 S: StorePool + Send + Sync + 'static,
75 C: ReportEncoder + ReportDecoder + Clone + Send + Sync + 'static,
76 for<'p> S::Store<'p>: PrincipalStore,
77{
78 let builder = RouterBuilder::new(dependencies.codec)
79 .with_builder(|builder| {
80 builder
81 .layer(HandleReportLayer::new())
82 .layer(HandleBodyReportLayer::new())
83 })
84 .register(AuthenticationDelegate::new(AuthenticationServer))
85 .register(AccountDelegate::new(AccountServer {
86 store_pool: dependencies.store,
87 temporal_client: dependencies.temporal_client,
88 }))
89 .register(EchoDelegate::new(EchoServer));
90
91 let task = builder.background_task(notifications);
92
93 let router = builder.build();
94
95 (router, task)
96}

Callers 1

start_rpc_serverFunction · 0.85

Calls 5

with_builderMethod · 0.80
background_taskMethod · 0.80
registerMethod · 0.45
layerMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected