21.42. Class ResultTable

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

Interface for managing results in database

public class ResultTable : BaseTable<Result, ResultDataModelMapping>, IResultTable, IInitializable, IHealthCheckProvider

21.42.1. Inheritance

objectBaseTable<Result, ResultDataModelMapping>ResultTable

21.42.2. Implements

IResultTable, IInitializable, IHealthCheckProvider

21.42.3. Inherited Members

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

21.42.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, 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)

21.42.5. Constructors

21.42.5.1. ResultTable(SessionProvider, MongoCollectionProvider<Result, ResultDataModelMapping>, ActivitySource, ILogger<ResultTable>)

public ResultTable(SessionProvider sessionProvider, MongoCollectionProvider<Result, ResultDataModelMapping> resultCollectionProvider, ActivitySource activitySource, ILogger<ResultTable> logger)

21.42.5.1.1. Parameters

sessionProvider SessionProvider

resultCollectionProvider MongoCollectionProvider<Result, ResultDataModelMapping>

activitySource ActivitySource

logger ILogger<ResultTable>

21.42.6. Properties

21.42.6.1. Secondary

Table targeting a secondary server for read operations

public IResultTable Secondary { get; }

21.42.6.1.1. Property Value

IResultTable

21.42.7. Methods

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

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

21.42.7.1.2. Returns

Task

Task representing the asynchronous execution of the method

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

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

21.42.7.2.2. Returns

Task

Task representing the asynchronous execution of the method

21.42.7.3. Create(ICollection<Result>, CancellationToken)

Inserts the given results in the database

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

21.42.7.3.1. Parameters

results ICollection<Result>

Results that will be inserted into the database

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.42.7.3.2. Returns

Task

Task representing the asynchronous execution of the method

21.42.7.4. DeleteResult(string, CancellationToken)

Delete the results from the database

public Task DeleteResult(string key, CancellationToken cancellationToken = default)

21.42.7.4.1. Parameters

key string

id of the result to be deleted

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.42.7.4.2. Returns

Task

Task representing the asynchronous execution of the method

21.42.7.5. DeleteResults(string, CancellationToken)

Delete all the results from a session

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

21.42.7.5.1. Parameters

sessionId string

id of the session containing the result

cancellationToken CancellationToken

Token used to cancel the execution of the method

21.42.7.5.2. Returns

Task

Task representing the asynchronous execution of the method

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

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

21.42.7.6.2. Returns

IAsyncEnumerable<T>

Collection of results metadata from the database

21.42.7.6.3. Type Parameters

T

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

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

21.42.7.7.2. Returns

Task<(IEnumerable<Result> results, int totalCount)>

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

21.42.7.7.3. Remarks

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

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

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

21.42.7.8.2. Returns

Task

Task representing the asynchronous execution of the method

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

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

21.42.7.9.2. Returns

Task<long>

The number of results matched

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

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

21.42.7.10.2. Returns

Task<Result>

The result metadata before the update