26.222. Class SessionTableExtensions

Namespace: ArmoniK.Core.Common.Storage
Assembly: ArmoniK.Core.Common.dll

Provides extension methods for to manage and update the lifecycle and metadata of sessions in storage. Includes utilities for retrieving, cancelling, pausing, resuming, closing, purging sessions, and managing submission states.

public static class SessionTableExtensions

26.222.1. Inheritance

objectSessionTableExtensions

26.222.2. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

26.222.3. Methods

26.222.3.1. CancelSessionAsync(ISessionTable, string, CancellationToken)

Cancel a session

public static Task<SessionData> CancelSessionAsync(this ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)

26.222.3.1.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to cancel

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.1.2. Returns

Task<SessionData>

The metadata of the cancelled session

26.222.3.1.3. Exceptions

SessionNotFoundException

if session was not found or deleted

InvalidSessionTransitionException

if session is in a status that cannot be cancelled

26.222.3.2. CloseSessionAsync(ISessionTable, string, DateTime?, CancellationToken)

Close a session

public static Task<SessionData> CloseSessionAsync(this ISessionTable sessionTable, string sessionId, DateTime? creationDateTime, CancellationToken cancellationToken = default)

26.222.3.2.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to purge

creationDateTime DateTime?

Start of the session

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.2.2. Returns

Task<SessionData>

The metadata of the closed session

26.222.3.2.3. Exceptions

SessionNotFoundException

if session was not found or deleted

InvalidSessionTransitionException

if session is in a status that cannot be cancelled

26.222.3.3. GetDefaultTaskOptionAsync(ISessionTable, string, CancellationToken)

Get default task metadata for a session given its id

public static Task<TaskOptions> GetDefaultTaskOptionAsync(this ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)

26.222.3.3.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the target session

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.3.2. Returns

Task<TaskOptions>

Default task metadata of this session

26.222.3.3.3. Exceptions

SessionNotFoundException

if session was not found

26.222.3.4. GetSessionAsync(ISessionTable, string, CancellationToken)

Get SessionData from sessionId

public static Task<SessionData> GetSessionAsync(this ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)

26.222.3.4.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to get

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.4.2. Returns

Task<SessionData>

Data of the session

26.222.3.4.3. Exceptions

SessionNotFoundException

if session was not found

26.222.3.5. IsSessionCancelledAsync(ISessionTable, string, CancellationToken)

Query a session status to check if it is canceled

public static Task<bool> IsSessionCancelledAsync(this ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)

26.222.3.5.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to check

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.5.2. Returns

Task<bool>

Boolean representing the cancellation status of the session

26.222.3.5.3. Exceptions

SessionNotFoundException

if session was not found

26.222.3.6. PauseSessionAsync(ISessionTable, string, CancellationToken)

Pause a session

public static Task<SessionData> PauseSessionAsync(this ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)

26.222.3.6.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to pause

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.6.2. Returns

Task<SessionData>

The metadata of the paused session

26.222.3.6.3. Exceptions

SessionNotFoundException

if session was not found or deleted

InvalidSessionTransitionException

if session is in a status that cannot be cancelled

26.222.3.7. PurgeSessionAsync(ISessionTable, string, DateTime?, CancellationToken)

Purge a session

public static Task<SessionData> PurgeSessionAsync(this ISessionTable sessionTable, string sessionId, DateTime? creationDateTime, CancellationToken cancellationToken = default)

26.222.3.7.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to purge

creationDateTime DateTime?

Start of the session

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.7.2. Returns

Task<SessionData>

The metadata of the purged session

26.222.3.7.3. Exceptions

SessionNotFoundException

if session was not found or deleted

InvalidSessionTransitionException

if session is in a status that cannot be cancelled

26.222.3.8. ResumeSessionAsync(ISessionTable, string, CancellationToken)

Resume a session

public static Task<SessionData> ResumeSessionAsync(this ISessionTable sessionTable, string sessionId, CancellationToken cancellationToken = default)

26.222.3.8.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to resume

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.8.2. Returns

Task<SessionData>

The metadata of the resumed session

26.222.3.8.3. Exceptions

SessionNotFoundException

if session was not found or deleted

InvalidSessionTransitionException

if session is in a status that cannot be cancelled

26.222.3.9. StopSubmissionAsync(ISessionTable, string, bool, bool, CancellationToken)

Stops submission for client and/or worker

public static Task<SessionData> StopSubmissionAsync(this ISessionTable sessionTable, string sessionId, bool client, bool worker, CancellationToken cancellationToken = default)

26.222.3.9.1. Parameters

sessionTable ISessionTable

Interface to manage sessions lifecycle

sessionId string

Id of the session to cancel

client bool

Whether to stop submission for clients

worker bool

Whether to stop submission for worker

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.222.3.9.2. Returns

Task<SessionData>

The metadata of the session

26.222.3.9.3. Exceptions

SessionNotFoundException

if session is not found