public void RunWithDefaultSerializedBin() { Key key = new Key(NS, SET, "accountId"); object value1 = new CompoundObject("IBM", 100); object value2 = new CompoundObject("GE", 500); object value3 = new CompoundObject("AAPL", 75); // Delete record if it already exists. client.Delete(null, key); // Initialize large list operator. Aerospike.Helper.Collections.LargeList list = new Aerospike.Helper.Collections.LargeList(client, null, key, "trades"); // Write trades Dictionary <string, Value> dict = new Dictionary <string, Value>(); DateTime timestamp1 = new DateTime(2014, 6, 25, 12, 18, 43); dict["key"] = Value.Get(timestamp1.Ticks); dict["value"] = Value.Get(value1); list.Add(Value.Get(dict)); DateTime timestamp2 = new DateTime(2014, 6, 26, 9, 33, 17); dict["key"] = Value.Get(timestamp2.Ticks); dict["value"] = Value.Get(value2); list.Add(Value.Get(dict)); DateTime timestamp3 = new DateTime(2014, 6, 27, 14, 40, 19); dict["key"] = Value.Get(timestamp3.Ticks); dict["value"] = Value.Get(value3); list.Add(Value.Get(dict)); // Verify list size int size = list.Size(); Assert.AreEqual(size, 3); // Filter on range of timestamps DateTime begin = new DateTime(2014, 6, 26); DateTime end = new DateTime(2014, 6, 28); IList results = list.Range(Value.Get(begin.Ticks), Value.Get(end.Ticks)); Assert.AreEqual(results.Count, 2); // Verify data. ValidateDefault(results, 0, timestamp2, value2); ValidateDefault(results, 1, timestamp3, value3); Console.WriteLine("Data matched."); }
public override bool Equals(object other) { CompoundObject o = (CompoundObject)other; return(this.a.Equals(o.a) && this.b == o.b); }
public void RunWithDefaultSerializedBin() { Key key = new Key(NS, SET, "accountId"); object value1 = new CompoundObject("IBM", 100); object value2 = new CompoundObject("GE", 500); object value3 = new CompoundObject("AAPL", 75); // Delete record if it already exists. client.Delete(null, key); // Initialize large list operator. Aerospike.Helper.Collections.LargeList list = new Aerospike.Helper.Collections.LargeList(client, null, key, "trades"); // Write trades Dictionary<string, Value> dict = new Dictionary<string, Value>(); DateTime timestamp1 = new DateTime(2014, 6, 25, 12, 18, 43); dict["key"] = Value.Get(timestamp1.Ticks); dict["value"] = Value.Get(value1); list.Add(Value.Get(dict)); DateTime timestamp2 = new DateTime(2014, 6, 26, 9, 33, 17); dict["key"] = Value.Get(timestamp2.Ticks); dict["value"] = Value.Get(value2); list.Add(Value.Get(dict)); DateTime timestamp3 = new DateTime(2014, 6, 27, 14, 40, 19); dict["key"] = Value.Get(timestamp3.Ticks); dict["value"] = Value.Get(value3); list.Add(Value.Get(dict)); // Verify list size int size = list.Size(); Assert.AreEqual (size, 3); // Filter on range of timestamps DateTime begin = new DateTime(2014, 6, 26); DateTime end = new DateTime(2014, 6, 28); IList results = list.Range(Value.Get(begin.Ticks), Value.Get(end.Ticks)); Assert.AreEqual (results.Count, 2); // Verify data. ValidateDefault(results, 0, timestamp2, value2); ValidateDefault(results, 1, timestamp3, value3); Console.WriteLine("Data matched."); }