17.198. Interface IResultTable

Namespace: ArmoniK.Core.Common.Storage
Assembly: ArmoniK.Core.Common.dll

Interface for managing results in database

public interface IResultTable : IInitializable, IHealthCheckProvider

17.198.1. Implements

IInitializable, IHealthCheckProvider

17.198.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, 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.198.3. Properties

17.198.3.1. Logger

Logger used to produce logs for this class

ILogger Logger { get; }

17.198.3.1.1. Property Value

ILogger

17.198.4. Methods

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

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

17.198.4.1.2. Returns

Task

Task representing the asynchronous execution of the method

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

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

17.198.4.2.2. Returns

Task<long>

The number of task matched

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

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

17.198.4.3.2. Returns

Task

Task representing the asynchronous execution of the method

17.198.4.4. Create(ICollection<Result>, CancellationToken)

Inserts the given results in the database

Task Create(ICollection<Result> results, CancellationToken cancellationToken = default)

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

17.198.4.4.2. Returns

Task

Task representing the asynchronous execution of the method

17.198.4.5. DeleteResult(string, CancellationToken)

Delete the results from the database

Task DeleteResult(string key, CancellationToken cancellationToken = default)

17.198.4.5.1. Parameters

key string

id of the result to be deleted

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.198.4.5.2. Returns

Task

Task representing the asynchronous execution of the method

17.198.4.6. DeleteResults(string, CancellationToken)

Delete all the results from a session

Task DeleteResults(string sessionId, CancellationToken cancellationToken = default)

17.198.4.6.1. Parameters

sessionId string

id of the session containing the result

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.198.4.6.2. Returns

Task

Task representing the asynchronous execution of the method

17.198.4.7. GetResult(string, CancellationToken)

Get the result from its id

Task<Result> GetResult(string key, CancellationToken cancellationToken = default)

17.198.4.7.1. Parameters

key string

id of the result to be retrieved

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.198.4.7.2. Returns

Task<Result>

Result metadata from the database

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

17.198.4.8.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.198.4.8.2. Returns

IAsyncEnumerable<T>

Collection of results metadata from the database

17.198.4.8.3. Type Parameters

T

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

17.198.4.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.198.4.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.198.4.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.198.4.10. 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)

17.198.4.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.198.4.10.2. Returns

Task

Task representing the asynchronous execution of the method

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

17.198.4.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.198.4.11.2. Returns

Task<long>

The number of results matched

17.198.4.12. UpdateOneResult(string, UpdateDefinition<Result>, CancellationToken)

Update one result with the given new values

Task<Result> UpdateOneResult(string resultId, UpdateDefinition<Result> updates, CancellationToken cancellationToken = default)

17.198.4.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.198.4.12.2. Returns

Task<Result>

The result metadata before the update