/*
* Copyright (c) 2024 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Plugins.Essentials.ServiceStack
* File: IServiceHost.cs
*
* IServiceHost.cs is part of VNLib.Plugins.Essentials.ServiceStack which is part of the larger
* VNLib collection of libraries and utilities.
*
* VNLib.Plugins.Essentials.ServiceStack is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* VNLib.Plugins.Essentials.ServiceStack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
using VNLib.Net.Http;
using VNLib.Plugins.Essentials.ServiceStack.Plugins;
namespace VNLib.Plugins.Essentials.ServiceStack
{
///
/// Represents an HTTP service host which provides information required
/// for HttpServer routing and the for proccessing
/// incomming connections
///
public interface IServiceHost
{
///
/// The that handles HTTP connection
/// processing.
///
IWebRoot Processor { get; }
///
/// Optional user state to be set during initialization and read at a later time
///
object? UserState { get; }
///
/// Called when a plugin is loaded and is endpoints are extracted
/// to be placed into service.
///
/// The loaded plugin ready to be attached
/// The dynamic endpoints of a loading plugin
void OnRuntimeServiceAttach(IManagedPlugin plugin, IEndpoint[] endpoints);
///
/// Called when a 's
/// unloads a given plugin, and its originally discovered endpoints
///
/// The unloading plugin to detach
/// The endpoints of the unloading plugin to remove from service
void OnRuntimeServiceDetach(IManagedPlugin plugin, IEndpoint[] endpoints);
}
}