ItemKeyFromIndex() private static method

Get the item key from an index
private static ItemKeyFromIndex ( byte[]>.KeyValuePair indexPair, int indexKeyLen = -1 ) : byte[]
indexPair byte[]>.KeyValuePair
indexKeyLen int
return byte[]
Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }