public StringKeyIterator(Table table, StringRangeParams ps) { this.table = table; this.startKey = ps.startKey; this.endKey = ps.endKey; this.prefix = ps.prefix; this.count = ps.count; this.forwardDirection = ps.forwardDirection; this.granularity = ps.granularity; Query(false); }
public void PerformListTest(Table tbl, StringRangeParams ps, uint expected) { int cnt; cnt = 0; foreach (String key in tbl.GetKeyIterator(ps)) { //Console.WriteLine(key); cnt++; } Console.WriteLine("Expecting {0}, received {1}", expected, cnt); Assert.IsTrue(expected == cnt); cnt = 0; foreach (KeyValuePair<string, string> kv in tbl.GetKeyValueIterator(ps)) { cnt++; } Console.WriteLine("Expecting {0}, received {1}", expected, cnt); Assert.IsTrue(expected == cnt); }
public void ListTest7(Table tbl, uint num) { uint count = 1234; StringRangeParams ps = new StringRangeParams(); ps.Backward(); ps.Count(count); uint expected = count; PerformListTest(tbl, ps, expected); }
public void ListTest9(Table tbl, uint num) { StringRangeParams ps = new StringRangeParams(); ps.EndKey(Utils.Id(15000)); ps.Backward(); uint expected = num - 15000 - 1; PerformListTest(tbl, ps, expected); }
internal ulong Count(ulong tableID, StringRangeParams ps) { return(Count(tableID, ps.ToByteRangeParams())); }
public void ListTest5(Table tbl, uint num) { StringRangeParams ps = new StringRangeParams(); ps.Backward(); PerformListTest(tbl, ps, num); }
public void ListTest27(Table tbl, uint num) { for (uint i = num; i > 0; i -= 1000) { StringRangeParams ps = new StringRangeParams(); ps.StartKey(Utils.Id(i)); ps.EndKey(Utils.Id(i - 1000)); ps.Backward(); uint expected; if (i == 22000) expected = 999; else expected = 1000; PerformListTest(tbl, ps, expected); } }
/// <summary> /// Return the number of matching keys in the table. /// </summary> /// <param name="ps">The filter parameters.</param> /// <returns>The number of matching keys in the table.</returns> /// <exception cref="SDBPException"/> /// <seealso cref="Scalien.StringRangeParams"/> /// <seealso cref="Count(ByteRangeParams)"/> public virtual ulong Count(StringRangeParams ps) { return(client.Count(tableID, ps)); }
public void ListTest25(Table tbl, uint num) { StringRangeParams ps = new StringRangeParams(); ps.StartKey(Utils.Id(22000)); ps.EndKey(Utils.Id(18000)); ps.Backward(); uint expected = 3999; PerformListTest(tbl, ps, expected); }
public void ListTest26(Table tbl, uint num) { for (uint i = 0; i < num; i += 1000) { StringRangeParams ps = new StringRangeParams(); ps.StartKey(Utils.Id(i)); ps.EndKey(Utils.Id(i + 1000)); uint expected = 1000; PerformListTest(tbl, ps, expected); } }
public void ListTest22(Table tbl, uint num) { StringRangeParams ps = new StringRangeParams(); ps.StartKey(Utils.Id(10000)); ps.EndKey(Utils.Id(13000)); uint expected = 3000; PerformListTest(tbl, ps, expected); }
public void ListTest19(Table tbl, uint num) { StringRangeParams ps = new StringRangeParams(); ps.StartKey(Utils.Id(12000)); ps.Prefix("0000000013"); ps.Backward(); uint expected = 0; PerformListTest(tbl, ps, expected); }
public void ListTest17(Table tbl, uint num) { StringRangeParams ps = new StringRangeParams(); ps.Prefix("000000002"); ps.Backward(); uint expected = 2000; PerformListTest(tbl, ps, expected); }
/// <summary> /// Return the number of matching keys in the table. /// </summary> /// <param name="ps">The filter parameters.</param> /// <returns>The number of matching keys in the table.</returns> /// <exception cref="SDBPException"/> /// <seealso cref="Scalien.StringRangeParams"/> /// <seealso cref="Count(ByteRangeParams)"/> public ulong Count(StringRangeParams ps) { return client.Count(tableID, ps); }
public void ListTest29(Table tbl, uint num) { for (uint i = 0; i < (num/1000); i++) { StringRangeParams ps = new StringRangeParams(); ps.Prefix("00000000" + i.ToString("D2")); ps.Backward(); uint expected = 1000; PerformListTest(tbl, ps, expected); } }
/// <summary> /// Return an iterator that will return keys and values as a <see cref="System.Collections.Generic.KeyValuePair{T, T}"/>. /// </summary> /// <param name="ps">The parameters of iteration, as a <see cref="Scalien.StringRangeParams"/>.</param> /// <returns>The iterator.</returns> /// <example><code> /// db = client.GetDatabase("testDatabase"); /// table = db.GetTable("testTable"); /// foreach (KeyValuePair<string, string> kv in table.GetKeyValueIterator(new StringRangeParams().Prefix("foo"))) /// System.Console.WriteLine(kv.Key + " => " + kv.Value); /// </code></example> /// <seealso cref="System.Collections.Generic.KeyValuePair{T, T}"/> /// <seealso cref="Scalien.StringRangeParams"/> /// <seealso cref="GetKeyValueIterator(ByteRangeParams)"/> /// <seealso cref="GetKeyIterator(StringRangeParams)"/> /// <seealso cref="GetKeyIterator(ByteRangeParams)"/> public StringKeyValueIterator GetKeyValueIterator(StringRangeParams ps) { return new StringKeyValueIterator(this, ps); }
public void ListTest3(Table tbl, uint num) { uint count = 100; StringRangeParams ps = new StringRangeParams(); ps.StartKey(Utils.Id(100)); ps.Count(count); ps.Backward(); uint expected = count; PerformListTest(tbl, ps, expected); }
/// <summary> /// Return an iterator that will return keys and values as a <see cref="System.Collections.Generic.KeyValuePair{T, T}"/>. /// </summary> /// <param name="ps">The parameters of iteration, as a <see cref="Scalien.StringRangeParams"/>.</param> /// <returns>The iterator.</returns> /// <example><code> /// db = client.GetDatabase("testDatabase"); /// table = db.GetTable("testTable"); /// foreach (KeyValuePair<string, string> kv in table.GetKeyValueIterator(new StringRangeParams().Prefix("foo"))) /// System.Console.WriteLine(kv.Key + " => " + kv.Value); /// </code></example> /// <seealso cref="System.Collections.Generic.KeyValuePair{T, T}"/> /// <seealso cref="Scalien.StringRangeParams"/> /// <seealso cref="GetKeyValueIterator(ByteRangeParams)"/> /// <seealso cref="GetKeyIterator(StringRangeParams)"/> /// <seealso cref="GetKeyIterator(ByteRangeParams)"/> public virtual StringKeyValueIterator GetKeyValueIterator(StringRangeParams ps) { return(new StringKeyValueIterator(this, ps)); }
/// <summary> /// Return an iterator that will return only keys. /// </summary> /// <param name="ps">The parameters of iteration, as a <see cref="Scalien.StringRangeParams"/>.</param> /// <returns>The iterator.</returns> /// <example><code> /// db = client.GetDatabase("testDatabase"); /// table = db.GetTable("testTable"); /// foreach (string s in table.GetKeyIterator(new StringRangeParams().Prefix("foo"))) /// System.Console.WriteLine(s); /// </code></example> /// <seealso cref="Scalien.StringRangeParams"/> /// <seealso cref="GetKeyIterator(ByteRangeParams)"/> /// <seealso cref="GetKeyValueIterator(StringRangeParams)"/> /// <seealso cref="GetKeyValueIterator(ByteRangeParams)"/> public virtual StringKeyIterator GetKeyIterator(StringRangeParams ps) { return new StringKeyIterator(this, ps); }