pub struct ServerHost {
pub config: Arc<LinksConfig>,
pub link_service: Arc<dyn LinkService>,
pub registry: Arc<LinkRouteRegistry>,
pub entity_registry: EntityRegistry,
pub entity_fetchers: Arc<HashMap<String, Arc<dyn EntityFetcher>>>,
pub entity_creators: Arc<HashMap<String, Arc<dyn EntityCreator>>>,
pub event_bus: Option<Arc<EventBus>>,
}Expand description
Host context containing all framework state
This structure is transport-agnostic and contains all the information needed to expose the API via any protocol (REST, GraphQL, gRPC, etc.)
§Example
let host = ServerHost::from_builder_components(
link_service,
config,
entity_registry,
fetchers,
creators,
)?;
// Use host with any exposure
let host_arc = Arc::new(host);
let rest_app = RestExposure::build_router(host_arc.clone())?;
let graphql_app = GraphQLExposure::build_router(host_arc)?;Fields§
§config: Arc<LinksConfig>Merged configuration from all modules
link_service: Arc<dyn LinkService>Link service for relationship management
registry: Arc<LinkRouteRegistry>Link route registry for semantic URL resolution
entity_registry: EntityRegistryEntity registry for CRUD routes
entity_fetchers: Arc<HashMap<String, Arc<dyn EntityFetcher>>>Entity fetchers map (for link enrichment)
entity_creators: Arc<HashMap<String, Arc<dyn EntityCreator>>>Entity creators map (for automatic entity + link creation)
event_bus: Option<Arc<EventBus>>Optional event bus for real-time notifications (WebSocket, SSE)
When present, REST/GraphQL handlers will publish events for mutations. WebSocket and other real-time exposures subscribe to this bus.
Implementations§
Source§impl ServerHost
impl ServerHost
Sourcepub fn from_builder_components(
link_service: Arc<dyn LinkService>,
config: LinksConfig,
entity_registry: EntityRegistry,
fetchers: HashMap<String, Arc<dyn EntityFetcher>>,
creators: HashMap<String, Arc<dyn EntityCreator>>,
) -> Result<Self>
pub fn from_builder_components( link_service: Arc<dyn LinkService>, config: LinksConfig, entity_registry: EntityRegistry, fetchers: HashMap<String, Arc<dyn EntityFetcher>>, creators: HashMap<String, Arc<dyn EntityCreator>>, ) -> Result<Self>
Build the host from builder components
This method takes all the components that have been registered with the builder and constructs the host structure.
§Arguments
link_service- The link service for relationship managementconfig- Merged configuration from all modulesentity_registry- Registry of all entity descriptorsfetchers- Map of entity type to fetcher implementationcreators- Map of entity type to creator implementation
§Returns
Returns a ServerHost ready to be used with any exposure (REST, GraphQL, gRPC, etc.)
Sourcepub fn entity_types(&self) -> Vec<&str>
pub fn entity_types(&self) -> Vec<&str>
Get entity types registered in the host
Sourcepub fn with_event_bus(self, event_bus: EventBus) -> Self
pub fn with_event_bus(self, event_bus: EventBus) -> Self
Set the event bus for real-time notifications