Inheritance: TBase
        public string AddColumnFamily(Server server, CfDef definition)
        {
            _cachedKeyspaceDescription = null;

            using (var session = new CassandraSession(new ConnectionBuilder(KeyspaceName, server.Host, server.Port)))
                return session.GetClient().system_add_column_family(definition);
        }
        public CassandraColumnFamilySchema(CfDef def)
        {
            var familyType = ColumnType.Standard;
            Enum.TryParse<ColumnType>(def.Column_type, out familyType);

            var keyType = CassandraObject.ParseType(def.Key_validation_class);
            var defaultColumnValueType = CassandraObject.ParseType(def.Default_validation_class);
            CassandraType columnNameType, superColumnNameType;

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

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

            KeyName = CassandraObject.GetTypeFromDatabaseValue(def.Key_alias, CassandraType.BytesType);
            KeyType = keyType;
            SuperColumnNameType = superColumnNameType;
            ColumnNameType = columnNameType;
            DefaultColumnValueType = defaultColumnValueType;

            Columns = def.Column_metadata.Select(col => new CassandraColumnSchema(col, columnNameType)).ToList();
        }
Example #3
0
        private void KeySpaceTree_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            List<CfDef> cfDefs = new List<CfDef>();
            CfDef cfDef = new CfDef();
            cfDef.Name = "Test";
            cfDef.Keyspace = e.Node.Text;
            cfDef.Column_type = "Standard";
            cfDefs.Add(cfDef);

            KsDef keySpaceDef = new KsDef();
            keySpaceDef.Name = e.Node.Text;
            keySpaceDef.Replication_factor = 1;
            keySpaceDef.Strategy_class = "org.apache.cassandra.locator.RackUnawareStrategy";
            keySpaceDef.Cf_defs = cfDefs;

            client.system_add_keyspace(keySpaceDef);

            // Data bind in future
            populateTreeView();
        }
 public void send_system_update_column_family(CfDef cf_def)
 {
     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();
     oprot_.Transport.Flush();
 }
Example #5
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();
 }
Example #6
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();
        }
 protected CfDef AddColumn(CfDef cfDef, String columnName, String validator)
 {
     ColumnDef colDef = new ColumnDef();
     colDef.Name = columnName.ToCassandraByte();
     colDef.Validation_class = validator;
     cfDef.Column_metadata = new List<ColumnDef>(1) { colDef };
     return cfDef;
 }
        public virtual CfDef CreateCfDef()
        {
            CfDef cfDef = new CfDef();
            cfDef.Keyspace = LevelMapping.KeyspaceName;
            cfDef.Name = LevelMapping.ColumnFamily;
            cfDef.Key_validation_class = "UUIDType";
            cfDef.Comparator_type = "UTF8Type";
            cfDef.Default_validation_class = "UTF8Type";

            AddColumn(cfDef, "app_name", "UTF8Type");
            AddColumn(cfDef, "host_ip", "UTF8Type");
            AddColumn(cfDef, "host_name", "UTF8Type");
            AddColumn(cfDef, "logger_name", "UTF8Type");
            AddColumn(cfDef, "level", "UTF8Type");
            AddColumn(cfDef, "class_name", "UTF8Type");
            AddColumn(cfDef, "file_name", "UTF8Type");
            AddColumn(cfDef, "line_number", "UTF8Type");
            AddColumn(cfDef, "method_name", "UTF8Type");
            AddColumn(cfDef, "message", "UTF8Type");
            AddColumn(cfDef, "app_start_time", "LongType");
            AddColumn(cfDef, "thread_name", "UTF8Type");
            AddColumn(cfDef, "throwable_str_rep", "UTF8Type");
            AddColumn(cfDef, "log_timestamp", "LongType");

            return cfDef;
        }
Example #9
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
 }
Example #10
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) {
       this.name = iprot.ReadString();
       this.__isset.name = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 2:
     if (field.Type == TType.String) {
       this.strategy_class = iprot.ReadString();
       this.__isset.strategy_class = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 3:
     if (field.Type == TType.Map) {
       {
         this.strategy_options = new Dictionary<string, string>();
         TMap _map29 = iprot.ReadMapBegin();
         for( int _i30 = 0; _i30 < _map29.Count; ++_i30)
         {
           string _key31;
           string _val32;
           _key31 = iprot.ReadString();
           _val32 = iprot.ReadString();
           this.strategy_options[_key31] = _val32;
         }
         iprot.ReadMapEnd();
       }
       this.__isset.strategy_options = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 4:
     if (field.Type == TType.I32) {
       this.replication_factor = iprot.ReadI32();
       this.__isset.replication_factor = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 5:
     if (field.Type == TType.List) {
       {
         this.cf_defs = new List<CfDef>();
         TList _list33 = iprot.ReadListBegin();
         for( int _i34 = 0; _i34 < _list33.Count; ++_i34)
         {
           CfDef _elem35 = new CfDef();
           _elem35 = new CfDef();
           _elem35.Read(iprot);
           this.cf_defs.Add(_elem35);
         }
         iprot.ReadListEnd();
       }
       this.__isset.cf_defs = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       default:
     TProtocolUtil.Skip(iprot, field.Type);
     break;
     }
     iprot.ReadFieldEnd();
       }
       iprot.ReadStructEnd();
 }
Example #11
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
      }
Example #12
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);
 }
Example #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.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 _map29 = iprot.ReadMapBegin();
                            for (int _i30 = 0; _i30 < _map29.Count; ++_i30)
                            {
                                string _key31;
                                string _val32;
                                _key31 = iprot.ReadString();
                                _val32 = iprot.ReadString();
                                Strategy_options[_key31] = _val32;
                            }
                            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 _list33 = iprot.ReadListBegin();
                            for (int _i34 = 0; _i34 < _list33.Count; ++_i34)
                            {
                                CfDef _elem35 = new CfDef();
                                _elem35 = new CfDef();
                                _elem35.Read(iprot);
                                Cf_defs.Add(_elem35);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                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;
                                    _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, "required field Name not set");
                }
                if (!isset_strategy_class)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Strategy_class not set");
                }
                if (!isset_cf_defs)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Cf_defs not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
 public string system_update_column_family(CfDef cf_def)
 {
     send_system_update_column_family(cf_def);
     return recv_system_update_column_family();
 }
 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();
 }
Example #17
0
 public IAsyncResult send_system_update_column_family(AsyncCallback callback, object state, CfDef cf_def)