22.41. Class PartitionTable
Namespace: ArmoniK.Core.Adapters.MongoDB
Assembly: ArmoniK.Core.Adapters.MongoDB.dll
Interface to manage partitions and their life cycle in the data base
public class PartitionTable : BaseTable<PartitionData, PartitionDataModelMapping>, IPartitionTable, IInitializable, IHealthCheckProvider
22.41.1. Inheritance
object ← BaseTable<PartitionData, PartitionDataModelMapping> ← PartitionTable
22.41.2. Implements
IPartitionTable, IInitializable, IHealthCheckProvider
22.41.3. Inherited Members
BaseTable<PartitionData, PartitionDataModelMapping>.Logger, BaseTable<PartitionData, PartitionDataModelMapping>.Init(CancellationToken), BaseTable<PartitionData, PartitionDataModelMapping>.Check(HealthCheckTag), BaseTable<PartitionData, PartitionDataModelMapping>.GetCollection(), BaseTable<PartitionData, PartitionDataModelMapping>.GetReadCollection(), BaseTable<PartitionData, PartitionDataModelMapping>.StartActivity(string), BaseTable<PartitionData, PartitionDataModelMapping>.GetSession(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
22.41.4. Constructors
22.41.4.1. PartitionTable(SessionProvider, MongoCollectionProvider<PartitionData, PartitionDataModelMapping>, ActivitySource, ILogger<PartitionTable>)
public PartitionTable(SessionProvider sessionProvider, MongoCollectionProvider<PartitionData, PartitionDataModelMapping> partitionCollectionProvider, ActivitySource activitySource, ILogger<PartitionTable> logger)
22.41.4.1.1. Parameters
sessionProvider SessionProvider
partitionCollectionProvider MongoCollectionProvider<PartitionData, PartitionDataModelMapping>
activitySource ActivitySource
logger ILogger<PartitionTable>
22.41.5. Properties
22.41.5.1. Secondary
Table targeting a secondary server for read operations
public IPartitionTable Secondary { get; }
22.41.5.1.1. Property Value
22.41.6. Methods
22.41.6.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)
22.41.6.1.1. Parameters
partitionIds IEnumerable<string>
Collection of partition ids
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.41.6.1.2. Returns
A bool representing whether all the partitions are available
22.41.6.2. CreatePartitionsAsync(IEnumerable<PartitionData>, CancellationToken)
Inserts a collection of partitions in the data base
public Task CreatePartitionsAsync(IEnumerable<PartitionData> partitions, CancellationToken cancellationToken = default)
22.41.6.2.1. Parameters
partitions IEnumerable<PartitionData>
Collection of partitions to be inserted
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.41.6.2.2. Returns
Task representing the asynchronous execution of the method
22.41.6.3. DeletePartitionAsync(string, CancellationToken)
Remove a partition from the data base given its id
public Task DeletePartitionAsync(string partitionId, CancellationToken cancellationToken = default)
22.41.6.3.1. Parameters
partitionId string
Id of the partition to be deleted
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.41.6.3.2. Returns
Task representing the asynchronous execution of the method
22.41.6.3.3. Exceptions
required partition is not found
22.41.6.4. 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)
22.41.6.4.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
22.41.6.4.2. Returns
List of partitions that match the filter
22.41.6.4.3. Type Parameters
T
22.41.6.5. GetPartitionWithAllocationAsync(CancellationToken)
Gets partitions that are pod allocated to it (PodMax > 0)
public IAsyncEnumerable<PartitionData> GetPartitionWithAllocationAsync(CancellationToken cancellationToken = default)
22.41.6.5.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.41.6.5.2. Returns
IAsyncEnumerable<PartitionData>
Collection of partitions respecting the request
22.41.6.6. 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)
22.41.6.6.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
22.41.6.6.2. Returns
Task<(IEnumerable<PartitionData> partitions, int totalCount)>
Collection of partition metadata matching the request and total number of results without paging
22.41.6.6.3. Remarks
If pageSize is 0, this function can be used to count the number of partitions
satisfying the condition specified by filter
22.41.6.7. ReadPartitionAsync(string, CancellationToken)
Retrieves a partition from the data base
public Task<PartitionData> ReadPartitionAsync(string partitionId, CancellationToken cancellationToken = default)
22.41.6.7.1. Parameters
partitionId string
Id of the partition to read
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.41.6.7.2. Returns
Task metadata of the retrieved partition
22.41.6.7.3. Exceptions
required partition is not found