예제 #1
0
        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;
        }
예제 #2
0
        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;
        }
예제 #3
0
        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;
        }