You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/07/10 13:17:37 UTC
svn commit: r1501723 [11/11] - in /hbase/branches/0.95/hbase-examples:
src/main/java/org/apache/hadoop/hbase/thrift/generated/
src/main/java/org/apache/hadoop/hbase/thrift2/ src/main/python/
src/main/python/gen-py/hbase/ src/main/python/thrift1/ src/ma...
Added: hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py?rev=1501723&view=auto
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py (added)
+++ hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/__init__.py Wed Jul 10 11:17:36 2013
@@ -0,0 +1 @@
+__all__ = ['ttypes', 'constants', 'THBaseService']
Added: hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/constants.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/constants.py?rev=1501723&view=auto
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/constants.py (added)
+++ hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/constants.py Wed Jul 10 11:17:36 2013
@@ -0,0 +1,11 @@
+#
+# Autogenerated by Thrift Compiler (0.9.0)
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+# options string: py
+#
+
+from thrift.Thrift import TType, TMessageType, TException, TApplicationException
+from ttypes import *
+
Added: hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/ttypes.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/ttypes.py?rev=1501723&view=auto
==============================================================================
--- hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/ttypes.py (added)
+++ hbase/branches/0.95/hbase-examples/src/main/python/thrift2/gen-py/hbase/ttypes.py Wed Jul 10 11:17:36 2013
@@ -0,0 +1,1278 @@
+#
+# Autogenerated by Thrift Compiler (0.9.0)
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+# options string: py
+#
+
+from thrift.Thrift import TType, TMessageType, TException, TApplicationException
+
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol, TProtocol
+try:
+ from thrift.protocol import fastbinary
+except:
+ fastbinary = None
+
+
+class TDeleteType:
+ """
+ Specify type of delete:
+ - DELETE_COLUMN means exactly one version will be removed,
+ - DELETE_COLUMNS means previous versions will also be removed.
+ """
+ DELETE_COLUMN = 0
+ DELETE_COLUMNS = 1
+
+ _VALUES_TO_NAMES = {
+ 0: "DELETE_COLUMN",
+ 1: "DELETE_COLUMNS",
+ }
+
+ _NAMES_TO_VALUES = {
+ "DELETE_COLUMN": 0,
+ "DELETE_COLUMNS": 1,
+ }
+
+
+class TTimeRange:
+ """
+ Attributes:
+ - minStamp
+ - maxStamp
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I64, 'minStamp', None, None, ), # 1
+ (2, TType.I64, 'maxStamp', None, None, ), # 2
+ )
+
+ def __init__(self, minStamp=None, maxStamp=None,):
+ self.minStamp = minStamp
+ self.maxStamp = maxStamp
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.I64:
+ self.minStamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.I64:
+ self.maxStamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TTimeRange')
+ if self.minStamp is not None:
+ oprot.writeFieldBegin('minStamp', TType.I64, 1)
+ oprot.writeI64(self.minStamp)
+ oprot.writeFieldEnd()
+ if self.maxStamp is not None:
+ oprot.writeFieldBegin('maxStamp', TType.I64, 2)
+ oprot.writeI64(self.maxStamp)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.minStamp is None:
+ raise TProtocol.TProtocolException(message='Required field minStamp is unset!')
+ if self.maxStamp is None:
+ raise TProtocol.TProtocolException(message='Required field maxStamp is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TColumn:
+ """
+ Addresses a single cell or multiple cells
+ in a HBase table by column family and optionally
+ a column qualifier and timestamp
+
+ Attributes:
+ - family
+ - qualifier
+ - timestamp
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'family', None, None, ), # 1
+ (2, TType.STRING, 'qualifier', None, None, ), # 2
+ (3, TType.I64, 'timestamp', None, None, ), # 3
+ )
+
+ def __init__(self, family=None, qualifier=None, timestamp=None,):
+ self.family = family
+ self.qualifier = qualifier
+ self.timestamp = timestamp
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.family = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.qualifier = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.I64:
+ self.timestamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TColumn')
+ if self.family is not None:
+ oprot.writeFieldBegin('family', TType.STRING, 1)
+ oprot.writeString(self.family)
+ oprot.writeFieldEnd()
+ if self.qualifier is not None:
+ oprot.writeFieldBegin('qualifier', TType.STRING, 2)
+ oprot.writeString(self.qualifier)
+ oprot.writeFieldEnd()
+ if self.timestamp is not None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 3)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.family is None:
+ raise TProtocol.TProtocolException(message='Required field family is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TColumnValue:
+ """
+ Represents a single cell and its value.
+
+ Attributes:
+ - family
+ - qualifier
+ - value
+ - timestamp
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'family', None, None, ), # 1
+ (2, TType.STRING, 'qualifier', None, None, ), # 2
+ (3, TType.STRING, 'value', None, None, ), # 3
+ (4, TType.I64, 'timestamp', None, None, ), # 4
+ )
+
+ def __init__(self, family=None, qualifier=None, value=None, timestamp=None,):
+ self.family = family
+ self.qualifier = qualifier
+ self.value = value
+ self.timestamp = timestamp
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.family = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.qualifier = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRING:
+ self.value = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.I64:
+ self.timestamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TColumnValue')
+ if self.family is not None:
+ oprot.writeFieldBegin('family', TType.STRING, 1)
+ oprot.writeString(self.family)
+ oprot.writeFieldEnd()
+ if self.qualifier is not None:
+ oprot.writeFieldBegin('qualifier', TType.STRING, 2)
+ oprot.writeString(self.qualifier)
+ oprot.writeFieldEnd()
+ if self.value is not None:
+ oprot.writeFieldBegin('value', TType.STRING, 3)
+ oprot.writeString(self.value)
+ oprot.writeFieldEnd()
+ if self.timestamp is not None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 4)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.family is None:
+ raise TProtocol.TProtocolException(message='Required field family is unset!')
+ if self.qualifier is None:
+ raise TProtocol.TProtocolException(message='Required field qualifier is unset!')
+ if self.value is None:
+ raise TProtocol.TProtocolException(message='Required field value is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TColumnIncrement:
+ """
+ Represents a single cell and the amount to increment it by
+
+ Attributes:
+ - family
+ - qualifier
+ - amount
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'family', None, None, ), # 1
+ (2, TType.STRING, 'qualifier', None, None, ), # 2
+ (3, TType.I64, 'amount', None, 1, ), # 3
+ )
+
+ def __init__(self, family=None, qualifier=None, amount=thrift_spec[3][4],):
+ self.family = family
+ self.qualifier = qualifier
+ self.amount = amount
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.family = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.qualifier = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.I64:
+ self.amount = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TColumnIncrement')
+ if self.family is not None:
+ oprot.writeFieldBegin('family', TType.STRING, 1)
+ oprot.writeString(self.family)
+ oprot.writeFieldEnd()
+ if self.qualifier is not None:
+ oprot.writeFieldBegin('qualifier', TType.STRING, 2)
+ oprot.writeString(self.qualifier)
+ oprot.writeFieldEnd()
+ if self.amount is not None:
+ oprot.writeFieldBegin('amount', TType.I64, 3)
+ oprot.writeI64(self.amount)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.family is None:
+ raise TProtocol.TProtocolException(message='Required field family is unset!')
+ if self.qualifier is None:
+ raise TProtocol.TProtocolException(message='Required field qualifier is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TResult:
+ """
+ if no Result is found, row and columnValues will not be set.
+
+ Attributes:
+ - row
+ - columnValues
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'row', None, None, ), # 1
+ (2, TType.LIST, 'columnValues', (TType.STRUCT,(TColumnValue, TColumnValue.thrift_spec)), None, ), # 2
+ )
+
+ def __init__(self, row=None, columnValues=None,):
+ self.row = row
+ self.columnValues = columnValues
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.row = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columnValues = []
+ (_etype3, _size0) = iprot.readListBegin()
+ for _i4 in xrange(_size0):
+ _elem5 = TColumnValue()
+ _elem5.read(iprot)
+ self.columnValues.append(_elem5)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TResult')
+ if self.row is not None:
+ oprot.writeFieldBegin('row', TType.STRING, 1)
+ oprot.writeString(self.row)
+ oprot.writeFieldEnd()
+ if self.columnValues is not None:
+ oprot.writeFieldBegin('columnValues', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columnValues))
+ for iter6 in self.columnValues:
+ iter6.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.columnValues is None:
+ raise TProtocol.TProtocolException(message='Required field columnValues is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TGet:
+ """
+ Used to perform Get operations on a single row.
+
+ The scope can be further narrowed down by specifying a list of
+ columns or column families.
+
+ To get everything for a row, instantiate a Get object with just the row to get.
+ To further define the scope of what to get you can add a timestamp or time range
+ with an optional maximum number of versions to return.
+
+ If you specify a time range and a timestamp the range is ignored.
+ Timestamps on TColumns are ignored.
+
+ Attributes:
+ - row
+ - columns
+ - timestamp
+ - timeRange
+ - maxVersions
+ - filterString
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'row', None, None, ), # 1
+ (2, TType.LIST, 'columns', (TType.STRUCT,(TColumn, TColumn.thrift_spec)), None, ), # 2
+ (3, TType.I64, 'timestamp', None, None, ), # 3
+ (4, TType.STRUCT, 'timeRange', (TTimeRange, TTimeRange.thrift_spec), None, ), # 4
+ (5, TType.I32, 'maxVersions', None, None, ), # 5
+ (6, TType.STRING, 'filterString', None, None, ), # 6
+ )
+
+ def __init__(self, row=None, columns=None, timestamp=None, timeRange=None, maxVersions=None, filterString=None,):
+ self.row = row
+ self.columns = columns
+ self.timestamp = timestamp
+ self.timeRange = timeRange
+ self.maxVersions = maxVersions
+ self.filterString = filterString
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.row = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columns = []
+ (_etype10, _size7) = iprot.readListBegin()
+ for _i11 in xrange(_size7):
+ _elem12 = TColumn()
+ _elem12.read(iprot)
+ self.columns.append(_elem12)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.I64:
+ self.timestamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.STRUCT:
+ self.timeRange = TTimeRange()
+ self.timeRange.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.I32:
+ self.maxVersions = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 6:
+ if ftype == TType.STRING:
+ self.filterString = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TGet')
+ if self.row is not None:
+ oprot.writeFieldBegin('row', TType.STRING, 1)
+ oprot.writeString(self.row)
+ oprot.writeFieldEnd()
+ if self.columns is not None:
+ oprot.writeFieldBegin('columns', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columns))
+ for iter13 in self.columns:
+ iter13.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.timestamp is not None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 3)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ if self.timeRange is not None:
+ oprot.writeFieldBegin('timeRange', TType.STRUCT, 4)
+ self.timeRange.write(oprot)
+ oprot.writeFieldEnd()
+ if self.maxVersions is not None:
+ oprot.writeFieldBegin('maxVersions', TType.I32, 5)
+ oprot.writeI32(self.maxVersions)
+ oprot.writeFieldEnd()
+ if self.filterString is not None:
+ oprot.writeFieldBegin('filterString', TType.STRING, 6)
+ oprot.writeString(self.filterString)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.row is None:
+ raise TProtocol.TProtocolException(message='Required field row is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TPut:
+ """
+ Used to perform Put operations for a single row.
+
+ Add column values to this object and they'll be added.
+ You can provide a default timestamp if the column values
+ don't have one. If you don't provide a default timestamp
+ the current time is inserted.
+
+ You can also specify if this Put should be written
+ to the write-ahead Log (WAL) or not. It defaults to true.
+
+ Attributes:
+ - row
+ - columnValues
+ - timestamp
+ - writeToWal
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'row', None, None, ), # 1
+ (2, TType.LIST, 'columnValues', (TType.STRUCT,(TColumnValue, TColumnValue.thrift_spec)), None, ), # 2
+ (3, TType.I64, 'timestamp', None, None, ), # 3
+ (4, TType.BOOL, 'writeToWal', None, True, ), # 4
+ )
+
+ def __init__(self, row=None, columnValues=None, timestamp=None, writeToWal=thrift_spec[4][4],):
+ self.row = row
+ self.columnValues = columnValues
+ self.timestamp = timestamp
+ self.writeToWal = writeToWal
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.row = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columnValues = []
+ (_etype17, _size14) = iprot.readListBegin()
+ for _i18 in xrange(_size14):
+ _elem19 = TColumnValue()
+ _elem19.read(iprot)
+ self.columnValues.append(_elem19)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.I64:
+ self.timestamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.BOOL:
+ self.writeToWal = iprot.readBool();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TPut')
+ if self.row is not None:
+ oprot.writeFieldBegin('row', TType.STRING, 1)
+ oprot.writeString(self.row)
+ oprot.writeFieldEnd()
+ if self.columnValues is not None:
+ oprot.writeFieldBegin('columnValues', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columnValues))
+ for iter20 in self.columnValues:
+ iter20.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.timestamp is not None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 3)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ if self.writeToWal is not None:
+ oprot.writeFieldBegin('writeToWal', TType.BOOL, 4)
+ oprot.writeBool(self.writeToWal)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.row is None:
+ raise TProtocol.TProtocolException(message='Required field row is unset!')
+ if self.columnValues is None:
+ raise TProtocol.TProtocolException(message='Required field columnValues is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TDelete:
+ """
+ Used to perform Delete operations on a single row.
+
+ The scope can be further narrowed down by specifying a list of
+ columns or column families as TColumns.
+
+ Specifying only a family in a TColumn will delete the whole family.
+ If a timestamp is specified all versions with a timestamp less than
+ or equal to this will be deleted. If no timestamp is specified the
+ current time will be used.
+
+ Specifying a family and a column qualifier in a TColumn will delete only
+ this qualifier. If a timestamp is specified only versions equal
+ to this timestamp will be deleted. If no timestamp is specified the
+ most recent version will be deleted. To delete all previous versions,
+ specify the DELETE_COLUMNS TDeleteType.
+
+ The top level timestamp is only used if a complete row should be deleted
+ (i.e. no columns are passed) and if it is specified it works the same way
+ as if you had added a TColumn for every column family and this timestamp
+ (i.e. all versions older than or equal in all column families will be deleted)
+
+
+ Attributes:
+ - row
+ - columns
+ - timestamp
+ - deleteType
+ - writeToWal
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'row', None, None, ), # 1
+ (2, TType.LIST, 'columns', (TType.STRUCT,(TColumn, TColumn.thrift_spec)), None, ), # 2
+ (3, TType.I64, 'timestamp', None, None, ), # 3
+ (4, TType.I32, 'deleteType', None, 1, ), # 4
+ (5, TType.BOOL, 'writeToWal', None, True, ), # 5
+ )
+
+ def __init__(self, row=None, columns=None, timestamp=None, deleteType=thrift_spec[4][4], writeToWal=thrift_spec[5][4],):
+ self.row = row
+ self.columns = columns
+ self.timestamp = timestamp
+ self.deleteType = deleteType
+ self.writeToWal = writeToWal
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.row = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columns = []
+ (_etype24, _size21) = iprot.readListBegin()
+ for _i25 in xrange(_size21):
+ _elem26 = TColumn()
+ _elem26.read(iprot)
+ self.columns.append(_elem26)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.I64:
+ self.timestamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.I32:
+ self.deleteType = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.BOOL:
+ self.writeToWal = iprot.readBool();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TDelete')
+ if self.row is not None:
+ oprot.writeFieldBegin('row', TType.STRING, 1)
+ oprot.writeString(self.row)
+ oprot.writeFieldEnd()
+ if self.columns is not None:
+ oprot.writeFieldBegin('columns', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columns))
+ for iter27 in self.columns:
+ iter27.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.timestamp is not None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 3)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ if self.deleteType is not None:
+ oprot.writeFieldBegin('deleteType', TType.I32, 4)
+ oprot.writeI32(self.deleteType)
+ oprot.writeFieldEnd()
+ if self.writeToWal is not None:
+ oprot.writeFieldBegin('writeToWal', TType.BOOL, 5)
+ oprot.writeBool(self.writeToWal)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.row is None:
+ raise TProtocol.TProtocolException(message='Required field row is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TIncrement:
+ """
+ Used to perform Increment operations for a single row.
+
+ You can specify if this Increment should be written
+ to the write-ahead Log (WAL) or not. It defaults to true.
+
+ Attributes:
+ - row
+ - columns
+ - writeToWal
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'row', None, None, ), # 1
+ (2, TType.LIST, 'columns', (TType.STRUCT,(TColumnIncrement, TColumnIncrement.thrift_spec)), None, ), # 2
+ (3, TType.BOOL, 'writeToWal', None, True, ), # 3
+ )
+
+ def __init__(self, row=None, columns=None, writeToWal=thrift_spec[3][4],):
+ self.row = row
+ self.columns = columns
+ self.writeToWal = writeToWal
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.row = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columns = []
+ (_etype31, _size28) = iprot.readListBegin()
+ for _i32 in xrange(_size28):
+ _elem33 = TColumnIncrement()
+ _elem33.read(iprot)
+ self.columns.append(_elem33)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.BOOL:
+ self.writeToWal = iprot.readBool();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TIncrement')
+ if self.row is not None:
+ oprot.writeFieldBegin('row', TType.STRING, 1)
+ oprot.writeString(self.row)
+ oprot.writeFieldEnd()
+ if self.columns is not None:
+ oprot.writeFieldBegin('columns', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columns))
+ for iter34 in self.columns:
+ iter34.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.writeToWal is not None:
+ oprot.writeFieldBegin('writeToWal', TType.BOOL, 3)
+ oprot.writeBool(self.writeToWal)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ if self.row is None:
+ raise TProtocol.TProtocolException(message='Required field row is unset!')
+ if self.columns is None:
+ raise TProtocol.TProtocolException(message='Required field columns is unset!')
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TScan:
+ """
+ Any timestamps in the columns are ignored, use timeRange to select by timestamp.
+ Max versions defaults to 1.
+
+ Attributes:
+ - startRow
+ - stopRow
+ - columns
+ - caching
+ - maxVersions
+ - timeRange
+ - filterString
+ - batchSize
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'startRow', None, None, ), # 1
+ (2, TType.STRING, 'stopRow', None, None, ), # 2
+ (3, TType.LIST, 'columns', (TType.STRUCT,(TColumn, TColumn.thrift_spec)), None, ), # 3
+ (4, TType.I32, 'caching', None, None, ), # 4
+ (5, TType.I32, 'maxVersions', None, 1, ), # 5
+ (6, TType.STRUCT, 'timeRange', (TTimeRange, TTimeRange.thrift_spec), None, ), # 6
+ (7, TType.STRING, 'filterString', None, None, ), # 7
+ (8, TType.I32, 'batchSize', None, None, ), # 8
+ )
+
+ def __init__(self, startRow=None, stopRow=None, columns=None, caching=None, maxVersions=thrift_spec[5][4], timeRange=None, filterString=None, batchSize=None,):
+ self.startRow = startRow
+ self.stopRow = stopRow
+ self.columns = columns
+ self.caching = caching
+ self.maxVersions = maxVersions
+ self.timeRange = timeRange
+ self.filterString = filterString
+ self.batchSize = batchSize
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.startRow = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.stopRow = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.LIST:
+ self.columns = []
+ (_etype38, _size35) = iprot.readListBegin()
+ for _i39 in xrange(_size35):
+ _elem40 = TColumn()
+ _elem40.read(iprot)
+ self.columns.append(_elem40)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.I32:
+ self.caching = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.I32:
+ self.maxVersions = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ elif fid == 6:
+ if ftype == TType.STRUCT:
+ self.timeRange = TTimeRange()
+ self.timeRange.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 7:
+ if ftype == TType.STRING:
+ self.filterString = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 8:
+ if ftype == TType.I32:
+ self.batchSize = iprot.readI32();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TScan')
+ if self.startRow is not None:
+ oprot.writeFieldBegin('startRow', TType.STRING, 1)
+ oprot.writeString(self.startRow)
+ oprot.writeFieldEnd()
+ if self.stopRow is not None:
+ oprot.writeFieldBegin('stopRow', TType.STRING, 2)
+ oprot.writeString(self.stopRow)
+ oprot.writeFieldEnd()
+ if self.columns is not None:
+ oprot.writeFieldBegin('columns', TType.LIST, 3)
+ oprot.writeListBegin(TType.STRUCT, len(self.columns))
+ for iter41 in self.columns:
+ iter41.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.caching is not None:
+ oprot.writeFieldBegin('caching', TType.I32, 4)
+ oprot.writeI32(self.caching)
+ oprot.writeFieldEnd()
+ if self.maxVersions is not None:
+ oprot.writeFieldBegin('maxVersions', TType.I32, 5)
+ oprot.writeI32(self.maxVersions)
+ oprot.writeFieldEnd()
+ if self.timeRange is not None:
+ oprot.writeFieldBegin('timeRange', TType.STRUCT, 6)
+ self.timeRange.write(oprot)
+ oprot.writeFieldEnd()
+ if self.filterString is not None:
+ oprot.writeFieldBegin('filterString', TType.STRING, 7)
+ oprot.writeString(self.filterString)
+ oprot.writeFieldEnd()
+ if self.batchSize is not None:
+ oprot.writeFieldBegin('batchSize', TType.I32, 8)
+ oprot.writeI32(self.batchSize)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TIOError(TException):
+ """
+ A TIOError exception signals that an error occurred communicating
+ to the HBase master or a HBase region server. Also used to return
+ more general HBase error conditions.
+
+ Attributes:
+ - message
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'message', None, None, ), # 1
+ )
+
+ def __init__(self, message=None,):
+ self.message = message
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.message = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TIOError')
+ if self.message is not None:
+ oprot.writeFieldBegin('message', TType.STRING, 1)
+ oprot.writeString(self.message)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __str__(self):
+ return repr(self)
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class TIllegalArgument(TException):
+ """
+ A TIllegalArgument exception indicates an illegal or invalid
+ argument was passed into a procedure.
+
+ Attributes:
+ - message
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'message', None, None, ), # 1
+ )
+
+ def __init__(self, message=None,):
+ self.message = message
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+ return
+ iprot.readStructBegin()
+ while True:
+ (fname, ftype, fid) = iprot.readFieldBegin()
+ if ftype == TType.STOP:
+ break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.message = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('TIllegalArgument')
+ if self.message is not None:
+ oprot.writeFieldBegin('message', TType.STRING, 1)
+ oprot.writeString(self.message)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def validate(self):
+ return
+
+
+ def __str__(self):
+ return repr(self)
+
+ def __repr__(self):
+ L = ['%s=%r' % (key, value)
+ for key, value in self.__dict__.iteritems()]
+ return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
Modified: hbase/branches/0.95/hbase-examples/thrift2/DemoClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/thrift2/DemoClient.java?rev=1501723&r1=1501722&r2=1501723&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-examples/thrift2/DemoClient.java (original)
+++ hbase/branches/0.95/hbase-examples/thrift2/DemoClient.java Wed Jul 10 11:17:36 2013
@@ -1,89 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.thrift2;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.hadoop.hbase.thrift2.generated.TColumnValue;
-import org.apache.hadoop.hbase.thrift2.generated.TGet;
-import org.apache.hadoop.hbase.thrift2.generated.THBaseService;
-import org.apache.hadoop.hbase.thrift2.generated.TIOError;
-import org.apache.hadoop.hbase.thrift2.generated.TPut;
-import org.apache.hadoop.hbase.thrift2.generated.TResult;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransport;
-
-public class DemoClient {
- public static void main(String[] args) throws TIOError, TException {
- System.out.println("Thrift2 Demo");
- System.out.println("This demo assumes you have a table called \"example\" with a column family called \"family1\"");
-
- String host = "localhost";
- int port = 9090;
- int timeout = 10000;
- boolean 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();
-
- ByteBuffer table = ByteBuffer.wrap("example".getBytes());
-
- TPut put = new TPut();
- put.setRow("row1".getBytes());
-
- TColumnValue columnValue = new TColumnValue();
- columnValue.setFamily("family1".getBytes());
- columnValue.setQualifier("qualifier1".getBytes());
- columnValue.setValue("value1".getBytes());
- List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
- columnValues.add(columnValue);
- put.setColumnValues(columnValues);
-
- client.put(table, put);
-
- TGet get = new TGet();
- get.setRow("row1".getBytes());
-
- TResult result = client.get(table, get);
-
- System.out.print("row = " + new String(result.getRow()));
- for (TColumnValue resultColumnValue : result.getColumnValues()) {
- System.out.print("family = " + new String(resultColumnValue.getFamily()));
- System.out.print("qualifier = " + new String(resultColumnValue.getFamily()));
- System.out.print("value = " + new String(resultColumnValue.getValue()));
- System.out.print("timestamp = " + resultColumnValue.getTimestamp());
- }
-
- transport.close();
- }
-}
Modified: hbase/branches/0.95/hbase-examples/thrift2/DemoClient.py
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-examples/thrift2/DemoClient.py?rev=1501723&r1=1501722&r2=1501723&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-examples/thrift2/DemoClient.py (original)
+++ hbase/branches/0.95/hbase-examples/thrift2/DemoClient.py Wed Jul 10 11:17:36 2013
@@ -1,68 +0,0 @@
-"""
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-# Instructions:
-# 1. Run Thrift to generate the python module hbase
-# thrift --gen py ../../../src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
-# 2. Create a directory of your choosing that contains:
-# a. This file (DemoClient.py).
-# b. The directory gen-py/hbase (generated by instruction step 1).
-# 3. pip install thrift==0.7.0
-# 4. Create a table call "example", with a family called "family1" using the hbase shell.
-# 5. Start the hbase thrift2 server
-# bin/hbase thrift2 start
-# 6. Execute {python DemoClient.py}.
-
-from thrift.transport import TTransport
-from thrift.transport import TSocket
-from thrift.transport import THttpClient
-from thrift.protocol import TBinaryProtocol
-
-from hbase import THBaseService
-from hbase.ttypes import *
-
-print "Thrift2 Demo"
-print "This demo assumes you have a table called \"example\" with a column family called \"family1\""
-
-host = "localhost"
-port = 9090
-framed = False
-
-socket = TSocket.TSocket(host, port)
-if framed:
- transport = TTransport.TFramedTransport(socket)
-else:
- transport = TTransport.TBufferedTransport(socket)
-protocol = TBinaryProtocol.TBinaryProtocol(transport)
-client = THBaseService.Client(protocol)
-
-transport.open()
-
-table = "example"
-
-put = TPut(row="row1", columnValues=[TColumnValue(family="family1",qualifier="qualifier1",value="value1")])
-print "Putting:", put
-client.put(table, put)
-
-get = TGet(row="row1")
-print "Getting:", get
-result = client.get(table, get)
-
-print "Result:", result
-
-transport.close()