/*
* Copyright (c) 2023 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Plugins.Sessions.Cache.Client
* File: IRemoteSession.cs
*
* IRemoteSession.cs is part of VNLib.Plugins.Sessions.Cache.Client which is part of the larger
* VNLib collection of libraries and utilities.
*
* VNLib.Plugins.Sessions.Cache.Client 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 3 of the
* License, or (at your option) any later version.
*
* VNLib.Plugins.Sessions.Cache.Client 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 System;
using System.Collections.Generic;
namespace VNLib.Plugins.Sessions.Cache.Client
{
///
/// A session that is expected to be stored in a remote caching storage system
///
public interface IRemoteSession
{
///
/// Gets the ID of the session
///
string SessionID { get; }
///
/// Gets the status of the session during a release operation
///
/// The flags that represent the status of the session
SessionStatus GetStatus();
///
/// Gets the internal session data to update when requested
///
/// The internal session data
IDictionary GetSessionData();
///
/// Destroys the internal state of the session so it cannot be
/// reused
///
/// A optional exception that caused the error condition
void Destroy(Exception? cause);
///
/// Determines if the state of the session is valid for reuse by a waiting
/// connection. Optionally returns an exception that caused
///
/// The exception that caused the session state to transition to invalid
/// True of the session is valid, false if it cannot be reused
bool IsValid(out Exception? cause);
///
/// Called by the store to notify the session that a pending update has completed
/// successfully.
///
void SessionUpdateComplete();
}
}