Permalink
Browse files

still working on getting the app to compile after the breaking change…

…s in 0.7
  • Loading branch information...
1 parent 3561921 commit 365b68345194d3e87bf6caa36d3a91ee2e8d841b @nberardi nberardi committed Aug 23, 2010
Showing with 256 additions and 230 deletions.
  1. +0 −17 FluentCassandra/CassandraContext.cs
  2. +14 −8 FluentCassandra/CassandraSession.cs
  3. +0 −3 FluentCassandra/Connection/Connection.cs
  4. +6 −0 FluentCassandra/Connection/ConnectionBuilder.cs
  5. +9 −0 FluentCassandra/Connection/ConnectionProvider.cs
  6. +3 −0 FluentCassandra/Connection/NormalConnectionProvider.cs
  7. +14 −1 FluentCassandra/FluentCassandra.csproj
  8. +1 −2 FluentCassandra/Operations/BatchMutate.cs
  9. +0 −1 FluentCassandra/Operations/ColumnCount.cs
  10. +5 −47 FluentCassandra/Operations/GetColumn.cs
  11. +0 −1 FluentCassandra/Operations/GetColumnFamilyRangeSlice.cs
  12. +0 −1 FluentCassandra/Operations/GetColumnFamilySlice.cs
  13. +43 −0 FluentCassandra/Operations/GetSuperColumn.cs
  14. +2 −3 FluentCassandra/Operations/GetSuperColumnFamilyRangeSlice.cs
  15. +0 −1 FluentCassandra/Operations/GetSuperColumnFamilySlice.cs
  16. +0 −1 FluentCassandra/Operations/GetSuperColumnRangeSlice.cs
  17. +0 −1 FluentCassandra/Operations/GetSuperColumnSlice.cs
  18. +9 −10 FluentCassandra/Operations/InsertColumn.cs
  19. +0 −1 FluentCassandra/Operations/MultiGetColumnFamilySlice.cs
  20. +0 −1 FluentCassandra/Operations/MultiGetSuperColumnFamilySlice.cs
  21. +0 −1 FluentCassandra/Operations/MultiGetSuperColumnSlice.cs
  22. +9 −4 FluentCassandra/Operations/ObjectHelper.cs
  23. +0 −126 FluentCassandra/Operations/Remove.cs
  24. +57 −0 FluentCassandra/Operations/RemoveColumn.cs
  25. +39 −0 FluentCassandra/Operations/RemoveKey.cs
  26. +45 −0 FluentCassandra/Operations/RemoveSuperColumn.cs
View
17 FluentCassandra/CassandraContext.cs
@@ -45,30 +45,13 @@ public CassandraContext(string connectionString)
/// </summary>
/// <param name="connectionBuilder"></param>
public CassandraContext(ConnectionBuilder connectionBuilder)
- : this(connectionBuilder.Keyspace, connectionBuilder) { }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="keyspace"></param>
- /// <param name="connectionBuilder"></param>
- public CassandraContext(string keyspace, ConnectionBuilder connectionBuilder)
{
- if (String.IsNullOrEmpty(keyspace))
- throw new ArgumentNullException("keyspace");
-
- Keyspace = new CassandraKeyspace(keyspace);
CurrentConnectionBuilder = connectionBuilder;
_trackers = new List<IFluentMutationTracker>();
}
/// <summary>
- /// Gets the database.
- /// </summary>
- public CassandraKeyspace Keyspace { get; private set; }
-
- /// <summary>
/// Gets a typed column family.
/// </summary>
/// <typeparam name="CompareWith"></typeparam>
View
22 FluentCassandra/CassandraSession.cs
@@ -79,6 +79,7 @@ public CassandraSession(IConnectionProvider connectionProvider, ConsistencyLevel
ConnectionProvider = connectionProvider;
ReadConsistency = read;
WriteConsistency = write;
+ Keyspace = new CassandraKeyspace(connectionProvider.Builder.Keyspace);
Current = this;
}
@@ -90,6 +91,11 @@ public CassandraSession(Server server)
}
/// <summary>
+ /// Gets ConnectionProvider.
+ /// </summary>
+ public IConnectionProvider ConnectionProvider { get; private set; }
+
+ /// <summary>
///
/// </summary>
public ConsistencyLevel ReadConsistency { get; private set; }
@@ -100,9 +106,9 @@ public CassandraSession(Server server)
public ConsistencyLevel WriteConsistency { get; private set; }
/// <summary>
- /// Gets ConnectionProvider.
+ ///
/// </summary>
- public IConnectionProvider ConnectionProvider { get; private set; }
+ public CassandraKeyspace Keyspace { get; private set; }
/// <summary>
///
@@ -134,24 +140,24 @@ public void Dispose()
/// </param>
protected virtual void Dispose(bool disposing)
{
- if (!this._disposed && disposing)
+ if (!_disposed && disposing)
{
- if (this._connection != null)
- this.ConnectionProvider.Close(this._connection);
+ if (_connection != null)
+ ConnectionProvider.Close(_connection);
if (Current == this)
Current = null;
}
- this._disposed = true;
+ _disposed = true;
}
/// <summary>
- /// Finalizes an instance of the <see cref="Mongo"/> class.
+ /// Finalizes an instance of the <see cref="CassandraSession"/> class.
/// </summary>
~CassandraSession()
{
- this.Dispose(false);
+ Dispose(false);
}
#endregion
View
3 FluentCassandra/Connection/Connection.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using Thrift.Transport;
using Thrift.Protocol;
using Apache.Cassandra;
View
6 FluentCassandra/Connection/ConnectionBuilder.cs
@@ -61,7 +61,13 @@ private void InitializeConnectionString(string connectionString)
#region Keyspace
if (pairs.ContainsKey("Keyspace"))
+ {
Keyspace = pairs["Keyspace"];
+ }
+ else
+ {
+ throw new CassandraException("Keyspace is required.");
+ }
#endregion
View
9 FluentCassandra/Connection/ConnectionProvider.cs
@@ -30,6 +30,15 @@ protected ConnectionProvider(ConnectionBuilder builder)
/// <summary>
///
/// </summary>
+ /// <param name="connection"></param>
+ public virtual void SetKeyspace(IConnection connection)
+ {
+ connection.Client.set_keyspace(Builder.Keyspace);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
/// <returns></returns>
public virtual IConnection Open()
{
View
3 FluentCassandra/Connection/NormalConnectionProvider.cs
@@ -88,6 +88,9 @@ public override IConnection CreateConnection()
var server = Builder.Servers[_random.Next(ActiveServers.Count)];
var conn = new Connection(server, Timeout);
+
+ SetKeyspace(conn);
+
return conn;
}
}
View
15 FluentCassandra/FluentCassandra.csproj
@@ -52,20 +52,30 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Apache\Cassandra\AccessLevel.cs" />
<Compile Include="Apache\Cassandra\AuthenticationException.cs" />
<Compile Include="Apache\Cassandra\AuthenticationRequest.cs" />
<Compile Include="Apache\Cassandra\AuthorizationException.cs" />
<Compile Include="Apache\Cassandra\Cassandra.cs" />
+ <Compile Include="Apache\Cassandra\CfDef.cs" />
+ <Compile Include="Apache\Cassandra\Clock.cs" />
<Compile Include="Apache\Cassandra\Column.cs" />
+ <Compile Include="Apache\Cassandra\ColumnDef.cs" />
<Compile Include="Apache\Cassandra\ColumnOrSuperColumn.cs" />
<Compile Include="Apache\Cassandra\ColumnParent.cs" />
<Compile Include="Apache\Cassandra\ColumnPath.cs" />
<Compile Include="Apache\Cassandra\ConsistencyLevel.cs" />
<Compile Include="Apache\Cassandra\Constants.cs" />
<Compile Include="Apache\Cassandra\Deletion.cs" />
+ <Compile Include="Apache\Cassandra\IndexClause.cs" />
+ <Compile Include="Apache\Cassandra\IndexExpression.cs" />
+ <Compile Include="Apache\Cassandra\IndexOperator.cs" />
+ <Compile Include="Apache\Cassandra\IndexType.cs" />
<Compile Include="Apache\Cassandra\InvalidRequestException.cs" />
+ <Compile Include="Apache\Cassandra\KeyCount.cs" />
<Compile Include="Apache\Cassandra\KeyRange.cs" />
<Compile Include="Apache\Cassandra\KeySlice.cs" />
+ <Compile Include="Apache\Cassandra\KsDef.cs" />
<Compile Include="Apache\Cassandra\Mutation.cs" />
<Compile Include="Apache\Cassandra\NotFoundException.cs" />
<Compile Include="Apache\Cassandra\SlicePredicate.cs" />
@@ -140,6 +150,7 @@
<Compile Include="Operations\CassandraQueryable.cs" />
<Compile Include="Operations\CassandraSlicePredicateBuilder.cs" />
<Compile Include="Operations\ContextOperation.cs" />
+ <Compile Include="Operations\GetSuperColumn.cs" />
<Compile Include="Operations\ICassandraQueryable.cs" />
<Compile Include="Operations\CassandraSlicePredicateQuery.cs" />
<Compile Include="Operations\CassandraKeyRange.cs" />
@@ -163,7 +174,9 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Operations\QueryableColumnFamilyOperation.cs" />
- <Compile Include="Operations\Remove.cs" />
+ <Compile Include="Operations\RemoveColumn.cs" />
+ <Compile Include="Operations\RemoveKey.cs" />
+ <Compile Include="Operations\RemoveSuperColumn.cs" />
<Compile Include="Operations\Void.cs">
<SubType>Code</SubType>
</Compile>
View
3 FluentCassandra/Operations/BatchMutate.cs
@@ -16,7 +16,7 @@ public class BatchMutate : ContextOperation<Void>
public override Void Execute(CassandraContext context)
{
- var mutationMap = new Dictionary<string, Dictionary<string, List<Mutation>>>();
+ var mutationMap = new Dictionary<byte[], Dictionary<string, List<Mutation>>>();
foreach (var key in Mutations.GroupBy(x => x.Column.Family.Key))
{
@@ -49,7 +49,6 @@ public override Void Execute(CassandraContext context)
// Dictionary<string : key, Dicationary<string : columnFamily, List<Mutation>>>
CassandraSession.Current.GetClient().batch_mutate(
- context.Keyspace.KeyspaceName,
mutationMap,
CassandraSession.Current.WriteConsistency
);
View
1 FluentCassandra/Operations/ColumnCount.cs
@@ -29,7 +29,6 @@ public override int Execute(BaseCassandraColumnFamily columnFamily)
parent.Super_column = SuperColumnName;
var result = CassandraSession.Current.GetClient().get_count(
- columnFamily.Keyspace.KeyspaceName,
Key,
parent,
CassandraSession.Current.ReadConsistency
View
52 FluentCassandra/Operations/GetColumn.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using FluentCassandra.Types;
using Apache.Cassandra;
@@ -33,7 +30,6 @@ public override IFluentColumn<CompareWith> Execute(BaseCassandraColumnFamily col
path.Column = ColumnName;
var output = CassandraSession.Current.GetClient().get(
- columnFamily.Keyspace.KeyspaceName,
Key,
path,
CassandraSession.Current.ReadConsistency
@@ -44,53 +40,15 @@ public override IFluentColumn<CompareWith> Execute(BaseCassandraColumnFamily col
public GetColumn(string key, CassandraType superColumnName, CassandraType columnName)
{
- this.Key = key;
- this.SuperColumnName = superColumnName;
- this.ColumnName = columnName;
+ Key = key;
+ SuperColumnName = superColumnName;
+ ColumnName = columnName;
}
public GetColumn(string key, CassandraType columnName)
{
- this.Key = key;
- this.ColumnName = columnName;
- }
- }
-
- public class GetSuperColumn<CompareWith, CompareSubcolumnWith> : ColumnFamilyOperation<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>>
- where CompareWith : CassandraType
- where CompareSubcolumnWith : CassandraType
- {
- /*
- * ColumnOrSuperColumn get(keyspace, key, column_path, consistency_level)
- */
-
- public string Key { get; private set; }
-
- public CassandraType SuperColumnName { get; private set; }
-
- public override IFluentSuperColumn<CompareWith, CompareSubcolumnWith> Execute(BaseCassandraColumnFamily columnFamily)
- {
- var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
- };
-
- if (SuperColumnName != null)
- path.Super_column = SuperColumnName;
-
- var output = CassandraSession.Current.GetClient().get(
- columnFamily.Keyspace.KeyspaceName,
- Key,
- path,
- CassandraSession.Current.ReadConsistency
- );
-
- return (IFluentSuperColumn<CompareWith, CompareSubcolumnWith>)ObjectHelper.ConvertToFluentBaseColumn<CompareWith, CompareSubcolumnWith>(output);
- }
-
- public GetSuperColumn(string key, CassandraType superColumnName)
- {
- this.Key = key;
- this.SuperColumnName = superColumnName;
+ Key = key;
+ ColumnName = columnName;
}
}
}
View
1 FluentCassandra/Operations/GetColumnFamilyRangeSlice.cs
@@ -34,7 +34,6 @@ private IEnumerable<IFluentColumnFamily<CompareWith>> GetFamilies(BaseCassandraC
};
var output = CassandraSession.Current.GetClient().get_range_slices(
- columnFamily.Keyspace.KeyspaceName,
parent,
SlicePredicate.CreateSlicePredicate(),
KeyRange.CreateKeyRange(),
View
1 FluentCassandra/Operations/GetColumnFamilySlice.cs
@@ -40,7 +40,6 @@ private IEnumerable<IFluentColumn<CompareWith>> GetColumns(BaseCassandraColumnFa
};
var output = CassandraSession.Current.GetClient().get_slice(
- columnFamily.Keyspace.KeyspaceName,
Key,
parent,
SlicePredicate.CreateSlicePredicate(),
View
43 FluentCassandra/Operations/GetSuperColumn.cs
@@ -0,0 +1,43 @@
+using System;
+using FluentCassandra.Types;
+using Apache.Cassandra;
+
+namespace FluentCassandra.Operations
+{
+ public class GetSuperColumn<CompareWith, CompareSubcolumnWith> : ColumnFamilyOperation<IFluentSuperColumn<CompareWith, CompareSubcolumnWith>>
+ where CompareWith : CassandraType
+ where CompareSubcolumnWith : CassandraType
+ {
+ /*
+ * ColumnOrSuperColumn get(keyspace, key, column_path, consistency_level)
+ */
+
+ public string Key { get; private set; }
+
+ public CassandraType SuperColumnName { get; private set; }
+
+ public override IFluentSuperColumn<CompareWith, CompareSubcolumnWith> Execute(BaseCassandraColumnFamily columnFamily)
+ {
+ var path = new ColumnPath {
+ Column_family = columnFamily.FamilyName
+ };
+
+ if (SuperColumnName != null)
+ path.Super_column = SuperColumnName;
+
+ var output = CassandraSession.Current.GetClient().get(
+ Key,
+ path,
+ CassandraSession.Current.ReadConsistency
+ );
+
+ return (IFluentSuperColumn<CompareWith, CompareSubcolumnWith>)ObjectHelper.ConvertToFluentBaseColumn<CompareWith, CompareSubcolumnWith>(output);
+ }
+
+ public GetSuperColumn(string key, CassandraType superColumnName)
+ {
+ Key = key;
+ SuperColumnName = superColumnName;
+ }
+ }
+}
View
5 FluentCassandra/Operations/GetSuperColumnFamilyRangeSlice.cs
@@ -35,7 +35,6 @@ public class GetSuperColumnFamilyRangeSlice<CompareWith, CompareSubcolumnWith> :
};
var output = CassandraSession.Current.GetClient().get_range_slices(
- columnFamily.Keyspace.KeyspaceName,
parent,
SlicePredicate.CreateSlicePredicate(),
KeyRange.CreateKeyRange(),
@@ -66,8 +65,8 @@ public class GetSuperColumnFamilyRangeSlice<CompareWith, CompareSubcolumnWith> :
public GetSuperColumnFamilyRangeSlice(CassandraKeyRange keyRange, CassandraSlicePredicate columnSlicePredicate)
{
- this.KeyRange = keyRange;
- this.SlicePredicate = columnSlicePredicate;
+ KeyRange = keyRange;
+ SlicePredicate = columnSlicePredicate;
}
}
}
View
1 FluentCassandra/Operations/GetSuperColumnFamilySlice.cs
@@ -41,7 +41,6 @@ public class GetSuperColumnFamilySlice<CompareWith, CompareSubcolumnWith> : Colu
};
var output = CassandraSession.Current.GetClient().get_slice(
- columnFamily.Keyspace.KeyspaceName,
Key,
parent,
SlicePredicate.CreateSlicePredicate(),
View
1 FluentCassandra/Operations/GetSuperColumnRangeSlice.cs
@@ -40,7 +40,6 @@ public class GetSuperColumnRangeSlice<CompareWith, CompareSubcolumnWith> : Query
parent.Super_column = SuperColumnName;
var output = CassandraSession.Current.GetClient().get_range_slices(
- columnFamily.Keyspace.KeyspaceName,
parent,
SlicePredicate.CreateSlicePredicate(),
KeyRange.CreateKeyRange(),
View
1 FluentCassandra/Operations/GetSuperColumnSlice.cs
@@ -46,7 +46,6 @@ private IEnumerable<IFluentColumn<CompareSubcolumnWith>> GetColumns(BaseCassandr
parent.Super_column = SuperColumnName;
var output = CassandraSession.Current.GetClient().get_slice(
- columnFamily.Keyspace.KeyspaceName,
Key,
parent,
SlicePredicate.CreateSlicePredicate(),
View
19 FluentCassandra/Operations/InsertColumn.cs
@@ -36,7 +36,6 @@ public override Void Execute(BaseCassandraColumnFamily columnFamily)
path.Super_column = SuperColumnName;
CassandraSession.Current.GetClient().insert(
- columnFamily.Keyspace.KeyspaceName,
Key,
path,
ColumnValue,
@@ -51,19 +50,19 @@ public override Void Execute(BaseCassandraColumnFamily columnFamily)
public InsertColumn(string key, CassandraType name, BytesType value, DateTimeOffset timestamp)
{
- this.Key = key;
- this.ColumnName = name;
- this.ColumnValue = value;
- this.Timestamp = timestamp;
+ Key = key;
+ ColumnName = name;
+ ColumnValue = value;
+ Timestamp = timestamp;
}
public InsertColumn(string key, CassandraType superColumnName, CassandraType name, BytesType value, DateTimeOffset timestamp)
{
- this.Key = key;
- this.SuperColumnName = superColumnName;
- this.ColumnName = name;
- this.ColumnValue = value;
- this.Timestamp = timestamp;
+ Key = key;
+ SuperColumnName = superColumnName;
+ ColumnName = name;
+ ColumnValue = value;
+ Timestamp = timestamp;
}
}
}
View
1 FluentCassandra/Operations/MultiGetColumnFamilySlice.cs
@@ -34,7 +34,6 @@ private IEnumerable<IFluentColumnFamily<CompareWith>> GetFamilies(BaseCassandraC
};
var output = CassandraSession.Current.GetClient().multiget_slice(
- columnFamily.Keyspace.KeyspaceName,
Keys,
parent,
SlicePredicate.CreateSlicePredicate(),
View
1 FluentCassandra/Operations/MultiGetSuperColumnFamilySlice.cs
@@ -35,7 +35,6 @@ public class MultiGetSuperColumnFamilySlice<CompareWith, CompareSubcolumnWith> :
};
var output = CassandraSession.Current.GetClient().multiget_slice(
- columnFamily.Keyspace.KeyspaceName,
Keys,
parent,
SlicePredicate.CreateSlicePredicate(),
View
1 FluentCassandra/Operations/MultiGetSuperColumnSlice.cs
@@ -40,7 +40,6 @@ public class MultiGetSuperColumnSlice<CompareWith, CompareSubcolumnWith> : Query
parent.Super_column = SuperColumnName;
var output = CassandraSession.Current.GetClient().multiget_slice(
- columnFamily.Keyspace.KeyspaceName,
Keys,
parent,
SlicePredicate.CreateSlicePredicate(),
View
13 FluentCassandra/Operations/ObjectHelper.cs
@@ -9,6 +9,11 @@ namespace FluentCassandra.Operations
{
internal static class ObjectHelper
{
+ public static Clock ToClock(this DateTimeOffset dt)
+ {
+ return new Clock { Timestamp = DateTimeOffset.Now.UtcTicks };
+ }
+
/// <summary>
///
/// </summary>
@@ -37,7 +42,7 @@ public static FluentColumn<CompareWith> ConvertColumnToFluentColumn<CompareWith>
return new FluentColumn<CompareWith> {
ColumnName = CassandraType.GetType<CompareWith>(col.Name),
ColumnValue = col.Value,
- ColumnTimestamp = new DateTimeOffset(col.Timestamp, TimeSpan.Zero)
+ ColumnTimestamp = new DateTimeOffset(col.Clock.Timestamp, TimeSpan.Zero)
};
}
@@ -70,7 +75,7 @@ public static Mutation CreateDeletedColumnMutation(IEnumerable<FluentMutation> m
var columnNames = mutation.Select(m => m.Column.ColumnName).ToList();
var deletion = new Deletion {
- Timestamp = DateTimeOffset.UtcNow.UtcTicks,
+ Clock = DateTimeOffset.Now.ToClock(),
Predicate = CreateSlicePredicate(columnNames)
};
@@ -90,7 +95,7 @@ public static Mutation CreateDeletedSuperColumnMutation(IEnumerable<FluentMutati
var columnNames = mutation.Select(m => m.Column.ColumnName).ToList();
var deletion = new Deletion {
- Timestamp = DateTimeOffset.UtcNow.UtcTicks,
+ Clock = DateTimeOffset.Now.ToClock(),
Super_column = superColumn,
Predicate = CreateSlicePredicate(columnNames)
};
@@ -125,7 +130,7 @@ public static Column CreateColumn(IFluentColumn column)
return new Column {
Name = column.ColumnName,
Value = column.ColumnValue,
- Timestamp = column.ColumnTimestamp.UtcTicks
+ Clock = column.ColumnTimestamp.ToClock()
};
}
View
126 FluentCassandra/Operations/Remove.cs
@@ -1,126 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Apache.Cassandra;
-using FluentCassandra.Types;
-
-namespace FluentCassandra.Operations
-{
- public class RemoveColumn : ColumnFamilyOperation<Void>
- {
- /*
- * remove(keyspace, key, column_path, timestamp, consistency_level)
- */
-
- public string Key { get; private set; }
-
- public CassandraType SuperColumnName { get; private set; }
-
- public CassandraType ColumnName { get; private set; }
-
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
- {
- var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
- };
-
- if (SuperColumnName != null)
- path.Super_column = SuperColumnName;
-
- if (ColumnName != null)
- path.Column = ColumnName;
-
- CassandraSession.Current.GetClient().remove(
- columnFamily.Keyspace.KeyspaceName,
- Key,
- path,
- DateTimeOffset.Now.UtcTicks,
- CassandraSession.Current.WriteConsistency
- );
-
- return new Void();
- }
-
- public RemoveColumn(string key, CassandraType superColumnName, CassandraType columnName)
- {
- this.Key = key;
- this.SuperColumnName = superColumnName;
- this.ColumnName = columnName;
- }
-
- public RemoveColumn(string key, CassandraType columnName)
- {
- this.Key = key;
- this.ColumnName = columnName;
- }
- }
-
- public class RemoveSuperColumn : ColumnFamilyOperation<Void>
- {
- /*
- * remove(keyspace, key, column_path, timestamp, consistency_level)
- */
-
- public string Key { get; private set; }
-
- public CassandraType SuperColumnName { get; private set; }
-
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
- {
- var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
- };
-
- if (SuperColumnName != null)
- path.Super_column = SuperColumnName;
-
- CassandraSession.Current.GetClient().remove(
- columnFamily.Keyspace.KeyspaceName,
- Key,
- path,
- DateTimeOffset.Now.UtcTicks,
- CassandraSession.Current.WriteConsistency
- );
-
- return new Void();
- }
-
- public RemoveSuperColumn(string key, CassandraType superColumnName)
- {
- this.Key = key;
- this.SuperColumnName = superColumnName;
- }
- }
-
- public class RemoveKey : ColumnFamilyOperation<Void>
- {
- /*
- * remove(keyspace, key, column_path, timestamp, consistency_level)
- */
-
- public string Key { get; private set; }
-
- public override Void Execute(BaseCassandraColumnFamily columnFamily)
- {
- var path = new ColumnPath {
- Column_family = columnFamily.FamilyName
- };
-
- CassandraSession.Current.GetClient().remove(
- columnFamily.Keyspace.KeyspaceName,
- Key,
- path,
- DateTimeOffset.UtcNow.Ticks,
- CassandraSession.Current.WriteConsistency
- );
-
- return new Void();
- }
-
- public RemoveKey(string key)
- {
- this.Key = key;
- }
- }
-}
View
57 FluentCassandra/Operations/RemoveColumn.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Apache.Cassandra;
+using FluentCassandra.Types;
+
+namespace FluentCassandra.Operations
+{
+ public class RemoveColumn : ColumnFamilyOperation<Void>
+ {
+ /*
+ * remove(keyspace, key, column_path, timestamp, consistency_level)
+ */
+
+ public string Key { get; private set; }
+
+ public CassandraType SuperColumnName { get; private set; }
+
+ public CassandraType ColumnName { get; private set; }
+
+ public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ {
+ var path = new ColumnPath {
+ Column_family = columnFamily.FamilyName
+ };
+
+ if (SuperColumnName != null)
+ path.Super_column = SuperColumnName;
+
+ if (ColumnName != null)
+ path.Column = ColumnName;
+
+ CassandraSession.Current.GetClient().remove(
+ Key,
+ path,
+ DateTimeOffset.Now.ToClock(),
+ CassandraSession.Current.WriteConsistency
+ );
+
+ return new Void();
+ }
+
+ public RemoveColumn(string key, CassandraType superColumnName, CassandraType columnName)
+ {
+ Key = key;
+ SuperColumnName = superColumnName;
+ ColumnName = columnName;
+ }
+
+ public RemoveColumn(string key, CassandraType columnName)
+ {
+ Key = key;
+ ColumnName = columnName;
+ }
+ }
+}
View
39 FluentCassandra/Operations/RemoveKey.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Apache.Cassandra;
+using FluentCassandra.Types;
+
+namespace FluentCassandra.Operations
+{
+ public class RemoveKey : ColumnFamilyOperation<Void>
+ {
+ /*
+ * remove(keyspace, key, column_path, timestamp, consistency_level)
+ */
+
+ public string Key { get; private set; }
+
+ public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ {
+ var path = new ColumnPath {
+ Column_family = columnFamily.FamilyName
+ };
+
+ CassandraSession.Current.GetClient().remove(
+ Key,
+ path,
+ DateTimeOffset.UtcNow.Ticks,
+ CassandraSession.Current.WriteConsistency
+ );
+
+ return new Void();
+ }
+
+ public RemoveKey(string key)
+ {
+ Key = key;
+ }
+ }
+}
View
45 FluentCassandra/Operations/RemoveSuperColumn.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Apache.Cassandra;
+using FluentCassandra.Types;
+
+namespace FluentCassandra.Operations
+{
+ public class RemoveSuperColumn : ColumnFamilyOperation<Void>
+ {
+ /*
+ * remove(keyspace, key, column_path, timestamp, consistency_level)
+ */
+
+ public string Key { get; private set; }
+
+ public CassandraType SuperColumnName { get; private set; }
+
+ public override Void Execute(BaseCassandraColumnFamily columnFamily)
+ {
+ var path = new ColumnPath {
+ Column_family = columnFamily.FamilyName
+ };
+
+ if (SuperColumnName != null)
+ path.Super_column = SuperColumnName;
+
+ CassandraSession.Current.GetClient().remove(
+ Key,
+ path,
+ DateTimeOffset.Now.ToClock(),
+ CassandraSession.Current.WriteConsistency
+ );
+
+ return new Void();
+ }
+
+ public RemoveSuperColumn(string key, CassandraType superColumnName)
+ {
+ Key = key;
+ SuperColumnName = superColumnName;
+ }
+ }
+}

0 comments on commit 365b683

Please sign in to comment.