Propchange:
incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/Cassandra.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/__init__.py
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/__init__.py?rev=907705&view=auto
==============================================================================
--- incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/__init__.py
(added)
+++ incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/__init__.py Mon
Feb 8 15:57:45 2010
@@ -0,0 +1 @@
+__all__ = ['ttypes', 'constants', 'Cassandra']
Propchange:
incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/constants.py
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/constants.py?rev=907705&view=auto
==============================================================================
--- incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/constants.py
(added)
+++ incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/constants.py
Mon Feb 8 15:57:45 2010
@@ -0,0 +1,11 @@
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+from thrift.Thrift import *
+from ttypes import *
+
+VERSION = "2.1.0"
+
Propchange:
incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/constants.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/ttypes.py
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/ttypes.py?rev=907705&view=auto
==============================================================================
--- incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/ttypes.py
(added)
+++ incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/ttypes.py Mon
Feb 8 15:57:45 2010
@@ -0,0 +1,1389 @@
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+from thrift.Thrift import *
+
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+try:
+ from thrift.protocol import fastbinary
+except:
+ fastbinary = None
+
+
+class ConsistencyLevel:
+ """
+ The ConsistencyLevel is an enum that controls both read and write behavior
based on <ReplicationFactor> in your
+ storage-conf.xml. The different consistency levels have different meanings,
depending on if you're doing a write or read
+ operation. Note that if W + R > ReplicationFactor, where W is the number of
nodes to block for on write, and R
+ the number to block for on reads, you will have strongly consistent
behavior; that is, readers will always see the most
+ recent write. Of these, the most interesting is to do QUORUM reads and
writes, which gives you consistency while still
+ allowing availability in the face of node failures up to half of
<ReplicationFactor>. Of course if latency is more
+ important than consistency then you can use lower values for either or both.
+
+ Write:
+ ZERO Ensure nothing. A write happens asynchronously in background
+ ANY Ensure that the write has been written once somewhere,
including possibly being hinted in a non-target node.
+ ONE Ensure that the write has been written to at least 1 node's
commit log and memory table before responding to the client.
+ QUORUM Ensure that the write has been written to <ReplicationFactor> /
2 + 1 nodes before responding to the client.
+ ALL Ensure that the write is written to
<code><ReplicationFactor></code> nodes before responding to the client.
+
+ Read:
+ ZERO Not supported, because it doesn't make sense.
+ ANY Not supported. You probably want ONE instead.
+ ONE Will return the record returned by the first node to respond. A
consistency check is always done in a
+ background thread to fix any consistency issues when
ConsistencyLevel.ONE is used. This means subsequent
+ calls will have correct data even if the initial read gets an
older value. (This is called 'read repair'.)
+ QUORUM Will query all storage nodes and return the record with the
most recent timestamp once it has at least a
+ majority of replicas reported. Again, the remaining replicas
will be checked in the background.
+ ALL Not yet supported, but we plan to eventually.
+ """
+ ZERO = 0
+ ONE = 1
+ QUORUM = 2
+ DCQUORUM = 3
+ DCQUORUMSYNC = 4
+ ALL = 5
+ ANY = 6
+
+ _VALUES_TO_NAMES = {
+ 0: "ZERO",
+ 1: "ONE",
+ 2: "QUORUM",
+ 3: "DCQUORUM",
+ 4: "DCQUORUMSYNC",
+ 5: "ALL",
+ 6: "ANY",
+ }
+
+ _NAMES_TO_VALUES = {
+ "ZERO": 0,
+ "ONE": 1,
+ "QUORUM": 2,
+ "DCQUORUM": 3,
+ "DCQUORUMSYNC": 4,
+ "ALL": 5,
+ "ANY": 6,
+ }
+
+class Column:
+ """
+ Basic unit of data within a ColumnFamily.
+ @param name. A column name can act both as structure (a label) or as data
(like value). Regardless, the name of the column
+ is used as a key to its value.
+ @param value. Some data
+ @param timestamp. Used to record when data was sent to be written.
+
+ Attributes:
+ - name
+ - value
+ - timestamp
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'name', None, None, ), # 1
+ (2, TType.STRING, 'value', None, None, ), # 2
+ (3, TType.I64, 'timestamp', None, None, ), # 3
+ )
+
+ def __init__(self, name=None, value=None, timestamp=None,):
+ self.name = name
+ 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.name = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.value = 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('Column')
+ if self.name != None:
+ oprot.writeFieldBegin('name', TType.STRING, 1)
+ oprot.writeString(self.name)
+ oprot.writeFieldEnd()
+ if self.value != None:
+ oprot.writeFieldBegin('value', TType.STRING, 2)
+ oprot.writeString(self.value)
+ oprot.writeFieldEnd()
+ if self.timestamp != None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 3)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 SuperColumn:
+ """
+ A named list of columns.
+ @param name. see Column.name.
+ @param columns. A collection of standard Columns. The columns within a
super column are defined in an adhoc manner.
+ Columns within a super column do not have to have matching
structures (similarly named child columns).
+
+ Attributes:
+ - name
+ - columns
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'name', None, None, ), # 1
+ (2, TType.LIST, 'columns', (TType.STRUCT,(Column, Column.thrift_spec)),
None, ), # 2
+ )
+
+ def __init__(self, name=None, columns=None,):
+ self.name = name
+ self.columns = columns
+
+ 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.name = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columns = []
+ (_etype3, _size0) = iprot.readListBegin()
+ for _i4 in xrange(_size0):
+ _elem5 = Column()
+ _elem5.read(iprot)
+ self.columns.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('SuperColumn')
+ if self.name != None:
+ oprot.writeFieldBegin('name', TType.STRING, 1)
+ oprot.writeString(self.name)
+ oprot.writeFieldEnd()
+ if self.columns != None:
+ oprot.writeFieldBegin('columns', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columns))
+ for iter6 in self.columns:
+ iter6.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 ColumnOrSuperColumn:
+ """
+ Methods for fetching rows/records from Cassandra will return either a single
instance of ColumnOrSuperColumn or a list
+ of ColumnOrSuperColumns (get_slice()). If you're looking up a SuperColumn
(or list of SuperColumns) then the resulting
+ instances of ColumnOrSuperColumn will have the requested SuperColumn in the
attribute super_column. For queries resulting
+ in Columns, those values will be in the attribute column. This change was
made between 0.3 and 0.4 to standardize on
+ single query methods that may return either a SuperColumn or Column.
+
+ @param column. The Column returned by get() or get_slice().
+ @param super_column. The SuperColumn returned by get() or get_slice().
+
+ Attributes:
+ - column
+ - super_column
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'column', (Column, Column.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'super_column', (SuperColumn, SuperColumn.thrift_spec),
None, ), # 2
+ )
+
+ def __init__(self, column=None, super_column=None,):
+ self.column = column
+ self.super_column = super_column
+
+ 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.STRUCT:
+ self.column = Column()
+ self.column.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.super_column = SuperColumn()
+ self.super_column.read(iprot)
+ 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('ColumnOrSuperColumn')
+ if self.column != None:
+ oprot.writeFieldBegin('column', TType.STRUCT, 1)
+ self.column.write(oprot)
+ oprot.writeFieldEnd()
+ if self.super_column != None:
+ oprot.writeFieldBegin('super_column', TType.STRUCT, 2)
+ self.super_column.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 NotFoundException(Exception):
+ """
+ A specific column was requested that does not exist.
+ """
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('NotFoundException')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 InvalidRequestException(Exception):
+ """
+ Invalid request could mean keyspace or column family does not exist,
required parameters are missing, or a parameter is malformed.
+ why contains an associated error message.
+
+ Attributes:
+ - why
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'why', None, None, ), # 1
+ )
+
+ def __init__(self, why=None,):
+ self.why = why
+
+ 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.why = 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('InvalidRequestException')
+ if self.why != None:
+ oprot.writeFieldBegin('why', TType.STRING, 1)
+ oprot.writeString(self.why)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 UnavailableException(Exception):
+ """
+ Not all the replicas required could be created and/or read.
+ """
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('UnavailableException')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 TimedOutException(Exception):
+ """
+ RPC timeout was exceeded. either a node failed mid-operation, or load was
too high, or the requested op was too large.
+ """
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('TimedOutException')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 AuthenticationException(Exception):
+ """
+ invalid authentication request (user does not exist or credentials invalid)
+
+ Attributes:
+ - why
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'why', None, None, ), # 1
+ )
+
+ def __init__(self, why=None,):
+ self.why = why
+
+ 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.why = 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('AuthenticationException')
+ if self.why != None:
+ oprot.writeFieldBegin('why', TType.STRING, 1)
+ oprot.writeString(self.why)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 AuthorizationException(Exception):
+ """
+ invalid authorization request (user does not have access to keyspace)
+
+ Attributes:
+ - why
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'why', None, None, ), # 1
+ )
+
+ def __init__(self, why=None,):
+ self.why = why
+
+ 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.why = 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('AuthorizationException')
+ if self.why != None:
+ oprot.writeFieldBegin('why', TType.STRING, 1)
+ oprot.writeString(self.why)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 ColumnParent:
+ """
+ ColumnParent is used when selecting groups of columns from the same
ColumnFamily. In directory structure terms, imagine
+ ColumnParent as ColumnPath + '/../'.
+
+ See also <a href="cassandra.html#Struct_ColumnPath">ColumnPath</a>
+
+ Attributes:
+ - column_family
+ - super_column
+ """
+
+ thrift_spec = (
+ None, # 0
+ None, # 1
+ None, # 2
+ (3, TType.STRING, 'column_family', None, None, ), # 3
+ (4, TType.STRING, 'super_column', None, None, ), # 4
+ )
+
+ def __init__(self, column_family=None, super_column=None,):
+ self.column_family = column_family
+ self.super_column = super_column
+
+ 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 == 3:
+ if ftype == TType.STRING:
+ self.column_family = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.STRING:
+ self.super_column = 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('ColumnParent')
+ if self.column_family != None:
+ oprot.writeFieldBegin('column_family', TType.STRING, 3)
+ oprot.writeString(self.column_family)
+ oprot.writeFieldEnd()
+ if self.super_column != None:
+ oprot.writeFieldBegin('super_column', TType.STRING, 4)
+ oprot.writeString(self.super_column)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 ColumnPath:
+ """
+ The ColumnPath is the path to a single column in Cassandra. It might make
sense to think of ColumnPath and
+ ColumnParent in terms of a directory structure.
+
+ ColumnPath is used to looking up a single column.
+
+ @param column_family. The name of the CF of the column being looked up.
+ @param super_column. The super column name.
+ @param column. The column name.
+
+ Attributes:
+ - column_family
+ - super_column
+ - column
+ """
+
+ thrift_spec = (
+ None, # 0
+ None, # 1
+ None, # 2
+ (3, TType.STRING, 'column_family', None, None, ), # 3
+ (4, TType.STRING, 'super_column', None, None, ), # 4
+ (5, TType.STRING, 'column', None, None, ), # 5
+ )
+
+ def __init__(self, column_family=None, super_column=None, column=None,):
+ self.column_family = column_family
+ self.super_column = super_column
+ self.column = column
+
+ 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 == 3:
+ if ftype == TType.STRING:
+ self.column_family = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.STRING:
+ self.super_column = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.STRING:
+ self.column = 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('ColumnPath')
+ if self.column_family != None:
+ oprot.writeFieldBegin('column_family', TType.STRING, 3)
+ oprot.writeString(self.column_family)
+ oprot.writeFieldEnd()
+ if self.super_column != None:
+ oprot.writeFieldBegin('super_column', TType.STRING, 4)
+ oprot.writeString(self.super_column)
+ oprot.writeFieldEnd()
+ if self.column != None:
+ oprot.writeFieldBegin('column', TType.STRING, 5)
+ oprot.writeString(self.column)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 SliceRange:
+ """
+ A slice range is a structure that stores basic range, ordering and limit
information for a query that will return
+ multiple columns. It could be thought of as Cassandra's version of LIMIT and
ORDER BY
+
+ @param start. The column name to start the slice with. This attribute is not
required, though there is no default value,
+ and can be safely set to '', i.e., an empty byte array, to
start with the first column name. Otherwise, it
+ must a valid value under the rules of the Comparator defined
for the given ColumnFamily.
+ @param finish. The column name to stop the slice at. This attribute is not
required, though there is no default value,
+ and can be safely set to an empty byte array to not stop
until 'count' results are seen. Otherwise, it
+ must also be a value value to the ColumnFamily Comparator.
+ @param reversed. Whether the results should be ordered in reversed order.
Similar to ORDER BY blah DESC in SQL.
+ @param count. How many keys to return. Similar to LIMIT 100 in SQL. May be
arbitrarily large, but Thrift will
+ materialize the whole result into memory before returning it
to the client, so be aware that you may
+ be better served by iterating through slices by passing the
last value of one call in as the 'start'
+ of the next instead of increasing 'count' arbitrarily large.
+
+ Attributes:
+ - start
+ - finish
+ - reversed
+ - count
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'start', None, None, ), # 1
+ (2, TType.STRING, 'finish', None, None, ), # 2
+ (3, TType.BOOL, 'reversed', None, False, ), # 3
+ (4, TType.I32, 'count', None, 100, ), # 4
+ )
+
+ def __init__(self, start=None, finish=None, reversed=thrift_spec[3][4],
count=thrift_spec[4][4],):
+ self.start = start
+ self.finish = finish
+ self.reversed = reversed
+ self.count = count
+
+ 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.start = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.finish = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.BOOL:
+ self.reversed = iprot.readBool();
+ else:
+ iprot.skip(ftype)
+ elif fid == 4:
+ if ftype == TType.I32:
+ self.count = 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('SliceRange')
+ if self.start != None:
+ oprot.writeFieldBegin('start', TType.STRING, 1)
+ oprot.writeString(self.start)
+ oprot.writeFieldEnd()
+ if self.finish != None:
+ oprot.writeFieldBegin('finish', TType.STRING, 2)
+ oprot.writeString(self.finish)
+ oprot.writeFieldEnd()
+ if self.reversed != None:
+ oprot.writeFieldBegin('reversed', TType.BOOL, 3)
+ oprot.writeBool(self.reversed)
+ oprot.writeFieldEnd()
+ if self.count != None:
+ oprot.writeFieldBegin('count', TType.I32, 4)
+ oprot.writeI32(self.count)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 SlicePredicate:
+ """
+ A SlicePredicate is similar to a mathematic predicate (see
http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)),
+ which is described as "a property that the elements of a set have in common."
+
+ SlicePredicate's in Cassandra are described with either a list of
column_names or a SliceRange. If column_names is
+ specified, slice_range is ignored.
+
+ @param column_name. A list of column names to retrieve. This can be used
similar to Memcached's "multi-get" feature
+ to fetch N known column names. For instance, if you know
you wish to fetch columns 'Joe', 'Jack',
+ and 'Jim' you can pass those column names as a list to
fetch all three at once.
+ @param slice_range. A SliceRange describing how to range, order, and/or
limit the slice.
+
+ Attributes:
+ - column_names
+ - slice_range
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.LIST, 'column_names', (TType.STRING,None), None, ), # 1
+ (2, TType.STRUCT, 'slice_range', (SliceRange, SliceRange.thrift_spec),
None, ), # 2
+ )
+
+ def __init__(self, column_names=None, slice_range=None,):
+ self.column_names = column_names
+ self.slice_range = slice_range
+
+ 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.LIST:
+ self.column_names = []
+ (_etype10, _size7) = iprot.readListBegin()
+ for _i11 in xrange(_size7):
+ _elem12 = iprot.readString();
+ self.column_names.append(_elem12)
+ iprot.readListEnd()
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.slice_range = SliceRange()
+ self.slice_range.read(iprot)
+ 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('SlicePredicate')
+ if self.column_names != None:
+ oprot.writeFieldBegin('column_names', TType.LIST, 1)
+ oprot.writeListBegin(TType.STRING, len(self.column_names))
+ for iter13 in self.column_names:
+ oprot.writeString(iter13)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ if self.slice_range != None:
+ oprot.writeFieldBegin('slice_range', TType.STRUCT, 2)
+ self.slice_range.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 KeySlice:
+ """
+ A KeySlice is key followed by the data it maps to. A collection of KeySlice
is returned by the get_range_slice operation.
+
+ @param key. a row key
+ @param columns. List of data represented by the key. Typically, the list is
pared down to only the columns specified by
+ a SlicePredicate.
+
+ Attributes:
+ - key
+ - columns
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ (2, TType.LIST, 'columns', (TType.STRUCT,(ColumnOrSuperColumn,
ColumnOrSuperColumn.thrift_spec)), None, ), # 2
+ )
+
+ def __init__(self, key=None, columns=None,):
+ self.key = key
+ self.columns = columns
+
+ 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.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.LIST:
+ self.columns = []
+ (_etype17, _size14) = iprot.readListBegin()
+ for _i18 in xrange(_size14):
+ _elem19 = ColumnOrSuperColumn()
+ _elem19.read(iprot)
+ self.columns.append(_elem19)
+ 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('KeySlice')
+ if self.key != None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ if self.columns != None:
+ oprot.writeFieldBegin('columns', TType.LIST, 2)
+ oprot.writeListBegin(TType.STRUCT, len(self.columns))
+ for iter20 in self.columns:
+ iter20.write(oprot)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 Deletion:
+ """
+ Attributes:
+ - timestamp
+ - super_column
+ - predicate
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.I64, 'timestamp', None, None, ), # 1
+ (2, TType.STRING, 'super_column', None, None, ), # 2
+ (3, TType.STRUCT, 'predicate', (SlicePredicate,
SlicePredicate.thrift_spec), None, ), # 3
+ )
+
+ def __init__(self, timestamp=None, super_column=None, predicate=None,):
+ self.timestamp = timestamp
+ self.super_column = super_column
+ self.predicate = predicate
+
+ 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.timestamp = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.super_column = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.STRUCT:
+ self.predicate = SlicePredicate()
+ self.predicate.read(iprot)
+ 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('Deletion')
+ if self.timestamp != None:
+ oprot.writeFieldBegin('timestamp', TType.I64, 1)
+ oprot.writeI64(self.timestamp)
+ oprot.writeFieldEnd()
+ if self.super_column != None:
+ oprot.writeFieldBegin('super_column', TType.STRING, 2)
+ oprot.writeString(self.super_column)
+ oprot.writeFieldEnd()
+ if self.predicate != None:
+ oprot.writeFieldBegin('predicate', TType.STRUCT, 3)
+ self.predicate.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 Mutation:
+ """
+ A Mutation is either an insert, represented by filling
column_or_supercolumn, or a deletion, represented by filling the deletion
attribute.
+ @param column_or_supercolumn. An insert to a column or supercolumn
+ @param deletion. A deletion of a column or supercolumn
+
+ Attributes:
+ - column_or_supercolumn
+ - deletion
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRUCT, 'column_or_supercolumn', (ColumnOrSuperColumn,
ColumnOrSuperColumn.thrift_spec), None, ), # 1
+ (2, TType.STRUCT, 'deletion', (Deletion, Deletion.thrift_spec), None, ), #
2
+ )
+
+ def __init__(self, column_or_supercolumn=None, deletion=None,):
+ self.column_or_supercolumn = column_or_supercolumn
+ self.deletion = deletion
+
+ 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.STRUCT:
+ self.column_or_supercolumn = ColumnOrSuperColumn()
+ self.column_or_supercolumn.read(iprot)
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRUCT:
+ self.deletion = Deletion()
+ self.deletion.read(iprot)
+ 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('Mutation')
+ if self.column_or_supercolumn != None:
+ oprot.writeFieldBegin('column_or_supercolumn', TType.STRUCT, 1)
+ self.column_or_supercolumn.write(oprot)
+ oprot.writeFieldEnd()
+ if self.deletion != None:
+ oprot.writeFieldBegin('deletion', TType.STRUCT, 2)
+ self.deletion.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 TokenRange:
+ """
+ Attributes:
+ - start_token
+ - end_token
+ - endpoints
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'start_token', None, None, ), # 1
+ (2, TType.STRING, 'end_token', None, None, ), # 2
+ (3, TType.LIST, 'endpoints', (TType.STRING,None), None, ), # 3
+ )
+
+ def __init__(self, start_token=None, end_token=None, endpoints=None,):
+ self.start_token = start_token
+ self.end_token = end_token
+ self.endpoints = endpoints
+
+ 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.start_token = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.end_token = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 3:
+ if ftype == TType.LIST:
+ self.endpoints = []
+ (_etype24, _size21) = iprot.readListBegin()
+ for _i25 in xrange(_size21):
+ _elem26 = iprot.readString();
+ self.endpoints.append(_elem26)
+ 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('TokenRange')
+ if self.start_token != None:
+ oprot.writeFieldBegin('start_token', TType.STRING, 1)
+ oprot.writeString(self.start_token)
+ oprot.writeFieldEnd()
+ if self.end_token != None:
+ oprot.writeFieldBegin('end_token', TType.STRING, 2)
+ oprot.writeString(self.end_token)
+ oprot.writeFieldEnd()
+ if self.endpoints != None:
+ oprot.writeFieldBegin('endpoints', TType.LIST, 3)
+ oprot.writeListBegin(TType.STRING, len(self.endpoints))
+ for iter27 in self.endpoints:
+ oprot.writeString(iter27)
+ oprot.writeListEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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 AuthenticationRequest:
+ """
+ Authentication requests can contain any data, dependent on the
AuthenticationBackend used
+
+ Attributes:
+ - credentials
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.MAP, 'credentials', (TType.STRING,None,TType.STRING,None), None,
), # 1
+ )
+
+ def __init__(self, credentials=None,):
+ self.credentials = credentials
+
+ 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.MAP:
+ self.credentials = {}
+ (_ktype29, _vtype30, _size28 ) = iprot.readMapBegin()
+ for _i32 in xrange(_size28):
+ _key33 = iprot.readString();
+ _val34 = iprot.readString();
+ self.credentials[_key33] = _val34
+ iprot.readMapEnd()
+ 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('AuthenticationRequest')
+ if self.credentials != None:
+ oprot.writeFieldBegin('credentials', TType.MAP, 1)
+ oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.credentials))
+ for kiter35,viter36 in self.credentials.items():
+ oprot.writeString(kiter35)
+ oprot.writeString(viter36)
+ oprot.writeMapEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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)
+
Propchange:
incubator/cassandra/trunk/interface/thrift/gen-py/cassandra/ttypes.py
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=907705&r1=907704&r2=907705&view=diff
==============================================================================
---
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
Mon Feb 8 15:57:45 2010
@@ -390,15 +390,20 @@
keyspace = DatabaseDescriptor.getNonSystemTables().get(0);
/* All the ranges for the tokens */
- List<Range> ranges = getAllRanges(tokenMetadata_.sortedTokens());
Map<Range, List<String>> map = new HashMap<Range, List<String>>();
- for (Map.Entry<Range,List<InetAddress>> entry :
constructRangeToEndPointMap(keyspace, ranges).entrySet())
+ for (Map.Entry<Range,List<InetAddress>> entry :
getRangeToAddressMap(keyspace).entrySet())
{
map.put(entry.getKey(), stringify(entry.getValue()));
}
return map;
}
+ public Map<Range, List<InetAddress>> getRangeToAddressMap(String keyspace)
+ {
+ List<Range> ranges = getAllRanges(tokenMetadata_.sortedTokens());
+ return constructRangeToEndPointMap(keyspace, ranges);
+ }
+
/**
* Construct the range to endpoint mapping based on the true view
* of the world.
Modified:
incubator/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java?rev=907705&r1=907704&r2=907705&view=diff
==============================================================================
---
incubator/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
(original)
+++
incubator/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
Mon Feb 8 15:57:45 2010
@@ -25,26 +25,25 @@
import java.util.concurrent.TimeoutException;
import org.apache.log4j.Logger;
-
import org.apache.commons.lang.ArrayUtils;
-import org.apache.cassandra.auth.*;
+import org.apache.cassandra.auth.AllowAllAuthenticator;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.*;
-import org.apache.cassandra.db.marshal.MarshalException;
import org.apache.cassandra.db.filter.QueryPath;
-
-import static org.apache.cassandra.thrift.ThriftGlue.*;
-
+import org.apache.cassandra.db.marshal.MarshalException;
import org.apache.cassandra.dht.Bounds;
+import org.apache.cassandra.dht.Range;
import org.apache.cassandra.service.StorageProxy;
import org.apache.cassandra.service.StorageService;
-import org.apache.cassandra.thrift.Cassandra.Iface;
import org.apache.cassandra.utils.Pair;
import org.apache.thrift.TException;
import org.json.simple.JSONValue;
+import static
org.apache.cassandra.thrift.ThriftGlue.createColumnOrSuperColumn_Column;
+import static
org.apache.cassandra.thrift.ThriftGlue.createColumnOrSuperColumn_SuperColumn;
+
public class CassandraServer implements Cassandra.Iface
{
public static String TOKEN_MAP = "token map";
@@ -581,6 +580,33 @@
return keySlices;
}
+ public Set<String> describe_keyspaces() throws TException
+ {
+ return DatabaseDescriptor.getTables();
+ }
+
+ public String describe_cluster_name() throws TException
+ {
+ return DatabaseDescriptor.getClusterName();
+ }
+
+ public String describe_version() throws TException
+ {
+ return Constants.VERSION;
+ }
+
+ public List<TokenRange> describe_ring(String keyspace)
+ {
+ List<TokenRange> ranges = new ArrayList<TokenRange>();
+ for (Map.Entry<Range, List<String>> entry :
StorageService.instance.getRangeToEndPointMap(keyspace).entrySet())
+ {
+ Range range = entry.getKey();
+ List<String> endpoints = entry.getValue();
+ ranges.add(new TokenRange(range.left.toString(),
range.right.toString(), endpoints));
+ }
+ return ranges;
+ }
+
public void login(String keyspace, AuthenticationRequest auth_request)
throws AuthenticationException, AuthorizationException, TException
{
DatabaseDescriptor.getAuthenticator().login(keyspace, auth_request);
Modified: incubator/cassandra/trunk/test/system/__init__.py
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/__init__.py?rev=907705&r1=907704&r2=907705&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/__init__.py (original)
+++ incubator/cassandra/trunk/test/system/__init__.py Mon Feb 8 15:57:45 2010
@@ -26,7 +26,7 @@
# add cassandra directory to sys.path
L = os.path.abspath(__file__).split(os.path.sep)[:-3]
root = os.path.sep.join(L)
-_ipath = os.path.join(root, 'interface', 'gen-py')
+_ipath = os.path.join(root, 'interface', 'thrift', 'gen-py')
sys.path.append(os.path.join(_ipath, 'cassandra'))
import Cassandra
Modified: incubator/cassandra/trunk/test/system/test_server.py
URL:
http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/test_server.py?rev=907705&r1=907704&r2=907705&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/test_server.py (original)
+++ incubator/cassandra/trunk/test/system/test_server.py Mon Feb 8 15:57:45
2010
@@ -23,6 +23,7 @@
from thrift.Thrift import TApplicationException
from ttypes import *
+from Constants import VERSION
def _i64(n):
@@ -872,8 +873,16 @@
def test_describe_keyspace(self):
""" Test keyspace description """
- kspaces = client.get_string_list_property("keyspaces")
+ kspaces = client.describe_keyspaces()
assert len(kspaces) == 5, kspaces # ['Keyspace1', 'Keyspace2',
'Keyspace3', 'Keyspace4', 'system']
ks1 = client.describe_keyspace("Keyspace1")
assert set(ks1.keys()) == set(['Super1', 'Standard1', 'Standard2',
'StandardLong1', 'StandardLong2', 'Super3', 'Super2', 'Super4'])
sysks = client.describe_keyspace("system")
+
+ def test_describe(self):
+ server_version = client.describe_version()
+ assert server_version == VERSION, (server_version, VERSION)
+ assert client.describe_cluster_name() == 'Test Cluster'
+
+ def test_describe_ring(self):
+ assert list(client.describe_ring('Keyspace1'))[0].endpoints ==
['127.0.0.1']