public IDictionary<string, IList<SuperColumn>> MultigetSuperSlice(IList<string> keys, ColumnParent columnParent, SlicePredicate predicate) { var op = new Operation<IDictionary<string, IList<SuperColumn>>>(ClientCounter.READ_FAIL, client => { var result = new Dictionary<string, IList<SuperColumn>>(); var cfmap = client.multiget_slice(Name, new List<string>(keys), columnParent.ToThrift(), predicate.ToThrift(), ConsistencyLevel.ToThrift()); if (string.IsNullOrEmpty(columnParent.SuperColumn)) { foreach (var entry in cfmap.Transform(m => new { m.Key, List = GetSuperColumnList(m.Value) })) result.Add(entry.Key, entry.List); } else { foreach (var entry in cfmap.Transform(m => new { m.Key, List = new List<SuperColumn> { new SuperColumn(columnParent.SuperColumn, GetColumnList(m.Value)) } })) result.Add(entry.Key, entry.List); } return result; } ); OperateWithFailover(op); return op.Result; }
public IEnumerable<SuperColumn> GetSuperSlice(string key, ColumnParent columnParent, SlicePredicate predicate) { var op = new Operation<IEnumerable<SuperColumn>>(ClientCounter.READ_FAIL, client => { return client.get_slice(Name, key, columnParent.ToThrift(), predicate.ToThrift(), ConsistencyLevel.ToThrift()) .Transform(c => c.Super_column.ToModel()); }); OperateWithFailover(op); return op.Result; }
public IDictionary<string, SuperColumn> MultigetSuperColumn(IList<string> keys, ColumnPath columnPath, bool reversed, int size) { AssertSuperColumnPath(columnPath); var result = new Dictionary<string, SuperColumn>(); // only can get supercolumn by multigetSuperSlice var clp = new ColumnParent(columnPath.ColumnFamily, columnPath.SuperColumn); var sr = new SliceRange(reversed, size); var sp = new SlicePredicate(sr); var sclist = MultigetSuperSlice(keys, clp, sp); if (sclist == null || sclist.Count == 0) return result; foreach (var sc in sclist) if (sc.Value.Count > 0) result.Add(sc.Key, sc.Value[0]); return result; }
public IDictionary<string, IList<Column>> GetRangeSlice(ColumnParent columnParent, SlicePredicate predicate, string start, string finish, int count) { var op = new Operation<IDictionary<string, IList<Column>>>(ClientCounter.READ_FAIL, client => { var result = new Dictionary<string, IList<Column>>(); var keySlices = client.get_range_slice(Name, columnParent.ToThrift(), predicate.ToThrift(), start, finish, count, ConsistencyLevel.ToThrift()); if (keySlices == null || keySlices.Count == 0) return result; foreach (var entry in keySlices.Transform(entry => new { entry.Key, Columns = GetColumnList(entry.Columns) })) result.Add(entry.Key, entry.Columns); return result; }); OperateWithFailover(op); return op.Result; }