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) { Row = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { ColumnValues = new List <TColumnValue>(); TList _list0 = iprot.ReadListBegin(); for (int _i1 = 0; _i1 < _list0.Count; ++_i1) { TColumnValue _elem2 = new TColumnValue(); _elem2 = new TColumnValue(); _elem2.Read(iprot); ColumnValues.Add(_elem2); } 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_row = false; bool isset_columns = 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) { Row = iprot.ReadBinary(); isset_row = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { Columns = new List <TColumnValue>(); TList _list44 = iprot.ReadListBegin(); for (int _i45 = 0; _i45 < _list44.Count; ++_i45) { TColumnValue _elem46; _elem46 = new TColumnValue(); _elem46.Read(iprot); Columns.Add(_elem46); } iprot.ReadListEnd(); } isset_columns = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Attributes = new Dictionary <byte[], byte[]>(); TMap _map47 = iprot.ReadMapBegin(); for (int _i48 = 0; _i48 < _map47.Count; ++_i48) { byte[] _key49; byte[] _val50; _key49 = iprot.ReadBinary(); _val50 = iprot.ReadBinary(); Attributes[_key49] = _val50; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { Durability = (TDurability)iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Struct) { CellVisibility = new TCellVisibility(); CellVisibility.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_row) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Row not set"); } if (!isset_columns) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Columns not set"); } } finally { iprot.DecrementRecursionDepth(); } }
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) { Row = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { ColumnValues = new List<TColumnValue>(); TList _list8 = iprot.ReadListBegin(); for( int _i9 = 0; _i9 < _list8.Count; ++_i9) { TColumnValue _elem10 = new TColumnValue(); _elem10 = new TColumnValue(); _elem10.Read(iprot); ColumnValues.Add(_elem10); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I64) { Timestamp = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Bool) { WriteToWal = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
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) { Row = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { ColumnValues = new List <TColumnValue>(); TList _list8 = iprot.ReadListBegin(); for (int _i9 = 0; _i9 < _list8.Count; ++_i9) { TColumnValue _elem10 = new TColumnValue(); _elem10 = new TColumnValue(); _elem10.Read(iprot); ColumnValues.Add(_elem10); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I64) { Timestamp = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Bool) { WriteToWal = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
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(); }
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) { Row = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { ColumnValues = new List<TColumnValue>(); TList _list0 = iprot.ReadListBegin(); for( int _i1 = 0; _i1 < _list0.Count; ++_i1) { TColumnValue _elem2 = new TColumnValue(); _elem2 = new TColumnValue(); _elem2.Read(iprot); ColumnValues.Add(_elem2); } 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_columnValues = 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) { Row = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { ColumnValues = new List <TColumnValue>(); TList _list0 = iprot.ReadListBegin(); for (int _i1 = 0; _i1 < _list0.Count; ++_i1) { TColumnValue _elem2; _elem2 = new TColumnValue(); _elem2.Read(iprot); ColumnValues.Add(_elem2); } iprot.ReadListEnd(); } isset_columnValues = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_columnValues) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ColumnValues not set"); } } finally { iprot.DecrementRecursionDepth(); } }