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();
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
		public static Mutation CreateInsertedOrChangedMutation(FluentMutation mutation)
		{
			switch (mutation.Type)
			{
				case MutationType.Added:
				case MutationType.Changed:
					var column = mutation.Column;

					if (column is FluentColumn)
					{
						return new Mutation {
							Column_or_supercolumn = new ColumnOrSuperColumn {
								Column = CreateColumn((FluentColumn)column)
							}
						};
					}
					else if (column is FluentSuperColumn)
					{
						var colY = (FluentSuperColumn)column;
						var superColumn = new SuperColumn {
							Name = colY.ColumnName.TryToBigEndian(),
							Columns = new List<Column>()
						};

						foreach (var col in colY.MutationTracker.GetMutations().Select(x => x.Column).OfType<FluentColumn>())
							superColumn.Columns.Add(CreateColumn(col));

						return new Mutation {
							Column_or_supercolumn = new ColumnOrSuperColumn {
								Super_column = superColumn
							}
						};
					}
					break;
			}

			return null;
		}
Ejemplo n.º 4
0
		public static ColumnOrSuperColumn CreateColumnOrSuperColumn(IFluentBaseColumn column)
		{
			if (column is FluentColumn)
			{
				return new ColumnOrSuperColumn {
					Column = CreateColumn((FluentColumn)column)
				};
			}
			else if (column is FluentSuperColumn)
			{
				var colY = (FluentSuperColumn)column;
				var superColumn = new SuperColumn {
					Name = colY.ColumnName.TryToBigEndian(),
					Columns = new List<Column>()
				};

				foreach (var col in colY.Columns.OfType<FluentColumn>())
					superColumn.Columns.Add(CreateColumn(col));

				return new ColumnOrSuperColumn {
					Super_column = superColumn
				};
			}
			else
			{
				return null;
			}
		}
Ejemplo n.º 5
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;
		}