21.44. Class SessionTable

Namespace: ArmoniK.Core.Adapters.MongoDB
Assembly: ArmoniK.Core.Adapters.MongoDB.dll

public class SessionTable : ISessionTable, IInitializable, IHealthCheckProvider

21.44.1. Inheritance

objectSessionTable

21.44.2. Implements

ISessionTable, IInitializable, IHealthCheckProvider

21.44.3. Inherited Members

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

21.44.4. 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)

21.44.5. Constructors

21.44.5.1. SessionTable(SessionProvider, MongoCollectionProvider<SessionData, SessionDataModelMapping>, ILogger<SessionTable>, ActivitySource)

public SessionTable(SessionProvider sessionProvider, MongoCollectionProvider<SessionData, SessionDataModelMapping> sessionCollectionProvider, ILogger<SessionTable> logger, ActivitySource activitySource)

21.44.5.1.1. Parameters

sessionProvider SessionProvider

sessionCollectionProvider MongoCollectionProvider<SessionData, SessionDataModelMapping>

logger ILogger<SessionTable>

activitySource ActivitySource

21.44.6. Properties

21.44.6.1. Logger

Logger for class ISessionTable

public ILogger Logger { get; }

21.44.6.1.1. Property Value

ILogger

21.44.7. Methods

21.44.7.1. Check(HealthCheckTag)

Checks the status of a class for the given health check type.

public Task<HealthCheckResult> Check(HealthCheckTag tag)

21.44.7.1.1. Parameters

tag HealthCheckTag

Health check for which the class has to answer.

21.44.7.1.2. Returns

Task<HealthCheckResult>

The result of the check containing the status of the class for the health check type.

21.44.7.2. DeleteSessionAsync(string, CancellationToken)

Delete a session

public Task DeleteSessionAsync(string sessionId, CancellationToken cancellationToken = default)

21.44.7.2.1. Parameters

sessionId string

Id of the session to delete

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.44.7.2.2. Returns

Task

Task representing the asynchronous execution of the method

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

Find all sessions matching the given filter and ordering

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

21.44.7.3.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

21.44.7.3.2. Returns

IAsyncEnumerable<T>

Session metadata matching the request

21.44.7.3.3. Type Parameters

T

21.44.7.4. Init(CancellationToken)

Executes an initialization process for the class

public Task Init(CancellationToken cancellationToken)

21.44.7.4.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.44.7.4.2. Returns

Task

Task representing the asynchronous execution of the method

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

List all sessions matching the given request

public 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)

21.44.7.5.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

21.44.7.5.2. Returns

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

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

21.44.7.5.3. Remarks

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

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

Set metadata for a new session

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

21.44.7.6.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

21.44.7.6.2. Returns

Task<string>

Id of the created session

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

Update one session with the given new values

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

21.44.7.7.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

21.44.7.7.2. Returns

Task<SessionData?>

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