private static ItemKeyFromIndex ( byte[]>.KeyValuePair |
||
indexPair | byte[]>.KeyValuePair | |
indexKeyLen | int | |
리턴 | byte[] |
public void CleanIndex(string indexName) { KeyValueStore indexStore = GetSecondaryIndex(indexName); var allValueStoreItems = new HashSet <ByteArray>(this.Enumerate().Select(item => new ByteArray(item.Key))); foreach (var indexItem in indexStore.Enumerate()) { byte[] itemKey = KeyValueStore.ItemKeyFromIndex(indexItem); if (!allValueStoreItems.Contains(new ByteArray(itemKey))) { indexStore.Delete(indexItem.Key); } } }
public void RemoveIndexRangeForValue(string indexName, byte[] startAt, byte[] value) { KeyValueStore indexStore = GetSecondaryIndex(indexName); var pairs = indexStore.EnumerateFromKey(startAt); foreach (var pair in pairs) { var itemKey = KeyValueStore.ItemKeyFromIndex(pair); if (ByteArray.CompareMemCmp(itemKey, value) == 0) { indexStore.Delete(pair.Key); } if (ByteArray.CompareMemCmp(startAt, 0, pair.Key, 0, startAt.Length) == 0) { continue; } break; } }