26.204. Interface ISessionTable

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

Interface to manage the life cycle of a session

public interface ISessionTable : IInitializable, IHealthCheckProvider

26.204.1. Implements

IInitializable, IHealthCheckProvider

26.204.2. Extension Methods

SessionTableExtensions.CancelSessionAsync(ISessionTable, string, CancellationToken), SessionTableExtensions.CloseSessionAsync(ISessionTable, string, DateTime?, CancellationToken), SessionTableExtensions.GetDefaultTaskOptionAsync(ISessionTable, string, CancellationToken), SessionTableExtensions.GetSessionAsync(ISessionTable, string, CancellationToken), SessionTableExtensions.IsSessionCancelledAsync(ISessionTable, string, CancellationToken), SessionTableExt.ListSessionsAsync(ISessionTable, SessionFilter, CancellationToken), SessionTableExtensions.PauseSessionAsync(ISessionTable, string, CancellationToken), SessionTableExtensions.PurgeSessionAsync(ISessionTable, string, DateTime?, CancellationToken), SessionTableExtensions.ResumeSessionAsync(ISessionTable, string, CancellationToken), SessionTableExtensions.StopSubmissionAsync(ISessionTable, string, bool, bool, CancellationToken)

26.204.3. Properties

26.204.3.1. Logger

Logger for class ISessionTable

ILogger Logger { get; }

26.204.3.1.1. Property Value

ILogger

26.204.3.2. Secondary

Table targeting a secondary server for read operations

ISessionTable Secondary { get; }

26.204.3.2.1. Property Value

ISessionTable

26.204.4. Methods

26.204.4.1. DeleteSessionAsync(string, CancellationToken)

Delete a session

Task DeleteSessionAsync(string sessionId, CancellationToken cancellationToken = default)

26.204.4.1.1. Parameters

sessionId string

Id of the session to delete

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.204.4.1.2. Returns

Task

Task representing the asynchronous execution of the method

26.204.4.2. FindSessionsAsync<T>(Expression<Func<SessionData, bool>>, Expression<Func<SessionData, T>>, CancellationToken)

Find all sessions matching the given filter and ordering

IAsyncEnumerable<T> FindSessionsAsync<T>(Expression<Func<SessionData, bool>> filter, Expression<Func<SessionData, T>> selector, CancellationToken cancellationToken = default)

26.204.4.2.1. Parameters

filter Expression<Func<SessionData, bool>>

Filter to select sessions

selector Expression<Func<SessionData, T>>

Expression to select part of the returned session data

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.204.4.2.2. Returns

IAsyncEnumerable<T>

Session metadata matching the request

26.204.4.2.3. Type Parameters

T

26.204.4.3. ListSessionsAsync(Expression<Func<SessionData, bool>>, Expression<Func<SessionData, object?>>, bool, int, int, CancellationToken)

List all sessions matching the given request

Task<(IEnumerable<SessionData> sessions, long totalCount)> ListSessionsAsync(Expression<Func<SessionData, bool>> filter, Expression<Func<SessionData, object?>> orderField, bool ascOrder, int page, int pageSize, CancellationToken cancellationToken = default)

26.204.4.3.1. Parameters

filter Expression<Func<SessionData, bool>>

Filter to select sessions

orderField Expression<Func<SessionData, object?>>

Select the field that will be used to order the sessions

ascOrder bool

Is the order ascending

page int

The page of results to retrieve

pageSize int

The number of results pages

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.204.4.3.2. Returns

Task<(IEnumerable<SessionData> sessions, long totalCount)>

Collection of sessions metadata that matched the filter and total number of results without paging

26.204.4.3.3. Remarks

If pageSize is 0, this function can be used to count the number of sessions satisfying the condition specified by filter

26.204.4.4. SetSessionDataAsync(IEnumerable<string>, TaskOptions, CancellationToken)

Set metadata for a new session

Task<string> SetSessionDataAsync(IEnumerable<string> partitionIds, TaskOptions defaultOptions, CancellationToken cancellationToken = default)

26.204.4.4.1. Parameters

partitionIds IEnumerable<string>

List of partitions allowed to be used during the session

defaultOptions TaskOptions

Default metadata for the tasks to be created in this session

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.204.4.4.2. Returns

Task<string>

Id of the created session

26.204.4.5. UpdateOneSessionAsync(string, Expression<Func<SessionData, bool>>?, UpdateDefinition<SessionData>, bool, CancellationToken)

Update one session with the given new values

Task<SessionData?> UpdateOneSessionAsync(string sessionId, Expression<Func<SessionData, bool>>? filter, UpdateDefinition<SessionData> updates, bool before = false, CancellationToken cancellationToken = default)

26.204.4.5.1. Parameters

sessionId string

Id of the sessions to be updated

filter Expression<Func<SessionData, bool>>?

Additional filter on the session

updates UpdateDefinition<SessionData>

Collection of fields to update and their new value

before bool

Whether to return metadata before update

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.204.4.5.2. Returns

Task<SessionData?>

The session metadata before the update or null if task not found