using System.Threading;
namespace EmbedIO.Sessions
{
///
/// Represents a session manager, which is in charge of managing session objects
/// and their association to HTTP contexts.
///
public interface ISessionManager
{
///
/// Signals a session manager that the web server is starting.
///
/// The cancellation token used to stop the web server.
void Start(CancellationToken cancellationToken);
///
/// Returns the session associated with an .
/// If a session ID can be retrieved for the context and stored session data
/// are available, the returned will contain those data;
/// otherwise, a new session is created and its ID is stored in the response
/// to be retrieved by subsequent requests.
///
/// The HTTP context.
/// An interface.
ISession Create(IHttpContext context);
///
/// Deletes the session (if any) associated with the specified context
/// and removes the session's ID from the context.
///
/// The HTTP context.
/// The unique ID of the session.
///
void Delete(IHttpContext context, string id);
///
/// Called by a session proxy when a session has been obtained
/// for an and the context is closed,
/// even if the session was subsequently deleted.
/// This method can be used to save session data to a storage medium.
///
/// The for which a session was obtained.
void OnContextClose(IHttpContext context);
}
}