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>>>,
}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)
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
Auto Trait Implementations§
impl Freeze for ServerHost
impl !RefUnwindSafe for ServerHost
impl Send for ServerHost
impl Sync for ServerHost
impl Unpin for ServerHost
impl !UnwindSafe for ServerHost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more