Permalink
Browse files

Went back to ColumnFamilyOperation<IEnumerable<TResult>> instead of C…

…olumnFamilyOperation<IList<TResult>>
  • Loading branch information...
1 parent 175069e commit a28b68aa5c9bc91ac655bfd057737fdc05867630 @eplowe eplowe committed Nov 25, 2012
View
@@ -20,6 +20,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1A88B962
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentCassandra.Tests", "test\FluentCassandra.Tests\FluentCassandra.Tests.csproj", "{9DAF7022-5820-4214-B13E-AC0A1B37691F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPoolExhaustion", "..\..\dev\BTCassandra.Interop\ConsoleApplication2\TestPoolExhaustion.csproj", "{63108852-4D94-4726-8EE3-5DE5D50963E8}"
+EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = FluentCassandra.vsmdi
@@ -63,6 +65,16 @@ Global
{9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9DAF7022-5820-4214-B13E-AC0A1B37691F}.Release|x86.ActiveCfg = Release|Any CPU
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Debug|x86.ActiveCfg = Debug|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Debug|x86.Build.0 = Debug|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Release|Any CPU.ActiveCfg = Release|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Release|Mixed Platforms.Build.0 = Release|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Release|x86.ActiveCfg = Release|x86
+ {63108852-4D94-4726-8EE3-5DE5D50963E8}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -8,9 +8,7 @@ namespace FluentCassandra.Operations
{
public class CassandraSlicePredicateQuery<TResult> : IEnumerable<TResult>
{
- private IEnumerator<TResult> _internalList;
-
- internal CassandraSlicePredicateQuery(BaseCassandraColumnFamily family, Expression expression)
+ internal CassandraSlicePredicateQuery(BaseCassandraColumnFamily family, Expression expression)
{
Family = family;
Expression = expression;
@@ -24,10 +22,7 @@ internal CassandraSlicePredicateQuery(BaseCassandraColumnFamily family, Expressi
public IEnumerator<TResult> GetEnumerator()
{
- if (_internalList == null)
- _internalList = Family.ExecuteCassandraSlicePredicateQuery(this).GetEnumerator();
-
- return _internalList;
+ return Family.ExecuteCassandraSlicePredicateQuery(this).GetEnumerator();
}
#endregion
@@ -13,41 +13,38 @@ public class GetColumnFamilyIndexedSlices : QueryableColumnFamilyOperation<Fluen
public CassandraIndexClause IndexClause { get; private set; }
- public override IList<FluentColumnFamily> Execute()
+ public override IEnumerable<FluentColumnFamily> Execute()
{
- return GetFamilies(ColumnFamily);
- }
-
- private IList<FluentColumnFamily> GetFamilies(BaseCassandraColumnFamily columnFamily)
- {
- var schema = ColumnFamily.GetSchema();
+ var schema = ColumnFamily.GetSchema();
var list = new List<FluentColumnFamily>();
- var parent = new CassandraColumnParent {
- ColumnFamily = columnFamily.FamilyName
- };
+ var parent = new CassandraColumnParent
+ {
+ ColumnFamily = ColumnFamily.FamilyName
+ };
- SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema);
+ SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema);
- var output = Session.GetClient().get_indexed_slices(
- parent,
- IndexClause,
- SlicePredicate,
- Session.ReadConsistency
- );
+ 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);
+ foreach (var result in output)
+ {
+ var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType);
- var r = new FluentColumnFamily(key, columnFamily.FamilyName, columnFamily.GetSchema(), result.Columns.Select(col => {
- return Helper.ConvertColumnToFluentColumn(col.Column, schema);
- }));
- columnFamily.Context.Attach(r);
- r.MutationTracker.Clear();
+ var r = new FluentColumnFamily(key, ColumnFamily.FamilyName, schema, result.Columns.Select(col =>
+ {
+ return Helper.ConvertColumnToFluentColumn(col.Column, schema);
+ }));
+ ColumnFamily.Context.Attach(r);
+ r.MutationTracker.Clear();
list.Add(r);
- }
+ }
return list;
}
@@ -9,40 +9,37 @@ public class GetColumnFamilyRangeSlices : QueryableColumnFamilyOperation<FluentC
{
public CassandraKeyRange KeyRange { get; private set; }
- public override IList<FluentColumnFamily> Execute()
+ public override IEnumerable<FluentColumnFamily> Execute()
{
- return GetFamilies(ColumnFamily);
- }
-
- private IList<FluentColumnFamily> GetFamilies(BaseCassandraColumnFamily columnFamily)
- {
- var schema = ColumnFamily.GetSchema();
+ var schema = ColumnFamily.GetSchema();
var list = new List<FluentColumnFamily>();
- var parent = new CassandraColumnParent {
- ColumnFamily = columnFamily.FamilyName
- };
-
- SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema);
-
- var output = Session.GetClient().get_range_slices(
- parent,
- SlicePredicate,
- KeyRange,
- Session.ReadConsistency
- );
-
- foreach (var result in output)
- {
- var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType);
-
- var r = new FluentColumnFamily(key, columnFamily.FamilyName, columnFamily.GetSchema(), result.Columns.Select(col => {
- return Helper.ConvertColumnToFluentColumn(col.Column, schema);
- }));
- columnFamily.Context.Attach(r);
- r.MutationTracker.Clear();
+ var parent = new CassandraColumnParent
+ {
+ ColumnFamily = ColumnFamily.FamilyName
+ };
+
+ SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema);
+
+ var output = Session.GetClient().get_range_slices(
+ parent,
+ SlicePredicate,
+ KeyRange,
+ Session.ReadConsistency
+ );
+
+ foreach (var result in output)
+ {
+ var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType);
+
+ var r = new FluentColumnFamily(key, ColumnFamily.FamilyName, schema, result.Columns.Select(col =>
+ {
+ return Helper.ConvertColumnToFluentColumn(col.Column, schema);
+ }));
+ ColumnFamily.Context.Attach(r);
+ r.MutationTracker.Clear();
list.Add(r);
- }
+ }
return list;
}
@@ -13,7 +13,7 @@ public class GetSuperColumnFamilyIndexedSlices : QueryableColumnFamilyOperation<
public CassandraIndexClause IndexClause { get; private set; }
- public override IList<FluentSuperColumnFamily> Execute()
+ public override IEnumerable<FluentSuperColumnFamily> Execute()
{
var schema = ColumnFamily.GetSchema();
var list = new List<FluentSuperColumnFamily>();
@@ -35,7 +35,7 @@ public override IList<FluentSuperColumnFamily> Execute()
{
var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType);
- var r = new FluentSuperColumnFamily(key, ColumnFamily.FamilyName, ColumnFamily.GetSchema(), result.Columns.Select(col => {
+ 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();
@@ -11,7 +11,7 @@ public class GetSuperColumnFamilyRangeSlices : QueryableColumnFamilyOperation<Fl
public CassandraObject SuperColumnName { get; private set; }
- public override IList<FluentSuperColumnFamily> Execute()
+ public override IEnumerable<FluentSuperColumnFamily> Execute()
{
var schema = ColumnFamily.GetSchema();
var list = new List<FluentSuperColumnFamily>();
@@ -13,7 +13,7 @@ public class MultiGetColumnFamilySlice : QueryableColumnFamilyOperation<FluentCo
public List<CassandraObject> Keys { get; private set; }
- public override IList<FluentColumnFamily> Execute()
+ public override IEnumerable<FluentColumnFamily> Execute()
{
var schema = ColumnFamily.GetSchema();
var list = new List<FluentColumnFamily>();
@@ -11,7 +11,7 @@ public class MultiGetSuperColumnFamilySlice : QueryableColumnFamilyOperation<Flu
public CassandraObject SuperColumnName { get; private set; }
- public override IList<FluentSuperColumnFamily> Execute()
+ public override IEnumerable<FluentSuperColumnFamily> Execute()
{
var schema = ColumnFamily.GetSchema();
var list = new List<FluentSuperColumnFamily>();
@@ -3,7 +3,7 @@
namespace FluentCassandra.Operations
{
- public abstract class QueryableColumnFamilyOperation<TResult> : ColumnFamilyOperation<IList<TResult>>
+ public abstract class QueryableColumnFamilyOperation<TResult> : ColumnFamilyOperation<IEnumerable<TResult>>
{
public CassandraSlicePredicate SlicePredicate { get; internal protected set; }
}

0 comments on commit a28b68a

Please sign in to comment.