-
Notifications
You must be signed in to change notification settings - Fork 0
Index worker
The index worker is responsible for managing the operations of writing and removing the index records for the data and returning the ids of the indexed data.
Several methods are needed from a index worker; these are defined on the index worker interface (IIndexWorker). We will now take a look at each method and discuss what the intent of the method is.
The IndexExist method is used by the data manager to determin if the index exists and is used when reading data by index.
Task<bool> IndexExist<TDataType>(string indexName) where TDataType : DataEntity;
The method takes in the name of the index and should return true if the index exists for the data type.
The GetIdsFromIndex method is used by the data manager to get the ids from the key in the specified index.
IAsyncEnumerable<int> GetIdsFromIndex<TDataType, TKeyType>(string indexName, TKeyType indexKey) where TDataType : DataEntity;
The method takes in the name of the index and the value of the key to look up. If the key has ids in the index then the method returns the list of them.
The Index method is used by the data manager to request the indexable properties of the data are indexed.
Task<bool> Index<TDataType>(TDataType data) where TDataType : DataEntity;
The method takes in the data object this can then be used to index the data. Returns true if all the properites in the object that are marked as indexable have been index successfully.
The Unindex method is used by the data manager to request the id of the object are removed from the indexable properties of the data.
Task<bool> Unindex<TDataType>(TDataType data) where TDataType : DataEntity;
The method takes in the data object this can then be used to unindex the data. Returns true if all the properites in the object that are marked as indexable have been unindex successfully for that object.
This project provides a Index class and a IndexKey class to help create indexes when the underlying storage system has no concept for this.
A property in a data object type can be marked as indexable using the IndexAttribute provided by this project.