21.28. Class SessionTable
Namespace: ArmoniK.Core.Adapters.Memory
Assembly: ArmoniK.Core.Adapters.Memory.dll
public class SessionTable : ISessionTable, IInitializable, IHealthCheckProvider
21.28.1. Inheritance
21.28.2. Implements
ISessionTable, IInitializable, IHealthCheckProvider
21.28.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.28.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.28.5. Constructors
21.28.5.1. SessionTable(ConcurrentDictionary<string, SessionData>, ILogger<SessionTable>)
public SessionTable(ConcurrentDictionary<string, SessionData> storage, ILogger<SessionTable> logger)
21.28.5.1.1. Parameters
storage ConcurrentDictionary<string, SessionData>
logger ILogger<SessionTable>
21.28.6. Properties
21.28.6.1. Logger
Logger for class ISessionTable
public ILogger Logger { get; }
21.28.6.1.1. Property Value
21.28.7. Methods
21.28.7.1. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
21.28.7.1.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
21.28.7.1.2. Returns
The result of the check containing the status of the class for the health check type.
21.28.7.2. DeleteSessionAsync(string, CancellationToken)
Delete a session
public Task DeleteSessionAsync(string sessionId, CancellationToken cancellationToken = default)
21.28.7.2.1. Parameters
sessionId string
Id of the session to delete
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.28.7.2.2. Returns
Task representing the asynchronous execution of the method
21.28.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.28.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.28.7.3.2. Returns
Session metadata matching the request
21.28.7.3.3. Type Parameters
T
21.28.7.4. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
21.28.7.4.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.28.7.4.2. Returns
Task representing the asynchronous execution of the method
21.28.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.28.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.28.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.28.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.28.7.6. SetSessionDataAsync(IEnumerable<string>, TaskOptions, CancellationToken)
Set metadata for a new session
public Task<string> SetSessionDataAsync(IEnumerable<string> partitionIds, TaskOptions defaultOptions, CancellationToken cancellationToken = default)
21.28.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.28.7.6.2. Returns
Id of the created session
21.28.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.28.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.28.7.7.2. Returns
The session metadata before the update or null if task not found