public CassandraColumnFamilySchema(CfDef def)
		{
			_def = def;

			KeyspaceName = def.Keyspace;

			var familyType = ColumnType.Standard;
			Enum.TryParse<ColumnType>(def.Column_type, out familyType);

			var defaultKeyValueType = CassandraType.GetCassandraType(def.Key_validation_class);
			var defaultColumnValueType = CassandraType.GetCassandraType(def.Default_validation_class);

			CassandraType columnNameType, superColumnNameType;

			if (familyType == ColumnType.Super)
			{
				superColumnNameType = CassandraType.GetCassandraType(def.Comparator_type);
				columnNameType = CassandraType.GetCassandraType(def.Subcomparator_type);
			}
			else
			{
				superColumnNameType = null;
				columnNameType = CassandraType.GetCassandraType(def.Comparator_type);
			}

			FamilyType = familyType;
			FamilyName = def.Name;
			FamilyDescription = def.Comment;

			KeyName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(def.Key_alias, DefaultKeyNameType);
			KeyValueType = defaultKeyValueType;

			SuperColumnNameType = superColumnNameType;
			ColumnNameType = columnNameType;
			DefaultColumnValueType = defaultColumnValueType;

			Columns = def.Column_metadata.Select(col => new CassandraColumnSchema(col, columnNameType)).ToList();
		}
Пример #2
0
 public void send_system_update_column_family(CfDef cf_def)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("system_update_column_family", TMessageType.Call, seqid_));
   system_update_column_family_args args = new system_update_column_family_args();
   args.Cf_def = cf_def;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Пример #3
0
 public IAsyncResult send_system_update_column_family(AsyncCallback callback, object state, CfDef cf_def)
Пример #4
0
      /// <summary>
      /// updates properties of a column family. returns the new schema id.
      /// </summary>
      /// <param name="cf_def"></param>
      public string system_update_column_family(CfDef cf_def)
      {
        #if !SILVERLIGHT
        send_system_update_column_family(cf_def);
        return recv_system_update_column_family();

        #else
        var asyncResult = Begin_system_update_column_family(null, null, cf_def);
        return End_system_update_column_family(asyncResult);

        #endif
      }
Пример #5
0
 public IAsyncResult Begin_system_update_column_family(AsyncCallback callback, object state, CfDef cf_def)
 {
   return send_system_update_column_family(callback, state, cf_def);
 }
Пример #6
0
 public void Read (TProtocol iprot)
 {
   bool isset_cf_def = 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.Struct) {
           Cf_def = new CfDef();
           Cf_def.Read(iprot);
           isset_cf_def = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_cf_def)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
Пример #7
0
 public system_update_column_family_args(CfDef cf_def) : this() {
   this.Cf_def = cf_def;
 }
Пример #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) {
           Cf_def = new CfDef();
           Cf_def.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
Пример #9
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.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.String) {
           Strategy_class = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Map) {
           {
             Strategy_options = new Dictionary<string, string>();
             TMap _map60 = iprot.ReadMapBegin();
             for( int _i61 = 0; _i61 < _map60.Count; ++_i61)
             {
               string _key62;
               string _val63;
               _key62 = iprot.ReadString();
               _val63 = iprot.ReadString();
               Strategy_options[_key62] = _val63;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.I32) {
           Replication_factor = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 5:
         if (field.Type == TType.List) {
           {
             Cf_defs = new List<CfDef>();
             TList _list64 = iprot.ReadListBegin();
             for( int _i65 = 0; _i65 < _list64.Count; ++_i65)
             {
               CfDef _elem66 = new CfDef();
               _elem66 = new CfDef();
               _elem66.Read(iprot);
               Cf_defs.Add(_elem66);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 6:
         if (field.Type == TType.Bool) {
           Durable_writes = iprot.ReadBool();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
Пример #10
0
        public void Read(TProtocol iprot)
        {
            bool   isset_name           = false;
            bool   isset_strategy_class = false;
            bool   isset_cf_defs        = 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.ReadString();
                        isset_name = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.String)
                    {
                        Strategy_class       = iprot.ReadString();
                        isset_strategy_class = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Map)
                    {
                        {
                            Strategy_options = new Dictionary <string, string>();
                            TMap _map73 = iprot.ReadMapBegin();
                            for (int _i74 = 0; _i74 < _map73.Count; ++_i74)
                            {
                                string _key75;
                                string _val76;
                                _key75 = iprot.ReadString();
                                _val76 = iprot.ReadString();
                                Strategy_options[_key75] = _val76;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        Replication_factor = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.List)
                    {
                        {
                            Cf_defs = new List <CfDef>();
                            TList _list77 = iprot.ReadListBegin();
                            for (int _i78 = 0; _i78 < _list77.Count; ++_i78)
                            {
                                CfDef _elem79 = new CfDef();
                                _elem79 = new CfDef();
                                _elem79.Read(iprot);
                                Cf_defs.Add(_elem79);
                            }
                            iprot.ReadListEnd();
                        }
                        isset_cf_defs = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.Bool)
                    {
                        Durable_writes = iprot.ReadBool();
                    }
                    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_strategy_class)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_cf_defs)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
Пример #11
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.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.String)
                    {
                        Strategy_class = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Map)
                    {
                        {
                            Strategy_options = new Dictionary <string, string>();
                            TMap _map60 = iprot.ReadMapBegin();
                            for (int _i61 = 0; _i61 < _map60.Count; ++_i61)
                            {
                                string _key62;
                                string _val63;
                                _key62 = iprot.ReadString();
                                _val63 = iprot.ReadString();
                                Strategy_options[_key62] = _val63;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        Replication_factor = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.List)
                    {
                        {
                            Cf_defs = new List <CfDef>();
                            TList _list64 = iprot.ReadListBegin();
                            for (int _i65 = 0; _i65 < _list64.Count; ++_i65)
                            {
                                CfDef _elem66 = new CfDef();
                                _elem66 = new CfDef();
                                _elem66.Read(iprot);
                                Cf_defs.Add(_elem66);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.Bool)
                    {
                        Durable_writes = iprot.ReadBool();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
Пример #12
0
 public void Read (TProtocol iprot)
 {
   bool isset_name = false;
   bool isset_strategy_class = false;
   bool isset_cf_defs = 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.ReadString();
           isset_name = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.String) {
           Strategy_class = iprot.ReadString();
           isset_strategy_class = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Map) {
           {
             Strategy_options = new Dictionary<string, string>();
             TMap _map73 = iprot.ReadMapBegin();
             for( int _i74 = 0; _i74 < _map73.Count; ++_i74)
             {
               string _key75;
               string _val76;
               _key75 = iprot.ReadString();
               _val76 = iprot.ReadString();
               Strategy_options[_key75] = _val76;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.I32) {
           Replication_factor = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 5:
         if (field.Type == TType.List) {
           {
             Cf_defs = new List<CfDef>();
             TList _list77 = iprot.ReadListBegin();
             for( int _i78 = 0; _i78 < _list77.Count; ++_i78)
             {
               CfDef _elem79 = new CfDef();
               _elem79 = new CfDef();
               _elem79.Read(iprot);
               Cf_defs.Add(_elem79);
             }
             iprot.ReadListEnd();
           }
           isset_cf_defs = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 6:
         if (field.Type == TType.Bool) {
           Durable_writes = iprot.ReadBool();
         } 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_strategy_class)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_cf_defs)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }