/// <summary> /// Get primary keys for cache. /// </summary> /// <param name="cache">Cache.</param> /// <param name="cnt">Amount of keys.</param> /// <param name="startFrom">Value to start from.</param> /// <returns></returns> private static List <int> PrimaryKeys <T>(ICache <int, T> cache, int cnt, int startFrom = 0) { IClusterNode node = cache.Ignite.GetCluster().GetLocalNode(); ICacheAffinity aff = cache.Ignite.GetAffinity(cache.Name); List <int> keys = new List <int>(cnt); Assert.IsTrue( TestUtils.WaitForCondition(() => { for (int i = startFrom; i < startFrom + 100000; i++) { if (aff.IsPrimary(node, i)) { keys.Add(i); if (keys.Count == cnt) { return(true); } } } return(false); }, 5000), "Failed to find " + cnt + " primary keys."); return(keys); }
/// <summary> /// Get primary keys for cache. /// </summary> /// <param name="cache">Cache.</param> /// <param name="cnt">Amount of keys.</param> /// <param name="startFrom">Value to start from.</param> /// <returns></returns> private static List <int> PrimaryKeys <T>(ICache <int, T> cache, int cnt, int startFrom = 0) { IClusterNode node = cache.Ignite.Cluster.LocalNode; ICacheAffinity aff = cache.Ignite.Affinity(cache.Name); List <int> keys = new List <int>(cnt); for (int i = startFrom; i < startFrom + 100000; i++) { if (aff.IsPrimary(node, i)) { keys.Add(i); if (keys.Count == cnt) { return(keys); } } } Assert.Fail("Failed to find " + cnt + " primary keys."); return(null); }