Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 56 lines (45 sloc) 1.446 kb
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
1 using System;
2 using System.Collections.Generic;
3 using FluentCassandra.Types;
4
5 namespace FluentCassandra.Operations
6 {
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
7 public class GetColumnFamilySlice : ColumnFamilyOperation<FluentColumnFamily>
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
8 {
9 /*
10 * list<ColumnOrSuperColumn> get_slice(keyspace, key, column_parent, predicate, consistency_level)
11 */
12
d576460 @nberardi made the type system more robus to support parsing of complex types f…
nberardi authored
13 public CassandraObject Key { get; private set; }
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
14
15 public CassandraSlicePredicate SlicePredicate { get; private set; }
16
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
17 public override FluentColumnFamily Execute()
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
18 {
2f86912 @nberardi all tests now compile, so the new genericless types have been provide…
nberardi authored
19 var result = new FluentColumnFamily(Key, ColumnFamily.FamilyName, ColumnFamily.GetSchema(), GetColumns(ColumnFamily));
9ee2ff9 @nberardi moved provider to cassandra column family object since it made more s…
nberardi authored
20 ColumnFamily.Context.Attach(result);
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
21 result.MutationTracker.Clear();
22
23 return result;
24 }
25
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
26 private IEnumerable<FluentColumn> GetColumns(BaseCassandraColumnFamily columnFamily)
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
27 {
fc725a6 @nberardi fixed issues discovered while running sandbox
nberardi authored
28 var schema = ColumnFamily.GetSchema();
29
2645bc7 @nberardi cleaned up the use of sessions in the code
nberardi authored
30 var parent = new CassandraColumnParent {
31 ColumnFamily = columnFamily.FamilyName
32 };
33
fc725a6 @nberardi fixed issues discovered while running sandbox
nberardi authored
34 SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema);
35
2645bc7 @nberardi cleaned up the use of sessions in the code
nberardi authored
36 var output = Session.GetClient().get_slice(
37 Key,
38 parent,
39 SlicePredicate,
40 Session.ReadConsistency
41 );
42
43 foreach (var result in output)
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
44 {
1c343e3 @nberardi fixed issue #53 where schema wasn't being passed in to the column cre…
nberardi authored
45 var r = Helper.ConvertColumnToFluentColumn(result.Column, schema);
2645bc7 @nberardi cleaned up the use of sessions in the code
nberardi authored
46 yield return r;
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
47 }
48 }
49
d576460 @nberardi made the type system more robus to support parsing of complex types f…
nberardi authored
50 public GetColumnFamilySlice(CassandraObject key, CassandraSlicePredicate columnSlicePredicate)
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
51 {
e06a0b5 @nberardi everything compiles
nberardi authored
52 Key = key;
53 SlicePredicate = columnSlicePredicate;
d7df425 @nberardi reformatted the GetSlice a little to return the column family instead…
nberardi authored
54 }
55 }
56 }
Something went wrong with that request. Please try again.