Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

61 lines (48 sloc) 1.711 kb
using System;
using System.Collections.Generic;
using System.Linq;
using FluentCassandra.Types;
namespace FluentCassandra.Operations
{
public class GetSuperColumnFamilyIndexedSlices : QueryableColumnFamilyOperation<FluentSuperColumnFamily>
{
/*
* list<KeySlice> get_range_slices(keyspace, column_parent, predicate, range, consistency_level)
*/
public CassandraIndexClause IndexClause { get; private set; }
public override IEnumerable<FluentSuperColumnFamily> Execute()
{
var schema = ColumnFamily.GetSchema();
var list = new List<FluentSuperColumnFamily>();
var parent = new CassandraColumnParent {
ColumnFamily = ColumnFamily.FamilyName
};
SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema);
var output = Session.GetClient().get_indexed_slices(
parent,
IndexClause,
SlicePredicate,
Session.ReadConsistency
);
foreach (var result in output)
{
var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType);
var r = new FluentSuperColumnFamily(key, ColumnFamily.FamilyName, schema, result.Columns.Select(col => {
var superCol = Helper.ConvertSuperColumnToFluentSuperColumn(col.Super_column, schema);
ColumnFamily.Context.Attach(superCol);
superCol.MutationTracker.Clear();
return superCol;
}));
ColumnFamily.Context.Attach(r);
r.MutationTracker.Clear();
list.Add(r);
}
return list;
}
public GetSuperColumnFamilyIndexedSlices(CassandraIndexClause indexClause, CassandraSlicePredicate columnSlicePredicate)
{
IndexClause = indexClause;
SlicePredicate = columnSlicePredicate;
}
}
}
Jump to Line
Something went wrong with that request. Please try again.