Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 55 lines (44 sloc) 1.54 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
using System;
using System.Collections.Generic;
using System.Linq;
using FluentCassandra.Types;

namespace FluentCassandra.Operations
{
public class GetSuperColumnFamilyRangeSlices : QueryableColumnFamilyOperation<FluentSuperColumnFamily>
{
public CassandraKeyRange KeyRange { get; private set; }

public CassandraObject SuperColumnName { get; private set; }

public override IEnumerable<FluentSuperColumnFamily> Execute()
{
var schema = ColumnFamily.GetSchema();

var parent = new CassandraColumnParent {
ColumnFamily = ColumnFamily.FamilyName
};

SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema, SuperColumnName == null);

var output = Session.GetClient().get_range_slices(
parent,
SlicePredicate,
KeyRange,
Session.ReadConsistency
);

foreach (var result in output)
{
var r = new FluentSuperColumnFamily(result.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();

yield return r;
}
}

public GetSuperColumnFamilyRangeSlices(CassandraKeyRange keyRange, CassandraObject superColumnName, CassandraSlicePredicate columnSlicePredicate)
{
KeyRange = keyRange;
SuperColumnName = superColumnName;
SlicePredicate = columnSlicePredicate;
}
}
}
Something went wrong with that request. Please try again.