public CassandraRangeSlicePredicate(CassandraObject start, CassandraObject finish, bool reversed = false, int count = 100)
		{
			Start = start;
			Finish = finish;
			Reversed = reversed;
			Count = count;
		}
示例#2
0
        private IEnumerable <FluentColumnFamily> GetFamilies(BaseCassandraColumnFamily columnFamily)
        {
            var schema = ColumnFamily.GetSchema();

            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();

                yield return(r);
            }
        }
 public static void InsertCounterColumn(this CassandraColumnFamily family, CassandraObject key,
                                        CassandraObject superColumnName, CassandraObject columnName,
                                        long columnValue)
 {
     var op = new AddColumn(key, superColumnName, columnName, columnValue);
     family.ExecuteOperation(op);
 }
        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 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();

                yield return(r);
            }
        }
示例#5
0
        private static Cassandra.IndexExpression VisitRelationalExpression(BinaryExpression exp)
        {
            Cassandra.IndexExpression indexExpression;

            var columnName = GetColumnName(exp.Left);
            var value      = CassandraObject.GetCassandraObjectFromObject(Expression.Lambda(exp.Right).Compile().DynamicInvoke(), CassandraType.BytesType);

            indexExpression = new Cassandra.IndexExpression {
                Column_name = columnName.ToBigEndian(),
                Value       = value.ToBigEndian()
            };

            switch (exp.NodeType)
            {
            case ExpressionType.Equal: indexExpression.Op = Cassandra.IndexOperator.EQ; break;

            case ExpressionType.GreaterThan: indexExpression.Op = Cassandra.IndexOperator.GT; break;

            case ExpressionType.GreaterThanOrEqual: indexExpression.Op = Cassandra.IndexOperator.GTE; break;

            case ExpressionType.LessThan: indexExpression.Op = Cassandra.IndexOperator.LT; break;

            case ExpressionType.LessThanOrEqual: indexExpression.Op = Cassandra.IndexOperator.LTE; break;

            default:
                throw new NotSupportedException(exp.NodeType.ToString() + " is not a supported relational criteria.");
            }

            return(indexExpression);
        }
		public Apache.Cassandra.ColumnOrSuperColumn get(CassandraObject key, CassandraColumnPath column_path, Apache.Cassandra.ConsistencyLevel consistency_level)
		{
			return _client.get(
				key.TryToBigEndian(),
				Helper.CreateColumnPath(column_path),
				consistency_level);
		}
示例#7
0
 public AddColumn(CassandraObject key, CassandraObject superColumnName, CassandraObject name, long value)
 {
     Key             = key;
     SuperColumnName = superColumnName;
     ColumnName      = name;
     ColumnValue     = value;
 }
示例#8
0
        public static FluentSuperColumn ConvertSuperColumnToFluentSuperColumn(SuperColumn col, CassandraColumnFamilySchema schema)
        {
            var superColSchema = new CassandraColumnSchema {
                Name = col.Name
            };

            if (schema != null)
            {
                superColSchema = new CassandraColumnSchema {
                    NameType  = schema.SuperColumnNameType,
                    Name      = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, schema.SuperColumnNameType),
                    ValueType = schema.ColumnNameType
                }
            }
            ;

            var superCol = new FluentSuperColumn(superColSchema)
            {
                ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, superColSchema.NameType)
            };

            ((ILoadable)superCol).BeginLoad();
            foreach (var xcol in col.Columns)
            {
                superCol.Columns.Add(ConvertColumnToFluentColumn(xcol, schema));
            }
            ((ILoadable)superCol).EndLoad();

            return(superCol);
        }
示例#9
0
        public void TwoExpressions()
        {
            // arrange
            string key          = "test";
            int    count        = 20;
            var    columnName1  = "test1-column";
            var    columnValue1 = "test1-value";
            var    columnName2  = "test2-column";
            var    columnValue2 = Math.PI;

            // act
            var index = new CassandraIndexClause(
                key,
                count,
                family => family[columnName1] == columnValue1 &&
                family[columnName2] > columnValue2);
            var expressions = index.CompiledExpressions;

            // assert
            Assert.Equal(2, expressions.Count);

            var firstExpression = expressions[0];

            Assert.NotNull(firstExpression);
            Assert.Equal(CassandraObject.GetCassandraObjectFromDatabaseByteArray(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName1);
            Assert.Equal(firstExpression.Op, IndexOperator.EQ);
            Assert.Equal(CassandraObject.GetCassandraObjectFromDatabaseByteArray(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue1);

            var secondExpression = expressions[1];

            Assert.Equal(CassandraObject.GetCassandraObjectFromDatabaseByteArray(secondExpression.Column_name, typeof(BytesType)), (BytesType)columnName2);
            Assert.Equal(secondExpression.Op, IndexOperator.GT);
            Assert.Equal(CassandraObject.GetCassandraObjectFromDatabaseByteArray(secondExpression.Value, typeof(BytesType)), (BytesType)columnValue2);
        }
示例#10
0
 public void remove_counter(CassandraObject key, CassandraColumnPath path, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     _client.remove_counter(
         key.TryToBigEndian(),
         Helper.CreateColumnPath(path),
         consistency_level);
 }
示例#11
0
        public void SingleExpression()
        {
            // arrange
            string key         = "test";
            int    count       = 20;
            var    columnName  = "test-column";
            var    columnValue = "test-value";

            // act
            var index = new CassandraIndexClause(
                key,
                count,
                family => family[columnName] == columnValue);
            var expressions = index.CompiledExpressions;

            // assert
            Assert.Equal(1, expressions.Count);

            var firstExpression = expressions[0];

            Assert.NotNull(firstExpression);
            Assert.Equal(CassandraObject.GetCassandraObjectFromDatabaseByteArray(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
            Assert.Equal(firstExpression.Op, IndexOperator.EQ);
            Assert.Equal(CassandraObject.GetCassandraObjectFromDatabaseByteArray(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
        }
 public CassandraRangeSlicePredicate(CassandraObject start, CassandraObject finish, bool reversed = false, int count = 100)
 {
     Start    = start;
     Finish   = finish;
     Reversed = reversed;
     Count    = count;
 }
示例#13
0
        public static CassandraSlicePredicate SetSchemaForSlicePredicate(CassandraSlicePredicate predicate, CassandraColumnFamilySchema schema, bool forSuperColumn = false)
        {
            CassandraType columnType = forSuperColumn ? schema.SuperColumnNameType : schema.ColumnNameType;

            if (predicate is CassandraRangeSlicePredicate)
            {
                var x      = (CassandraRangeSlicePredicate)predicate;
                var start  = CassandraObject.GetCassandraObjectFromObject(x.Start, columnType);
                var finish = CassandraObject.GetCassandraObjectFromObject(x.Finish, columnType);

                return(new CassandraRangeSlicePredicate(start, finish, x.Reversed, x.Count));
            }
            else if (predicate is CassandraColumnSlicePredicate)
            {
                var x    = (CassandraColumnSlicePredicate)predicate;
                var cols = x.Columns.ToList();

                for (int i = 0; i < cols.Count; i++)
                {
                    cols[i] = CassandraObject.GetCassandraObjectFromObject(cols[i], columnType);
                }

                return(new CassandraColumnSlicePredicate(cols));
            }

            return(null);
        }
示例#14
0
        public static void RemoveColumn(this CassandraSuperColumnFamily family, CassandraObject key, FluentColumnPath path)
        {
            var columnName      = path.Column.ColumnName;
            var superColumnName = path.SuperColumn.ColumnName;

            RemoveColumn(family, key, superColumnName, columnName);
        }
示例#15
0
        public static FluentCounterColumn ConvertColumnToFluentCounterColumn(CounterColumn col, CassandraColumnFamilySchema schema)
        {
            var colSchema = new CassandraColumnSchema();

            if (schema != null)
            {
                var name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, schema.ColumnNameType);
                colSchema = schema.Columns.Where(x => x.Name == name).FirstOrDefault();

                if (colSchema == null)
                {
                    colSchema           = new CassandraColumnSchema();
                    colSchema.NameType  = schema.ColumnNameType;
                    colSchema.Name      = name;
                    colSchema.ValueType = schema.DefaultColumnValueType;
                }
            }

            var fcol = new FluentCounterColumn(colSchema)
            {
                ColumnName  = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, colSchema.NameType),
                ColumnValue = col.Value
            };

            return(fcol);
        }
示例#16
0
        public static FluentColumn GetColumn(this CassandraSuperColumnFamily family, CassandraObject key, FluentColumnPath path)
        {
            var columnName      = path.Column.ColumnName;
            var superColumnName = path.SuperColumn.ColumnName;

            return(GetColumn(family, key, superColumnName, columnName));
        }
        public override IEnumerable <FluentColumnFamily> Execute()
        {
            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_indexed_slices(
                parent,
                IndexClause,
                SlicePredicate,
                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);
        }
        private byte[] GetBytes(CassandraObject[] components)
        {
            using (var bytes = new MemoryStream())
            {
                foreach (var c in components)
                {
                    var b = (byte[])c;
                    var length = (ushort)b.Length;

                    // comparator part
                    bytes.WriteByte((byte)1);
                    bytes.WriteByte((byte)_aliases.FirstOrDefault(x => x.Value == c.GetType()).Key);

                    // value length
                    bytes.Write(BitConverter.GetBytes(length), 0, 2);

                    // value
                    bytes.Write(b, 0, length);

                    // end of component
                    bytes.WriteByte((byte)0);
                }

                return bytes.ToArray();
            }
        }
示例#19
0
 public Apache.Cassandra.ColumnOrSuperColumn get(CassandraObject key, CassandraColumnPath column_path, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     return(_client.get(
                key.TryToBigEndian(),
                Helper.CreateColumnPath(column_path),
                consistency_level));
 }
示例#20
0
 public void remove(CassandraObject key, CassandraColumnPath column_path, long timestamp, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     _client.remove(
         key.TryToBigEndian(),
         Helper.CreateColumnPath(column_path),
         timestamp,
         consistency_level);
 }
        public static void InsertCounterColumn(this CassandraColumnFamily family, CassandraObject key,
                                               CassandraObject superColumnName, CassandraObject columnName,
                                               long columnValue)
        {
            var op = new AddColumn(key, superColumnName, columnName, columnValue);

            family.ExecuteOperation(op);
        }
示例#22
0
 public FluentColumnFamily(CassandraObject key, string columnFamily)
     : base(key, columnFamily, new CassandraColumnFamilySchema {
     FamilyName     = columnFamily,
     KeyValueType   = CassandraType.BytesType,
     ColumnNameType = typeof(CompareWith)
 })
 {
 }
 public CassandraKeyRange(CassandraObject startKey, CassandraObject endKey, string startToken, string endToken, int count)
 {
     StartKey   = startKey;
     EndKey     = endKey;
     StartToken = startToken;
     EndToken   = endToken;
     Count      = count;
 }
示例#24
0
 public InsertColumn(CassandraObject key, CassandraObject name, CassandraObject value, DateTimeOffset timestamp, int?timeToLive)
 {
     Key         = key;
     ColumnName  = name;
     ColumnValue = value;
     Timestamp   = timestamp;
     TimeToLive  = timeToLive;
 }
		public int get_count(CassandraObject key, CassandraColumnParent column_parent, CassandraSlicePredicate predicate, Apache.Cassandra.ConsistencyLevel consistency_level)
		{
			return _client.get_count(
				key.TryToBigEndian(),
				Helper.CreateColumnParent(column_parent),
				Helper.CreateSlicePredicate(predicate),
				consistency_level);
		}
示例#26
0
		public CassandraKeyRange(CassandraObject startKey, CassandraObject endKey, string startToken, string endToken, int count)
		{
			StartKey = startKey;
			EndKey = endKey;
			StartToken = startToken;
			EndToken = endToken;
			Count = count;
		}
 public void add(CassandraObject key, CassandraColumnParent column_parent, CassandraCounterColumn column, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     _client.add(
         key.TryToBigEndian(),
         Helper.CreateColumnParent(column_parent),
         Helper.CreateCounterColumn(column),
         consistency_level);
 }
示例#28
0
 public void add(CassandraObject key, CassandraColumnParent column_parent, CassandraCounterColumn column, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     _client.add(
         key.TryToBigEndian(),
         Helper.CreateColumnParent(column_parent),
         Helper.CreateCounterColumn(column),
         consistency_level);
 }
示例#29
0
 public int get_count(CassandraObject key, CassandraColumnParent column_parent, CassandraSlicePredicate predicate, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     return(_client.get_count(
                key.TryToBigEndian(),
                Helper.CreateColumnParent(column_parent),
                Helper.CreateSlicePredicate(predicate),
                consistency_level));
 }
示例#30
0
        internal FluentCqlRow(CassandraObject key, string columnFamily, CassandraCqlRowSchema schema, IEnumerable <FluentColumn> columns)
        {
            SetSchema(schema);

            Key        = key;
            FamilyName = columnFamily;

            _columns = new List <FluentColumn>(columns);
        }
 public FluentSuperColumnFamily(CassandraObject key, string columnFamily)
     : base(key, columnFamily, new CassandraColumnFamilySchema {
     FamilyName          = columnFamily,
     KeyValueType        = typeof(BytesType),
     SuperColumnNameType = typeof(CompareWith),
     ColumnNameType      = typeof(CompareSubcolumnWith)
 })
 {
 }
示例#32
0
        public static byte[] TryToBigEndian(this CassandraObject value)
        {
            if (value == null)
            {
                return(null);
            }

            return(value.ToBigEndian());
        }
        public static void InsertColumn(this CassandraColumnFamily family, CassandraObject key, FluentColumnPath path)
        {
            var columnName = path.Column.ColumnName;
            var columnValue = path.Column.ColumnValue;
            var timestamp = path.Column.ColumnTimestamp;
            var timeToLive = path.Column.ColumnSecondsUntilDeleted;

            var op = new InsertColumn(key, columnName, columnValue, timestamp, timeToLive);
            family.ExecuteOperation(op);
        }
		public CassandraQuerySetup()
		{
			Reverse = false;

			KeyCount = 100;
			ColumnCount = 100;

			Keys = new CassandraObject[0];
			Columns = new CassandraObject[0];
		}
        public CassandraQuerySetup()
        {
            Reverse = false;

            KeyCount    = 100;
            ColumnCount = 100;

            Keys    = new CassandraObject[0];
            Columns = new CassandraObject[0];
        }
示例#36
0
        private IEnumerable <FluentColumn> GetColumns(Apache.Cassandra.CqlRow row, CassandraCqlRowSchema schema)
        {
            foreach (var col in row.Columns)
            {
                var name      = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, CassandraType.BytesType);
                var colSchema = schema.Columns.Where(x => x.Name == name).FirstOrDefault();

                var fcol = Helper.ConvertColumnToFluentColumn(col, colSchema);
                yield return(fcol);
            }
        }
        public static void InsertColumn(this CassandraColumnFamily family, CassandraObject key, FluentColumnPath path)
        {
            var columnName  = path.Column.ColumnName;
            var columnValue = path.Column.ColumnValue;
            var timestamp   = path.Column.ColumnTimestamp;
            var timeToLive  = path.Column.ColumnSecondsUntilDeleted;

            var op = new InsertColumn(key, columnName, columnValue, timestamp, timeToLive);

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

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

            if (SuperColumnName != null)
            {
                parent.SuperColumn = SuperColumnName;
            }

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

            var output = Session.GetClient().multiget_slice(
                Keys,
                parent,
                SlicePredicate,
                Session.ReadConsistency
                );

            foreach (var result in output)
            {
                var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType);

                var superColumns = (IEnumerable <FluentSuperColumn>)null;

                if (SuperColumnName != null)
                {
                    var superColSchema = new CassandraColumnSchema {
                        NameType  = schema.SuperColumnNameType,
                        Name      = SuperColumnName,
                        ValueType = schema.ColumnNameType
                    };

                    var superCol = new FluentSuperColumn(superColSchema, result.Value.Select(col => Helper.ConvertColumnToFluentColumn(col.Column, schema)));
                    ColumnFamily.Context.Attach(superCol);

                    superColumns = new[] { superCol };
                }
                else
                {
                    superColumns = result.Value.Select(col => Helper.ConvertSuperColumnToFluentSuperColumn(col.Super_column, schema));
                }

                var familyName = ColumnFamily.FamilyName;
                var r          = new FluentSuperColumnFamily(key, familyName, schema, superColumns);
                ColumnFamily.Context.Attach(r);

                yield return(r);
            }
        }
示例#39
0
        public void Implicit_ByteArray_Cast()
        {
            // arrange
            var expected = new CassandraObject[] { (AsciiType)"string1", (LongType)300 };
            byte[] bytes = GetBytes(expected);

            // act
            CompositeType actual = bytes;

            // assert
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
示例#40
0
        public void CassandraType_Cast()
        {
            // arranage
            var expected = new CassandraObject[] { (AsciiType)"string1", (LongType)300 };

            // act
            CompositeType actualType = expected;
            CassandraObject actual = actualType;

            // assert
            Assert.IsTrue(expected.SequenceEqual((CassandraObject[])actual));
        }
示例#41
0
        public void JavaBytes_To_CompositeType()
        {
            // arrange
            var expected = new CassandraObject[] { (BytesType)_compositeType[0].GetValue<string>(), (BytesType)_compositeType[1].GetValue<long>() };

            // act
            var actual = new CompositeType();
            actual.SetValueFromBigEndian(_javaByteOrder);

            // assert
            Assert.True(expected.SequenceEqual((CassandraObject[])actual));
        }
示例#42
0
        public CassandraObject this[CassandraObject columnName]
        {
            get
            {
                var value = GetColumnValue(columnName);

                if (value is NullType)
                {
                    throw new CassandraException(String.Format("Column, {0}, could not be found.", columnName));
                }

                return(value);
            }
        }
示例#43
0
		private byte[] GetBytes(CassandraObject[] components)
		{
			using (var bytes = new MemoryStream())
			{
				foreach (var c in components)
				{
					var b = (byte[])c;
					var length = (ushort)b.Length;

					// value length
					bytes.Write(BitConverter.GetBytes(length), 0, 2);

					// value
					bytes.Write(b, 0, length);

					// end of component
					bytes.WriteByte((byte)0);
				}

				return bytes.ToArray();
			}
		}
		public static void InsertColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject name, BytesType value, DateTimeOffset timestamp, int? timeToLive)
		{
			var op = new InsertColumn(key, superColumnName, name, value, timestamp, timeToLive);
			family.ExecuteOperation(op);
		}
		public static FluentColumn GetColumn(this CassandraSuperColumnFamily family, CassandraObject key, FluentColumnPath path)
		{
			var columnName = path.Column.ColumnName;
			var superColumnName = path.SuperColumn.ColumnName;
			return GetColumn(family, key, superColumnName, columnName);
		}
		public static void InsertColumn(this CassandraSuperColumnFamily family, CassandraObject key, FluentColumn column)
		{
			InsertColumn(family, key, column.GetPath());
		}
		public static void InsertColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject name, BytesType value)
		{
			InsertColumn(family, key, superColumnName, name, value, TimestampHelper.UtcNow(), null);
		}
		public static int SuperColumnCount(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, IEnumerable<CassandraObject> columnNames)
		{
			var op = new ColumnCount(key, superColumnName, new CassandraColumnSlicePredicate(columnNames));
			return family.ExecuteOperation(op);
		}
		public static int SuperColumnCount(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject columnStart, CassandraObject columnEnd, bool reversed = false, int count = 100)
		{
			var op = new ColumnCount(key, superColumnName, new CassandraRangeSlicePredicate(columnStart, columnEnd, reversed, count));
			return family.ExecuteOperation(op);
		}
		public static FluentSuperColumnFamily GetSingle(this CassandraSuperColumnFamily family, CassandraObject key, IEnumerable<CassandraObject> columnNames)
		{
			var op = new GetSuperColumnFamilySlice(key, new CassandraColumnSlicePredicate(columnNames));
			return family.ExecuteOperation(op);
		}
 public static void InsertColumn(this CassandraColumnFamily family, CassandraObject key, CassandraObject columnName, BytesType columnValue)
 {
     InsertColumn(family, key, columnName, columnValue, DateTimePrecise.UtcNow, null);
 }
		public static void RemoveColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName)
		{
			RemoveColumn(family, key, superColumnName, null);
		}
		public static void RemoveColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject columnName)
		{
			var op = new Remove(key, superColumnName, columnName);
			family.ExecuteOperation(op);
		}
示例#54
0
		public static CassandraType GetCassandraType(CassandraObject obj)
		{
			var typeName = obj.GetType().Name;
			var cassandraType = (CassandraType)null;

			switch (typeName.ToLower())
			{
				case "asciitype": cassandraType = AsciiType; break;
				case "booleantype": cassandraType = BooleanType; break;
				case "bytestype": cassandraType = BytesType; break;
				case "datetype": cassandraType = DateType; break;
				case "decimaltype": cassandraType = DecimalType; break;
				case "doubletype": cassandraType = DoubleType; break;
				case "floattype": cassandraType = FloatType; break;
				case "int32type": cassandraType = Int32Type; break;
				case "integertype": cassandraType = IntegerType; break;
				case "lexicaluuidtype": cassandraType = LexicalUUIDType; break;
				case "longtype": cassandraType = LongType; break;
				case "timeuuidtype": cassandraType = TimeUUIDType; break;
				case "utf8type": cassandraType = UTF8Type; break;
				case "uuidtype": cassandraType = UUIDType; break;
				case "emptytype": cassandraType = EmptyType; break;
				case "inetaddresstype": cassandraType = InetAddressType; break;
				// these need work
				//case "compositetype": cassandraType = CompositeType; break;
				//case "dynamiccompositetype": cassandraType = DynamicCompositeType; break;
				//case "countercolumntype": cassandraType = CounterColumnType; break;
				//case "reversedtype": cassandraType = ReversedType; break;
				default: throw new CassandraException("Type '" + typeName + "' not found.");
			}

			return cassandraType;
		}
 public void remove(CassandraObject key, CassandraColumnPath column_path, long timestamp, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     _client.remove(
         key.TryToBigEndian(),
         Helper.CreateColumnPath(column_path),
         timestamp,
         consistency_level);
 }
 public void remove_counter(CassandraObject key, CassandraColumnPath path, Apache.Cassandra.ConsistencyLevel consistency_level)
 {
     _client.remove_counter(
         key.TryToBigEndian(),
         Helper.CreateColumnPath(path),
         consistency_level);
 }
		public static FluentColumn GetColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject columnName)
		{
			var op = new GetColumn(key, superColumnName, columnName);
			return family.ExecuteOperation(op);
		}
		public static FluentSuperColumnFamily GetSingle(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject columnStart, CassandraObject columnEnd, bool reversed = false, int count = 100)
		{
			var op = new GetSuperColumnFamilySlice(key, new CassandraRangeSlicePredicate(columnStart, columnEnd, reversed, count));
			return family.ExecuteOperation(op);
		}
		public static FluentSuperColumn GetSuperColumn(this CassandraSuperColumnFamily family, CassandraObject key, FluentColumnParent parent)
		{
			var superColumnName = parent.SuperColumn.ColumnName;
			return GetSuperColumn(family, key, superColumnName);
		}
 public static void RemoveColumn(this CassandraColumnFamily family, CassandraObject key, FluentColumnPath path)
 {
     var columnName = path.Column.ColumnName;
     RemoveColumn(family, key, columnName);
 }