17.40. Class PartitionTable

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

public class PartitionTable : IPartitionTable, IInitializable, IHealthCheckProvider

17.40.1. Inheritance

objectPartitionTable

17.40.2. Implements

IPartitionTable, IInitializable, IHealthCheckProvider

17.40.3. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

17.40.4. Constructors

17.40.4.1. PartitionTable(SessionProvider, MongoCollectionProvider<PartitionData, PartitionDataModelMapping>, ILogger<TaskTable>, ActivitySource)

public PartitionTable(SessionProvider sessionProvider, MongoCollectionProvider<PartitionData, PartitionDataModelMapping> partitionCollectionProvider, ILogger<TaskTable> logger, ActivitySource activitySource)

17.40.4.1.1. Parameters

sessionProvider SessionProvider

partitionCollectionProvider MongoCollectionProvider<PartitionData, PartitionDataModelMapping>

logger ILogger<TaskTable>

activitySource ActivitySource

17.40.5. Methods

17.40.5.1. ArePartitionsExistingAsync(IEnumerable<string>, CancellationToken)

Check the availability of the given partitions in the data base

public Task<bool> ArePartitionsExistingAsync(IEnumerable<string> partitionIds, CancellationToken cancellationToken = default)

17.40.5.1.1. Parameters

partitionIds IEnumerable<string>

Collection of partition ids

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.1.2. Returns

Task<bool>

A bool representing whether all the partitions are available

17.40.5.2. Check(HealthCheckTag)

Checks the status of a class for the given health check type.

public Task<HealthCheckResult> Check(HealthCheckTag tag)

17.40.5.2.1. Parameters

tag HealthCheckTag

Health check for which the class has to answer.

17.40.5.2.2. Returns

Task<HealthCheckResult>

The result of the check containing the status of the class for the health check type.

17.40.5.3. CreatePartitionsAsync(IEnumerable<PartitionData>, CancellationToken)

Inserts a collection of partitions in the data base

public Task CreatePartitionsAsync(IEnumerable<PartitionData> partitions, CancellationToken cancellationToken = default)

17.40.5.3.1. Parameters

partitions IEnumerable<PartitionData>

Collection of partitions to be inserted

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.3.2. Returns

Task

Task representing the asynchronous execution of the method

17.40.5.4. DeletePartitionAsync(string, CancellationToken)

Remove a partition from the data base given its id

public Task DeletePartitionAsync(string partitionId, CancellationToken cancellationToken = default)

17.40.5.4.1. Parameters

partitionId string

Id of the partition to be deleted

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.4.2. Returns

Task

Task representing the asynchronous execution of the method

17.40.5.4.3. Exceptions

PartitionNotFoundException

required partition is not found

17.40.5.5. FindPartitionsAsync<T>(Expression<Func<PartitionData, bool>>, Expression<Func<PartitionData, T>>, CancellationToken)

Find all partitions matching the given filter

public IAsyncEnumerable<T> FindPartitionsAsync<T>(Expression<Func<PartitionData, bool>> filter, Expression<Func<PartitionData, T>> selector, CancellationToken cancellationToken = default)

17.40.5.5.1. Parameters

filter Expression<Func<PartitionData, bool>>

Filter to select partitions

selector Expression<Func<PartitionData, T>>

Expression to select part of the returned partition

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.5.2. Returns

IAsyncEnumerable<T>

List of partitions that match the filter

17.40.5.5.3. Type Parameters

T

17.40.5.6. GetPartitionWithAllocationAsync(CancellationToken)

Gets partitions that are pod allocated to it (PodMax > 0)

public IAsyncEnumerable<PartitionData> GetPartitionWithAllocationAsync(CancellationToken cancellationToken = default)

17.40.5.6.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.6.2. Returns

IAsyncEnumerable<PartitionData>

Collection of partitions respecting the request

17.40.5.7. Init(CancellationToken)

Executes an initialization process for the class

public Task Init(CancellationToken cancellationToken)

17.40.5.7.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.7.2. Returns

Task

Task representing the asynchronous execution of the method

17.40.5.8. ListPartitionsAsync(Expression<Func<PartitionData, bool>>, Expression<Func<PartitionData, object?>>, bool, int, int, CancellationToken)

List all partitions matching the given filter and ordering

public Task<(IEnumerable<PartitionData> partitions, int totalCount)> ListPartitionsAsync(Expression<Func<PartitionData, bool>> filter, Expression<Func<PartitionData, object?>> orderField, bool ascOrder, int page, int pageSize, CancellationToken cancellationToken = default)

17.40.5.8.1. Parameters

filter Expression<Func<PartitionData, bool>>

Filter to select partitions

orderField Expression<Func<PartitionData, object?>>

Select the field that will be used to order the partitions

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.40.5.8.2. Returns

Task<(IEnumerable<PartitionData> partitions, int totalCount)>

Collection of partition metadata matching the request and total number of results without paging

17.40.5.8.3. Remarks

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

17.40.5.9. ReadPartitionAsync(string, CancellationToken)

Retrieves a partition from the data base

public Task<PartitionData> ReadPartitionAsync(string partitionId, CancellationToken cancellationToken = default)

17.40.5.9.1. Parameters

partitionId string

Id of the partition to read

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.40.5.9.2. Returns

Task<PartitionData>

Task metadata of the retrieved partition

17.40.5.9.3. Exceptions

PartitionNotFoundException

required partition is not found