Inheritance: TBase
Exemplo n.º 1
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                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)
                        {
                            Put = new TPut();
                            Put.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            DeleteSingle = new TDelete();
                            DeleteSingle.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Exemplo n.º 2
0
 public void put(byte[] table, TPut put)
 {
     send_put(table, put);
     recv_put();
 }
Exemplo n.º 3
0
 public bool checkAndPut(byte[] table, byte[] row, byte[] family, byte[] qualifier, byte[] value, TPut put)
 {
     send_checkAndPut(table, row, family, qualifier, value, put);
     return recv_checkAndPut();
 }
Exemplo n.º 4
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) {
     Table = iprot.ReadBinary();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 2:
       if (field.Type == TType.String) {
     Row = iprot.ReadBinary();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 3:
       if (field.Type == TType.String) {
     Family = iprot.ReadBinary();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 4:
       if (field.Type == TType.String) {
     Qualifier = iprot.ReadBinary();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 5:
       if (field.Type == TType.String) {
     Value = iprot.ReadBinary();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 6:
       if (field.Type == TType.Struct) {
     Put = new TPut();
     Put.Read(iprot);
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     default:
       TProtocolUtil.Skip(iprot, field.Type);
       break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Exemplo n.º 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) {
     Table = iprot.ReadBinary();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 2:
       if (field.Type == TType.List) {
     {
       Puts = new List<TPut>();
       TList _list32 = iprot.ReadListBegin();
       for( int _i33 = 0; _i33 < _list32.Count; ++_i33)
       {
         TPut _elem34 = new TPut();
         _elem34 = new TPut();
         _elem34.Read(iprot);
         Puts.Add(_elem34);
       }
       iprot.ReadListEnd();
     }
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     default:
       TProtocolUtil.Skip(iprot, field.Type);
       break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Exemplo n.º 6
0
 public void send_put(byte[] table, TPut put)
 {
     oprot_.WriteMessageBegin(new TMessage("put", TMessageType.Call, seqid_));
     put_args args = new put_args();
     args.Table = table;
     args.Put = put;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 7
0
 public void send_checkAndPut(byte[] table, byte[] row, byte[] family, byte[] qualifier, byte[] value, TPut put)
 {
     oprot_.WriteMessageBegin(new TMessage("checkAndPut", TMessageType.Call, seqid_));
     checkAndPut_args args = new checkAndPut_args();
     args.Table = table;
     args.Row = row;
     args.Family = family;
     args.Qualifier = qualifier;
     args.Value = value;
     args.Put = put;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 8
0
        public static void FistTest()
        {
            Console.WriteLine("Thrift2 Demo");
            Console.WriteLine("This demo assumes you have a table called \"example\" with a column family called \"family1\"");

            String host = "hserver";
            int port = 9090;
            int timeout = 10000;
            var framed = false;

            TTransport transport = new TSocket(host, port, timeout);
            if (framed)
            {
                transport = new TFramedTransport(transport);
            }
            TProtocol protocol = new TBinaryProtocol(transport);
            // This is our thrift client.
            THBaseService.Iface client = new THBaseService.Client(protocol);

            // open the transport
            transport.Open();

            var table = "t1".ToBytes();

            TPut put = new TPut();
            put.Row = ("row1".ToBytes());

            for (var i = 0; i < 1000; i++)
            {

                TColumnValue columnValue = new TColumnValue();
                columnValue.Family = ("f1".ToBytes());
                columnValue.Qualifier = ("qualifier" + i).ToBytes();
                columnValue.Value = ("value" + i).ToBytes();
                List<TColumnValue> columnValues = new List<TColumnValue>();
                columnValues.Add(columnValue);
                put.ColumnValues = columnValues;

                client.put(table, put);
            }

            TGet get = new TGet();
            get.Row = ("row1".ToBytes());

            TResult result = client.get(table, get);

            Console.WriteLine("row = " + result.Row.ToStr());
            foreach (TColumnValue resultColumnValue in result.ColumnValues)
            {
                Console.WriteLine("family = " + resultColumnValue.Family.ToStr());
                Console.WriteLine("qualifier = " + resultColumnValue.Qualifier.ToStr());
                Console.WriteLine("value = " + resultColumnValue.Value.ToStr());
                Console.WriteLine("timestamp = " + resultColumnValue.Timestamp);
            }

            transport.Close();
        }