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

Function start_server

apps/hash-graph/src/subcommand/server.rs:315–354  ·  view source on GitHub ↗

Starts the main graph API server (REST + optional RPC).

(
    pool: S,
    config: ServerConfig,
    query_logger: Option<QueryLogger>,
    lifecycle: &ServerLifecycle,
)

Source from the content-addressed store, hash-verified

313
314/// Starts the main graph API server (REST + optional RPC).
315async fn start_server<S>(
316 pool: S,
317 config: ServerConfig,
318 query_logger: Option<QueryLogger>,
319 lifecycle: &ServerLifecycle,
320) -> Result<(), Report<GraphError>>
321where
322 S: StorePool + Send + Sync + 'static,
323 for<'p> S::Store<'p>: RestApiStore + PrincipalStore + PolicyStore,
324{
325 let store = Arc::new(pool);
326 let temporal_client = create_temporal_client(&config.temporal)
327 .await?
328 .map(Arc::new);
329
330 if config.rpc_enabled {
331 tracing::info!("Starting RPC server...");
332
333 start_rpc_server(
334 config.rpc_address,
335 Dependencies {
336 store: Arc::clone(&store),
337 temporal_client: temporal_client.clone(),
338 codec: (),
339 },
340 lifecycle,
341 )?;
342 }
343
344 let router = rest_api_router(RestRouterDependencies {
345 store,
346 domain_regex: DomainValidator::new(config.allowed_url_domain),
347 temporal_client,
348 query_logger,
349 api_config: config.api_config,
350 });
351 start_rest_server(router, config.http_address, lifecycle);
352
353 Ok(())
354}
355
356#[expect(
357 clippy::integer_division_remainder_used,

Callers 1

serverFunction · 0.85

Calls 8

create_temporal_clientFunction · 0.85
start_rpc_serverFunction · 0.85
cloneFunction · 0.85
rest_api_routerFunction · 0.85
start_rest_serverFunction · 0.85
OkInterface · 0.85
mapMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected