Exemplo n.º 1
0
        public static Apache.Cassandra.KeyRange ToThrift(this KeyRange keyRange)
        {
            var kr = new Apache.Cassandra.KeyRange();

            if (!string.IsNullOrEmpty(keyRange.StartKey))
            {
                kr.Start_key = keyRange.StartKey;
            }
            if (!string.IsNullOrEmpty(keyRange.EndKey))
            {
                kr.End_key = keyRange.EndKey;
            }
            if (!string.IsNullOrEmpty(keyRange.StartToken))
            {
                kr.Start_token = keyRange.StartToken;
            }
            if (!string.IsNullOrEmpty(keyRange.EndToken))
            {
                kr.End_token = keyRange.EndToken;
            }
            kr.Count = keyRange.Count;
            return(kr);
        }
Exemplo n.º 2
0
        public IDictionary <string, IList <Column> > GetRangeSlices(ColumnParent columnParent, SlicePredicate predicate, KeyRange keyRange)
        {
            var op = new Operation <IDictionary <string, IList <Column> > >(ClientCounter.READ_FAIL,
                                                                            client =>
            {
                var result = new Dictionary <string, IList <Column> >();

                var keySlices = client.get_range_slices(Name, columnParent.ToThrift(), predicate.ToThrift(), keyRange.ToThrift(), 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);
        }
Exemplo n.º 3
0
        public IDictionary<string, IList<Column>> GetRangeSlices(ColumnParent columnParent, SlicePredicate predicate, KeyRange keyRange)
        {
            var op = new Operation<IDictionary<string, IList<Column>>>(ClientCounter.READ_FAIL,
                client =>
                {
                    var result = new Dictionary<string, IList<Column>>();

                    var keySlices = client.get_range_slices(Name, columnParent.ToThrift(), predicate.ToThrift(), keyRange.ToThrift(), 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;
        }