17.41. Class ResultTable
Namespace: ArmoniK.Core.Adapters.MongoDB
Assembly: ArmoniK.Core.Adapters.MongoDB.dll
public class ResultTable : IResultTable, IInitializable, IHealthCheckProvider
17.41.1. Inheritance
17.41.2. Implements
IResultTable, IInitializable, IHealthCheckProvider
17.41.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
17.41.4. Extension Methods
ResultTableExtensions.AbortSessionResults(IResultTable, string, CancellationToken), ResultTableExtensions.AbortTaskResults(IResultTable, string, string, CancellationToken), ResultTableExtensions.BulkUpdateResults(IResultTable, IEnumerable<(string resultId, UpdateDefinition<Result> updates)>, CancellationToken), ResultTableExtensions.CompleteManyResults(IResultTable, IEnumerable<(string resultId, long size, byte[] opaqueId)>, CancellationToken), ResultTableExtensions.CompleteResult(IResultTable, string, string, long, byte[], CancellationToken), ResultTableExtensions.GetDependents(IResultTable, string, string, CancellationToken), ResultTableExtensions.GetResultStatus(IResultTable, IEnumerable<string>, string, CancellationToken), ResultTableExtensions.GetResults(IResultTable, string, IEnumerable<string>, CancellationToken), ResultTableExtensions.MarkAsDeleted(IResultTable, string, CancellationToken), ResultTableExtensions.SetResult(IResultTable, string, string, string, long, byte[], CancellationToken)
17.41.5. Constructors
17.41.5.1. ResultTable(SessionProvider, MongoCollectionProvider<Result, ResultDataModelMapping>, ActivitySource, ILogger<ResultTable>)
public ResultTable(SessionProvider sessionProvider, MongoCollectionProvider<Result, ResultDataModelMapping> resultCollectionProvider, ActivitySource activitySource, ILogger<ResultTable> logger)
17.41.5.1.1. Parameters
sessionProvider SessionProvider
resultCollectionProvider MongoCollectionProvider<Result, ResultDataModelMapping>
activitySource ActivitySource
logger ILogger<ResultTable>
17.41.6. Properties
17.41.6.1. Logger
Logger used to produce logs for this class
public ILogger Logger { get; }
17.41.6.1.1. Property Value
17.41.7. Methods
17.41.7.1. AddTaskDependencies(IDictionary<string, ICollection<string>>, CancellationToken)
Add the tasks Ids to the list of reverse dependencies of the given results
public Task AddTaskDependencies(IDictionary<string, ICollection<string>> dependencies, CancellationToken cancellationToken = default)
17.41.7.1.1. Parameters
dependencies IDictionary<string, ICollection<string>>
Dictionary of the dependant tasks for each result
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.1.2. Returns
Task representing the asynchronous execution of the method
17.41.7.2. ChangeResultOwnership(string, IEnumerable<ChangeResultOwnershipRequest>, CancellationToken)
Change ownership (in batch) of the results in the given request
public Task ChangeResultOwnership(string oldTaskId, IEnumerable<IResultTable.ChangeResultOwnershipRequest> requests, CancellationToken cancellationToken)
17.41.7.2.1. Parameters
oldTaskId string
Task Id of the previous owner
requests IEnumerable<IResultTable.ChangeResultOwnershipRequest>
Change ownership requests that will be executed
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.2.2. Returns
Task representing the asynchronous execution of the method
17.41.7.3. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
17.41.7.3.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
17.41.7.3.2. Returns
The result of the check containing the status of the class for the health check type.
17.41.7.4. Create(ICollection<Result>, CancellationToken)
Inserts the given results in the database
public Task Create(ICollection<Result> results, CancellationToken cancellationToken = default)
17.41.7.4.1. Parameters
results ICollection<Result>
Results that will be inserted into the database
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.4.2. Returns
Task representing the asynchronous execution of the method
17.41.7.5. DeleteResult(string, CancellationToken)
Delete the results from the database
public Task DeleteResult(string key, CancellationToken cancellationToken = default)
17.41.7.5.1. Parameters
key string
id of the result to be deleted
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.5.2. Returns
Task representing the asynchronous execution of the method
17.41.7.6. DeleteResults(string, CancellationToken)
Delete all the results from a session
public Task DeleteResults(string sessionId, CancellationToken cancellationToken = default)
17.41.7.6.1. Parameters
sessionId string
id of the session containing the result
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.6.2. Returns
Task representing the asynchronous execution of the method
17.41.7.7. GetResults<T>(Expression<Func<Result, bool>>, Expression<Func<Result, T>>, CancellationToken)
Get the results from a filter and convert it in the given type
public IAsyncEnumerable<T> GetResults<T>(Expression<Func<Result, bool>> filter, Expression<Func<Result, T>> convertor, CancellationToken cancellationToken = default)
17.41.7.7.1. Parameters
filter Expression<Func<Result, bool>>
Filter to select results
convertor Expression<Func<Result, T>>
Expression to convert result into another type
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.7.2. Returns
Collection of results metadata from the database
17.41.7.7.3. Type Parameters
T
17.41.7.8. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
17.41.7.8.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.8.2. Returns
Task representing the asynchronous execution of the method
17.41.7.9. ListResultsAsync(Expression<Func<Result, bool>>, Expression<Func<Result, object?>>, bool, int, int, CancellationToken)
List all results matching the given request
public Task<(IEnumerable<Result> results, int totalCount)> ListResultsAsync(Expression<Func<Result, bool>> filter, Expression<Func<Result, object?>> orderField, bool ascOrder, int page, int pageSize, CancellationToken cancellationToken = default)
17.41.7.9.1. Parameters
filter Expression<Func<Result, bool>>
Filter to select results
orderField Expression<Func<Result, object?>>
Select the field that will be used to order the results
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
17.41.7.9.2. Returns
Task<(IEnumerable<Result> results, int totalCount)>
Collection of results metadata that matched the filter and total number of results without paging
17.41.7.9.3. Remarks
If pageSize is 0, this function can be used to count the number of results
satisfying the condition specified by filter
17.41.7.10. SetTaskOwnership(ICollection<(string resultId, string taskId)>, CancellationToken)
Set Task that should produce the result
public Task SetTaskOwnership(ICollection<(string resultId, string taskId)> requests, CancellationToken cancellationToken = default)
17.41.7.10.1. Parameters
requests ICollection<(string resultId, string taskId)>
Results to update with the associated task id
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.10.2. Returns
Task representing the asynchronous execution of the method
17.41.7.11. UpdateManyResults(Expression<Func<Result, bool>>, UpdateDefinition<Result>, CancellationToken)
Update the results matching the filter with the given new values
public Task<long> UpdateManyResults(Expression<Func<Result, bool>> filter, UpdateDefinition<Result> updates, CancellationToken cancellationToken = default)
17.41.7.11.1. Parameters
filter Expression<Func<Result, bool>>
Filter to select the results to update
updates UpdateDefinition<Result>
Collection of fields to update and their new value
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.11.2. Returns
The number of results matched
17.41.7.12. UpdateOneResult(string, UpdateDefinition<Result>, CancellationToken)
Update one result with the given new values
public Task<Result> UpdateOneResult(string resultId, UpdateDefinition<Result> updates, CancellationToken cancellationToken = default)
17.41.7.12.1. Parameters
resultId string
Id of the result to be updated
updates UpdateDefinition<Result>
Collection of fields to update and their new value
cancellationToken CancellationToken
Token used to cancel the execution of the method
17.41.7.12.2. Returns
The result metadata before the update