using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace ZeroLevel.Services.PartitionStorage
{
///
/// Provides read/reindex operations in catalog partition
///
/// Key type
/// Type of one input value
/// Type of records aggregate
public interface IStorePartitionAccessor
: IStorePartitionBase
{
///
/// Rebuilds indexes for data in a partition
///
void RebuildIndex();
///
/// Search in a partition for a specified key
///
Task> Find(TKey key);
///
/// Search in a partition for a specified keys
///
Task Find(IEnumerable keys, Action searchResultHandler);
///
/// Iterating over all recorded data
///
IAsyncEnumerable> Iterate();
///
/// Iterating over all recorded data of the file with the specified key
///
Task IterateKeyBacket(TKey key, Action kvHandler);
///
/// Deleting the specified key and associated data
///
/// Key
/// true - automatically rebuild the index of the file from which data was deleted (default = false)
Task RemoveKey(TKey key, bool autoReindex = false);
///
/// Deleting the specified keys and associated data
///
/// Keys
/// true - automatically rebuild the index of the file from which data was deleted (default = true)
Task RemoveKeys(IEnumerable keys, bool autoReindex = true);
///
/// Delete all keys with data except the specified key
///
/// Key
/// true - automatically rebuild the index of the file from which data was deleted (default = true)
Task RemoveAllExceptKey(TKey key, bool autoReindex = true);
///
/// Delete all keys with data other than the specified ones
///
/// Keys
/// true - automatically rebuild the index of the file from which data was deleted (default = true)
Task RemoveAllExceptKeys(IEnumerable keys, bool autoReindex = true);
}
}