Beispiel #1
0
 public void Read(TProtocol iprot)
 {
     TField field;
       TStruct struc = iprot.ReadStructBegin();
       while (true)
       {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) {
       break;
     }
     switch (field.ID)
     {
       case 1:
     if (field.Type == TType.String) {
       this.row = iprot.ReadBinary();
       this.__isset.row = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 2:
     if (field.Type == TType.List) {
       {
         this.mutations = new List<Mutation>();
         TList _list0 = iprot.ReadListBegin();
         for( int _i1 = 0; _i1 < _list0.Count; ++_i1)
         {
           Mutation _elem2 = new Mutation();
           _elem2 = new Mutation();
           _elem2.Read(iprot);
           this.mutations.Add(_elem2);
         }
         iprot.ReadListEnd();
       }
       this.__isset.mutations = true;
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       default:
     TProtocolUtil.Skip(iprot, field.Type);
     break;
     }
     iprot.ReadFieldEnd();
       }
       iprot.ReadStructEnd();
 }
Beispiel #2
0
        public void batchRowMutation(byte[] table, OHMRowMutation rowMutation)
        {
            int changeTotal = rowMutation.Changes.Count;

            if(changeTotal == 0)
                //There are no changes so don't bother sending them to HBase
                return;

            List<Mutation> changes = new List<Mutation>(changeTotal);

            //Get the first node
            LinkedListNode<OHMCellMutation> currentNode = rowMutation.Changes.First;

            while(currentNode != null)
            {
                Mutation mutation = new Mutation();

                //Store the column
                mutation.column = currentNode.Value.column;

                if(!mutation.isDelete)
                {
                    mutation.value = currentNode.Value.cell.Value;
                    mutation.isDelete = false;
                }
                else
                {
                    mutation.isDelete = true;
                }

                //Add the mutation to the list of changes
                changes.Add(mutation);

                //Advance to the next
                currentNode = currentNode.Next;
            }

            client.mutateRow(table, rowMutation.RowID, changes);
        }
Beispiel #3
0
 public void Read(TProtocol iprot)
 {
     TField field;
     TStruct struc = iprot.ReadStructBegin();
     while (true)
     {
       field = iprot.ReadFieldBegin();
       if (field.Type == TType.Stop) {
     break;
       }
       switch (field.ID)
       {
     case 1:
       if (field.Type == TType.String) {
     this.tableName = iprot.ReadBinary();
     this.__isset.tableName = true;
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 2:
       if (field.Type == TType.String) {
     this.row = iprot.ReadBinary();
     this.__isset.row = true;
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 3:
       if (field.Type == TType.List) {
     {
       this.mutations = new List<Mutation>();
       TList _list38 = iprot.ReadListBegin();
       for( int _i39 = 0; _i39 < _list38.Count; ++_i39)
       {
         Mutation _elem40 = new Mutation();
         _elem40 = new Mutation();
         _elem40.Read(iprot);
         this.mutations.Add(_elem40);
       }
       iprot.ReadListEnd();
     }
     this.__isset.mutations = true;
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 4:
       if (field.Type == TType.I64) {
     this.timestamp = iprot.ReadI64();
     this.__isset.timestamp = true;
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     default:
       TProtocolUtil.Skip(iprot, field.Type);
       break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }