22.204. Interface IResultTable
Namespace: ArmoniK.Core.Common.Storage
Assembly: ArmoniK.Core.Common.dll
Interface for managing results in database
public interface IResultTable : IInitializable, IHealthCheckProvider
22.204.1. Implements
IInitializable, IHealthCheckProvider
22.204.2. 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, ICollection<(string resultId, long size, byte[] opaqueId)>, string, 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)
22.204.3. Properties
22.204.3.1. Logger
Logger used to produce logs for this class
ILogger Logger { get; }
22.204.3.1.1. Property Value
22.204.3.2. Secondary
Table targeting a secondary server for read operations
IResultTable Secondary { get; }
22.204.3.2.1. Property Value
22.204.4. Methods
22.204.4.1. AddTaskDependencies(IDictionary<string, ICollection<string>>, CancellationToken)
Add the tasks Ids to the list of reverse dependencies of the given results
Task AddTaskDependencies(IDictionary<string, ICollection<string>> dependencies, CancellationToken cancellationToken = default)
22.204.4.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
22.204.4.1.2. Returns
Task representing the asynchronous execution of the method
22.204.4.2. BulkUpdateResults(IEnumerable<(Expression<Func<Result, bool>> filter, UpdateDefinition<Result> updates)>, CancellationToken)
Updates in bulk results
Task<long> BulkUpdateResults(IEnumerable<(Expression<Func<Result, bool>> filter, UpdateDefinition<Result> updates)> bulkUpdates, CancellationToken cancellationToken)
22.204.4.2.1. Parameters
bulkUpdates IEnumerable<(Expression<Func<Result, bool>> filter, UpdateDefinition<Result> updates)>
Enumeration of updates with the filter they apply on
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.204.4.2.2. Returns
The number of task matched
22.204.4.3. ChangeResultOwnership(string, IEnumerable<ChangeResultOwnershipRequest>, CancellationToken)
Change ownership (in batch) of the results in the given request
Task ChangeResultOwnership(string oldTaskId, IEnumerable<IResultTable.ChangeResultOwnershipRequest> requests, CancellationToken cancellationToken)
22.204.4.3.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
22.204.4.3.2. Returns
Task representing the asynchronous execution of the method
22.204.4.4. Create(ICollection<Result>, CancellationToken)
Inserts the given results in the database
Task Create(ICollection<Result> results, CancellationToken cancellationToken = default)
22.204.4.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
22.204.4.4.2. Returns
Task representing the asynchronous execution of the method
22.204.4.5. DeleteResult(string, CancellationToken)
Delete the results from the database
Task DeleteResult(string key, CancellationToken cancellationToken = default)
22.204.4.5.1. Parameters
key string
id of the result to be deleted
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.204.4.5.2. Returns
Task representing the asynchronous execution of the method
22.204.4.6. DeleteResults(string, CancellationToken)
Delete all the results from a session
Task DeleteResults(string sessionId, CancellationToken cancellationToken = default)
22.204.4.6.1. Parameters
sessionId string
id of the session containing the result
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.204.4.6.2. Returns
Task representing the asynchronous execution of the method
22.204.4.7. DeleteResults(ICollection<string>, CancellationToken)
Delete all the results from a collection
Task DeleteResults(ICollection<string> results, CancellationToken cancellationToken = default)
22.204.4.7.1. Parameters
results ICollection<string>
ids of the results to be deleted
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.204.4.7.2. Returns
Task representing the asynchronous execution of the method
22.204.4.8. GetResult(string, CancellationToken)
Get the result from its id
Task<Result> GetResult(string key, CancellationToken cancellationToken = default)
22.204.4.8.1. Parameters
key string
id of the result to be retrieved
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.204.4.8.2. Returns
Result metadata from the database
22.204.4.9. GetResults<T>(Expression<Func<Result, bool>>, Expression<Func<Result, T>>, CancellationToken)
Get the results from a filter and convert it in the given type
IAsyncEnumerable<T> GetResults<T>(Expression<Func<Result, bool>> filter, Expression<Func<Result, T>> convertor, CancellationToken cancellationToken = default)
22.204.4.9.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
22.204.4.9.2. Returns
Collection of results metadata from the database
22.204.4.9.3. Type Parameters
T
22.204.4.10. ListResultsAsync(Expression<Func<Result, bool>>, Expression<Func<Result, object?>>, bool, int, int, CancellationToken)
List all results matching the given request
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)
22.204.4.10.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
22.204.4.10.2. Returns
Task<(IEnumerable<Result> results, int totalCount)>
Collection of results metadata that matched the filter and total number of results without paging
22.204.4.10.3. Remarks
If pageSize is 0, this function can be used to count the number of results
satisfying the condition specified by filter
22.204.4.11. SetTaskOwnership(ICollection<(string resultId, string taskId)>, CancellationToken)
Set Task that should produce the result
Task SetTaskOwnership(ICollection<(string resultId, string taskId)> requests, CancellationToken cancellationToken = default)
22.204.4.11.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
22.204.4.11.2. Returns
Task representing the asynchronous execution of the method
22.204.4.12. UpdateManyResults(Expression<Func<Result, bool>>, UpdateDefinition<Result>, CancellationToken)
Update the results matching the filter with the given new values
Task<long> UpdateManyResults(Expression<Func<Result, bool>> filter, UpdateDefinition<Result> updates, CancellationToken cancellationToken = default)
22.204.4.12.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
22.204.4.12.2. Returns
The number of results matched
22.204.4.13. UpdateOneResult(string, UpdateDefinition<Result>, CancellationToken)
Update one result with the given new values
Task<Result> UpdateOneResult(string resultId, UpdateDefinition<Result> updates, CancellationToken cancellationToken = default)
22.204.4.13.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
22.204.4.13.2. Returns
The result metadata before the update