コード例 #1
0
ファイル: CqlRow.cs プロジェクト: achinn/fluentcassandra
 public void Read (TProtocol iprot)
 {
   bool isset_key = false;
   bool isset_columns = false;
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Key = iprot.ReadBinary();
           isset_key = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             Columns = new List<Column>();
             TList _list82 = iprot.ReadListBegin();
             for( int _i83 = 0; _i83 < _list82.Count; ++_i83)
             {
               Column _elem84 = new Column();
               _elem84 = new Column();
               _elem84.Read(iprot);
               Columns.Add(_elem84);
             }
             iprot.ReadListEnd();
           }
           isset_columns = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_key)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_columns)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
コード例 #2
0
ファイル: CASResult.cs プロジェクト: achinn/fluentcassandra
 public void Read (TProtocol iprot)
 {
   bool isset_success = false;
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Bool) {
           Success = iprot.ReadBool();
           isset_success = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             Current_values = new List<Column>();
             TList _list24 = iprot.ReadListBegin();
             for( int _i25 = 0; _i25 < _list24.Count; ++_i25)
             {
               Column _elem26 = new Column();
               _elem26 = new Column();
               _elem26.Read(iprot);
               Current_values.Add(_elem26);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_success)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
コード例 #3
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
 public insert_args(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level) : this() {
   this.Key = key;
   this.Column_parent = column_parent;
   this.Column = column;
   this.Consistency_level = consistency_level;
 }
コード例 #4
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
 public void send_insert(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("insert", TMessageType.Call, seqid_));
   insert_args args = new insert_args();
   args.Key = key;
   args.Column_parent = column_parent;
   args.Column = column;
   args.Consistency_level = consistency_level;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
コード例 #5
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
 public IAsyncResult send_insert(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level)
コード例 #6
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
      /// <summary>
      /// Insert a Column at the given column_parent.column_family and optional column_parent.super_column.
      /// </summary>
      /// <param name="key"></param>
      /// <param name="column_parent"></param>
      /// <param name="column"></param>
      /// <param name="consistency_level"></param>
      public void insert(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level)
      {
        #if !SILVERLIGHT
        send_insert(key, column_parent, column, consistency_level);
        recv_insert();

        #else
        var asyncResult = Begin_insert(null, null, key, column_parent, column, consistency_level);
        End_insert(asyncResult);

        #endif
      }
コード例 #7
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
 public IAsyncResult Begin_insert(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level)
 {
   return send_insert(callback, state, key, column_parent, column, consistency_level);
 }
コード例 #8
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Struct) {
           Column = new Column();
           Column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Super_column = new SuperColumn();
           Super_column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Struct) {
           Counter_column = new CounterColumn();
           Counter_column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.Struct) {
           Counter_super_column = new CounterSuperColumn();
           Counter_super_column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
コード例 #9
0
ファイル: Helper.cs プロジェクト: nathannis/fluentcassandra
		public static Column CreateColumn(FluentColumn column)
		{
			var col = new Column {
				Name = column.ColumnName.TryToBigEndian(),
				Value = column.ColumnValue.TryToBigEndian(),
				Timestamp = column.ColumnTimestamp.ToCassandraTimestamp()
			};

			if (column.ColumnSecondsUntilDeleted.HasValue)
				col.Ttl = column.ColumnSecondsUntilDeleted.Value;

			return col;
		}
コード例 #10
0
ファイル: Helper.cs プロジェクト: nathannis/fluentcassandra
		public static FluentColumn ConvertColumnToFluentColumn(Column col, CassandraColumnSchema colSchema) 
		{
			colSchema = colSchema ?? new CassandraColumnSchema();

			var fcol = new FluentColumn(colSchema) {
				ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, colSchema.NameType),
				ColumnValue = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Value, colSchema.ValueType),
				ColumnTimestamp = TimestampHelper.FromCassandraTimestamp(col.Timestamp),
			};

			if (col.__isset.ttl)
				fcol.ColumnSecondsUntilDeleted = col.Ttl;

			return fcol;
		}
コード例 #11
0
ファイル: Helper.cs プロジェクト: nathannis/fluentcassandra
		public static FluentColumn ConvertColumnToFluentColumn(Column 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;
				}
			}

			return ConvertColumnToFluentColumn(col, colSchema);
		}
コード例 #12
0
ファイル: Helper.cs プロジェクト: nathannis/fluentcassandra
		public static Column CreateColumn(CassandraColumn column)
		{
			var ccol = new Column {
				Name = column.Name.TryToBigEndian(),
				Value = column.Value.TryToBigEndian(),
				Timestamp = column.Timestamp.ToCassandraTimestamp()
			};

			if (column.Ttl.HasValue && column.Ttl.Value > 0)
				ccol.Ttl = column.Ttl.Value;

			return ccol;
		}
コード例 #13
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Name = iprot.ReadBinary();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             Columns = new List<Column>();
             TList _list0 = iprot.ReadListBegin();
             for( int _i1 = 0; _i1 < _list0.Count; ++_i1)
             {
               Column _elem2 = new Column();
               _elem2 = new Column();
               _elem2.Read(iprot);
               Columns.Add(_elem2);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
コード例 #14
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
 public void Read (TProtocol iprot)
 {
   bool isset_key = false;
   bool isset_column_parent = false;
   bool isset_column = false;
   bool isset_consistency_level = false;
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Key = iprot.ReadBinary();
           isset_key = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Column_parent = new ColumnParent();
           Column_parent.Read(iprot);
           isset_column_parent = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Struct) {
           Column = new Column();
           Column.Read(iprot);
           isset_column = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.I32) {
           Consistency_level = (ConsistencyLevel)iprot.ReadI32();
           isset_consistency_level = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_key)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_column_parent)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_column)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_consistency_level)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
コード例 #15
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Key = iprot.ReadBinary();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Column_parent = new ColumnParent();
           Column_parent.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Struct) {
           Column = new Column();
           Column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.I32) {
           Consistency_level = (ConsistencyLevel)iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
コード例 #16
0
ファイル: Cassandra.cs プロジェクト: achinn/fluentcassandra
 public void Read (TProtocol iprot)
 {
   bool isset_key = false;
   bool isset_column_family = false;
   bool isset_serial_consistency_level = false;
   bool isset_commit_consistency_level = false;
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Key = iprot.ReadBinary();
           isset_key = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.String) {
           Column_family = iprot.ReadString();
           isset_column_family = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.List) {
           {
             Expected = new List<Column>();
             TList _list146 = iprot.ReadListBegin();
             for( int _i147 = 0; _i147 < _list146.Count; ++_i147)
             {
               Column _elem148 = new Column();
               _elem148 = new Column();
               _elem148.Read(iprot);
               Expected.Add(_elem148);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.List) {
           {
             Updates = new List<Column>();
             TList _list149 = iprot.ReadListBegin();
             for( int _i150 = 0; _i150 < _list149.Count; ++_i150)
             {
               Column _elem151 = new Column();
               _elem151 = new Column();
               _elem151.Read(iprot);
               Updates.Add(_elem151);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 5:
         if (field.Type == TType.I32) {
           Serial_consistency_level = (ConsistencyLevel)iprot.ReadI32();
           isset_serial_consistency_level = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 6:
         if (field.Type == TType.I32) {
           Commit_consistency_level = (ConsistencyLevel)iprot.ReadI32();
           isset_commit_consistency_level = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_key)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_column_family)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_serial_consistency_level)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_commit_consistency_level)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
コード例 #17
0
        public void Read(TProtocol iprot)
        {
            bool   isset_name    = false;
            bool   isset_columns = false;
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        Name       = iprot.ReadBinary();
                        isset_name = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            Columns = new List <Column>();
                            TList _list0 = iprot.ReadListBegin();
                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                Column _elem2 = new Column();
                                _elem2 = new Column();
                                _elem2.Read(iprot);
                                Columns.Add(_elem2);
                            }
                            iprot.ReadListEnd();
                        }
                        isset_columns = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_name)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_columns)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }