public static void AssertBinEqual(Key key, Record record, String binName, int expected) { AssertRecordFound(key, record); int received = record.GetInt(binName); if (received != expected) { Assert.Fail("Data mismatch: Expected " + expected + ". Received " + received); } }
public void OnRecord(Key key, Record record) { int result = record.GetInt(binName); parent.AssertBetween(26, 34, result); Interlocked.Increment(ref count); }
public bool AssertBinEqual(Key key, Record record, string binName, int expected) { if (!AssertRecordFound(key, record)) { return false; } int received = record.GetInt(binName); if (received != expected) { monitor.SetError("Data mismatch: Expected " + expected + ". Received " + received); } return true; }
public void OnRecord(Key key, Record record) { int result = record.GetInt(binName); parent.console.Info("Result: " + result); }
private string EventToString(Record eventRecord) { // Note: If we want to get a list of all the records to iterate through rather than just the count, // we get the maximum sequence from the count, iterate through the keys from 2->Max Sequence (as we // already have record 1), form a list of keys then do a batch read. This code is provided for clarity String user = eventRecord.GetString("user-id"); String dateStr = eventRecord.GetString ("day"); List<Object> events = (List<Object>) eventRecord.GetValue ("events"); int count = eventRecord.GetInt ("total-records"); if (count < 0) { // Another thread has this record locked. Either retry or throw an exception throw new AerospikeException ("Record locked"); } // TODO: We really need to obtain a lock to the record by setting total-records to -1 whilst we read it. // This is similar to the code in AddEvent, and probably should be put into a common routine. Otherwise // we risk the collection changing whilst we're still using it. List<Key> keyList = new List<Key> (); for (int i = 2; i <= GetSequenceNumberFromRecordNumber (count); i++) { keyList.Add (new Key ("test", "user-events", FormKeyString (user, dateStr, i))); } Key[] keys = keyList.ToArray (); Record[] records = client.Get (null, keys); foreach (Record record in records) { if (record != null) { List<Object> theseEvents = (List<Object>)record.GetValue ("events"); events.AddRange(theseEvents); } } String result = eventRecord.GetString ("user-id") + ":" + eventRecord.GetString ("day") + ":" + eventRecord.GetInt ("sequence") + ":" + events.Count; return result; }