21.45. Class SessionTable

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

Interface to manage the life cycle of a session

public class SessionTable : BaseTable<SessionData, SessionDataModelMapping>, ISessionTable, IInitializable, IHealthCheckProvider

21.45.1. Inheritance

objectBaseTable<SessionData, SessionDataModelMapping>SessionTable

21.45.2. Implements

ISessionTable, IInitializable, IHealthCheckProvider

21.45.3. Inherited Members

BaseTable<SessionData, SessionDataModelMapping>.Logger, BaseTable<SessionData, SessionDataModelMapping>.Init(CancellationToken), BaseTable<SessionData, SessionDataModelMapping>.Check(HealthCheckTag), BaseTable<SessionData, SessionDataModelMapping>.GetCollection(), BaseTable<SessionData, SessionDataModelMapping>.GetReadCollection(), BaseTable<SessionData, SessionDataModelMapping>.StartActivity(string), BaseTable<SessionData, SessionDataModelMapping>.GetSession(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

21.45.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.45.5. Constructors

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

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

21.45.5.1.1. Parameters

sessionProvider SessionProvider

sessionCollectionProvider MongoCollectionProvider<SessionData, SessionDataModelMapping>

activitySource ActivitySource

logger ILogger<SessionTable>

21.45.6. Properties

21.45.6.1. Secondary

Table targeting a secondary server for read operations

public ISessionTable Secondary { get; }

21.45.6.1.1. Property Value

ISessionTable

21.45.7. Methods

21.45.7.1. DeleteSessionAsync(string, CancellationToken)

Delete a session

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

21.45.7.1.1. Parameters

sessionId string

Id of the session to delete

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.45.7.1.2. Returns

Task

Task representing the asynchronous execution of the method

21.45.7.2. 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.45.7.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

21.45.7.2.2. Returns

IAsyncEnumerable<T>

Session metadata matching the request

21.45.7.2.3. Type Parameters

T

21.45.7.3. 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.45.7.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

21.45.7.3.2. Returns

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

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

21.45.7.3.3. Remarks

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

21.45.7.4. 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.45.7.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

21.45.7.4.2. Returns

Task<string>

Id of the created session

21.45.7.5. 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.45.7.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

21.45.7.5.2. Returns

Task<SessionData?>

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