Thrift removal

patch by Sylvain Lebresne; reviewed by Aleksey Yeschenko for CASSANDRA-11115
This commit is contained in:
Sylvain Lebresne 2016-11-21 17:55:12 +01:00
parent e8b8a90336
commit 4881d9c308
285 changed files with 941 additions and 101293 deletions

View File

@ -1,4 +1,5 @@
4.0
* Thrift removal (CASSANDRA-11115)
* Remove pre-3.0 compatibility code for 4.0 (CASSANDRA-12716)
* Add column definition kind to dropped columns in schema (CASSANDRA-12705)
* Add (automate) Nodetool Documentation (CASSANDRA-12672)

View File

@ -21,14 +21,20 @@ New features
Upgrading
---------
- Cassandra 4.0 removed support for any pre-3.0 format. This means you cannot upgrade from a 2.x version to 4.0
directly, you have to upgrade to a 3.0.x/3.x version first (and run upgradesstable). In particular, this mean
Cassandra 4.0 cannot load or read pre-3.0 sstables in any way: you will need to upgrade those sstable in 3.0.x/3.x
first.
- Cassandra will no longer allow invalid keyspace replication options, such as invalid datacenter names for
NetworkTopologyStrategy. Operators MUST add new nodes to a datacenter before they can set set ALTER or
CREATE keyspace replication policies using that datacenter. Existing keyspaces will continue to operate,
but CREATE and ALTER will validate that all datacenters specified exist in the cluster.
- Cassandra 4.0 removed support for the deprecated Thrift interface. Amongst
Tother things, this imply the removal of all yaml option related to thrift
('start_rpc', rpc_port, ...).
- Cassandra 4.0 removed support for any pre-3.0 format. This means you
cannot upgrade from a 2.x version to 4.0 directly, you have to upgrade to
a 3.0.x/3.x version first (and run upgradesstable). In particular, this
mean Cassandra 4.0 cannot load or read pre-3.0 sstables in any way: you
will need to upgrade those sstable in 3.0.x/3.x first.
- Cassandra will no longer allow invalid keyspace replication options, such
as invalid datacenter names for NetworkTopologyStrategy. Operators MUST
add new nodes to a datacenter before they can set set ALTER or CREATE
keyspace replication policies using that datacenter. Existing keyspaces
will continue to operate, but CREATE and ALTER will validate that all
datacenters specified exist in the cluster.
3.11
====

View File

@ -46,13 +46,6 @@ Written by Adrien Grand.
Contains bindings to the C LZ4 implementation (http://code.google.com/p/lz4/)
Copyright (C) 2011-2012, Yann Collet.
Alternative Disruptor backed thrift server from https://github.com/xedin/disruptor_thrift_server
Written by Pavel Yaskevich.
LMAX Disruptor
(http://lmax-exchange.github.io/disruptor/)
Copyright 2011 LMAX Ltd.
Airline
(https://github.com/airlift/airline)
Copyright 2011, Dain Sundstrom dain@iq80.com

View File

@ -112,7 +112,7 @@ if EXIST "%CASSANDRA_HOME%\lib\jsr223\scala\scala-compiler.jar" (
)
REM Include the build\classes\main directory so it works in development
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";"%CASSANDRA_HOME%\build\classes\thrift"
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main"
set CASSANDRA_PARAMS=-Dcassandra -Dcassandra-foreground=yes
set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.logdir="%CASSANDRA_HOME%\logs"
set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.storagedir="%CASSANDRA_HOME%\data"

View File

@ -44,7 +44,7 @@ goto :eof
:okClasspath
REM Include the build\classes\main directory so it works in development
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";%CASSANDRA_CONF%;"%CASSANDRA_HOME%\build\classes\thrift"
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";%CASSANDRA_CONF%
REM Add the default storage location. Can be overridden in conf\cassandra.yaml
set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% "-Dcassandra.storagedir=%CASSANDRA_HOME%\data"

View File

@ -27,7 +27,6 @@ fi
# compiled classes. NOTE: This isn't needed by the startup script,
# it's just used here in constructing the classpath.
cassandra_bin="$CASSANDRA_HOME/build/classes/main"
cassandra_bin="$cassandra_bin:$CASSANDRA_HOME/build/classes/thrift"
#cassandra_bin="$CASSANDRA_HOME/build/cassandra.jar"
# the default location for commitlogs, sstables, and saved caches

View File

@ -298,9 +298,8 @@ Function VerifyPortsAreAvailable
# storage_port
# ssl_storage_port
# native_transport_port
# rpc_port, which we'll match to rpc_address
# and from env: JMX_PORT which we cache in our environment during SetCassandraEnvironment for this check
$yamlRegex = "storage_port:|ssl_storage_port:|native_transport_port:|rpc_port"
$yamlRegex = "storage_port:|ssl_storage_port:|native_transport_port:"
$yaml = Get-Content "$env:CASSANDRA_CONF\cassandra.yaml"
$portRegex = ":$env:JMX_PORT |"

View File

@ -104,7 +104,7 @@ elif webbrowser._tryorder[0] == 'xdg-open' and os.environ.get('XDG_DATA_DIRS', '
webbrowser._tryorder.remove('xdg-open')
webbrowser._tryorder.append('xdg-open')
# use bundled libs for python-cql and thrift, if available. if there
# use bundled lib for python-cql if available. if there
# is a ../lib dir, use bundled libs there preferentially.
ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')]
myplatform = platform.system()
@ -1691,8 +1691,8 @@ class Shell(cmd.Cmd):
SHOW VERSION
Shows the version and build of the connected Cassandra instance, as
well as the versions of the CQL spec and the Thrift protocol that
the connected Cassandra instance understands.
well as the version of the CQL spec that the connected Cassandra
instance understands.
SHOW HOST

165
build.xml
View File

@ -44,12 +44,9 @@
<property name="build.test.dir" value="${build.dir}/test"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.classes.main" value="${build.classes}/main" />
<property name="build.classes.thrift" value="${build.classes}/thrift" />
<property name="javadoc.dir" value="${build.dir}/javadoc"/>
<property name="javadoc.jars.dir" value="${build.dir}/javadocs"/>
<property name="interface.dir" value="${basedir}/interface"/>
<property name="interface.thrift.dir" value="${interface.dir}/thrift"/>
<property name="interface.thrift.gen-java" value="${interface.thrift.dir}/gen-java"/>
<property name="test.dir" value="${basedir}/test"/>
<property name="test.resources" value="${test.dir}/resources"/>
<property name="test.lib" value="${build.dir}/test/lib"/>
@ -154,7 +151,6 @@
<path id="maven-ant-tasks.classpath" path="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
<path id="cassandra.classpath">
<pathelement location="${build.classes.main}" />
<pathelement location="${build.classes.thrift}" />
<fileset dir="${build.lib}">
<include name="**/*.jar" />
<exclude name="**/*-sources.jar"/>
@ -186,7 +182,6 @@
<fail unless="is.source.artifact"
message="Not a source artifact, stopping here." />
<mkdir dir="${build.classes.main}"/>
<mkdir dir="${build.classes.thrift}"/>
<mkdir dir="${test.lib}"/>
<mkdir dir="${test.classes}"/>
<mkdir dir="${stress.test.classes}"/>
@ -387,14 +382,7 @@
<dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
<dependency groupId="com.github.jbellis" artifactId="jamm" version="0.3.0"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.7">
<exclusion groupId="org.slf4j" artifactId="slf4j-log4j12"/>
<exclusion groupId="junit" artifactId="junit"/>
</dependency>
<dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
<dependency groupId="org.apache.thrift" artifactId="libthrift" version="0.9.2">
<exclusion groupId="commons-logging" artifactId="commons-logging"/>
</dependency>
<dependency groupId="junit" artifactId="junit" version="4.6" />
<dependency groupId="org.apache.rat" artifactId="apache-rat" version="0.10">
<exclusion groupId="commons-lang" artifactId="commons-lang"/>
@ -423,7 +411,6 @@
<dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess" version="1.13"/>
<dependency groupId="org.apache.cassandra" artifactId="cassandra-all" version="${version}" />
<dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift" version="${version}" />
<dependency groupId="io.dropwizard.metrics" artifactId="metrics-core" version="3.1.0" />
<dependency groupId="io.dropwizard.metrics" artifactId="metrics-jvm" version="3.1.0" />
<dependency groupId="com.addthis.metrics" artifactId="reporter-config3" version="3.0.3" />
@ -585,15 +572,11 @@
<dependency groupId="io.dropwizard.metrics" artifactId="metrics-core"/>
<dependency groupId="io.dropwizard.metrics" artifactId="metrics-jvm"/>
<dependency groupId="com.addthis.metrics" artifactId="reporter-config3"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server"/>
<dependency groupId="com.clearspring.analytics" artifactId="stream"/>
<dependency groupId="ch.qos.logback" artifactId="logback-core"/>
<dependency groupId="ch.qos.logback" artifactId="logback-classic"/>
<dependency groupId="org.apache.thrift" artifactId="libthrift"/>
<dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift"/>
<!-- don't need hadoop classes to run, but if you use the hadoop stuff -->
<dependency groupId="org.apache.hadoop" artifactId="hadoop-core" optional="true"/>
<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster" optional="true"/>
@ -620,25 +603,6 @@
<dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" />
<dependency groupId="org.jctools" artifactId="jctools-core"/>
</artifact:pom>
<artifact:pom id="thrift-pom"
artifactId="cassandra-thrift"
url="http://cassandra.apache.org"
name="Apache Cassandra">
<parent groupId="org.apache.cassandra"
artifactId="cassandra-parent"
version="${version}"/>
<scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
<dependency groupId="org.apache.commons" artifactId="commons-lang3"/>
<dependency groupId="org.slf4j" artifactId="slf4j-api"/>
<dependency groupId="org.slf4j" artifactId="log4j-over-slf4j"/>
<dependency groupId="org.slf4j" artifactId="jcl-over-slf4j"/>
<dependency groupId="org.apache.thrift" artifactId="libthrift"/>
<dependency groupId="com.carrotsearch" artifactId="hppc" version="0.5.4" />
<dependency groupId="de.jflex" artifactId="jflex" version="1.6.0" />
<dependency groupId="com.github.rholder" artifactId="snowball-stemmer" version="1.3.0.581.1" />
<dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" />
</artifact:pom>
<artifact:pom id="dist-pom"
artifactId="apache-cassandra"
packaging="pom"
@ -720,54 +684,6 @@
<echo message="${base.version}" />
</target>
<!--
Generate thrift code. We have targets to build java because
Cassandra depends on it, and python because that is what the system
tests run.
-->
<target name="check-gen-thrift-java">
<uptodate property="thriftUpToDate" srcfile="${interface.dir}/cassandra.thrift"
targetfile="${interface.thrift.gen-java}/org/apache/cassandra/thrift/Cassandra.java" />
</target>
<target name="gen-thrift-java" unless="thriftUpToDate" depends="check-gen-thrift-java"
description="Generate Thrift Java artifacts">
<echo>Generating Thrift Java code from ${basedir}/interface/cassandra.thrift...</echo>
<exec executable="thrift" dir="${basedir}/interface" failonerror="true">
<arg line="--gen java:hashcode" />
<arg line="-o ${interface.thrift.dir}" />
<arg line="cassandra.thrift" />
</exec>
<antcall target="write-java-license-headers" />
</target>
<target name="_write-java-license-headers" depends="rat-init">
<java classname="org.apache.rat.Report" fork="true"
output="${build.dir}/rat-report.log">
<classpath refid="rat.classpath" />
<arg value="-a" />
<arg value="--force" />
<arg value="interface/thrift" />
</java>
</target>
<target name="write-java-license-headers" unless="without.rat" description="Add missing java license headers">
<antcall target="_write-java-license-headers" />
</target>
<target name="gen-thrift-py" description="Generate Thrift Python artifacts">
<echo>Generating Thrift Python code from ${basedir}/interface/cassandra.thrift...</echo>
<exec executable="thrift" dir="${basedir}/interface" failonerror="true">
<arg line="--gen py" />
<arg line="-o ${interface.thrift.dir}" />
<arg line="cassandra.thrift" />
</exec>
<exec executable="thrift" dir="${basedir}/interface" failonerror="true">
<arg line="--gen py:twisted" />
<arg line="-o ${interface.thrift.dir}" />
<arg line="cassandra.thrift" />
</exec>
</target>
<!-- create properties file with C version -->
<target name="createVersionPropFile">
<taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/>
@ -801,13 +717,6 @@
name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<!-- Order matters! -->
<javac fork="true"
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
destdir="${build.classes.thrift}" includeantruntime="false" source="${source.version}" target="${target.version}"
memorymaximumsize="512M">
<src path="${interface.thrift.dir}/gen-java"/>
<classpath refid="cassandra.classpath"/>
</javac>
<javac fork="true"
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}"
@ -833,7 +742,6 @@
<property name="stress.manifest" value="${stress.build.classes}/MANIFEST.MF" />
<path id="cassandra.classes">
<pathelement location="${basedir}/build/classes/main" />
<pathelement location="${basedir}/build/classes/thrift" />
</path>
<target name="stress-build-test" depends="stress-build" description="Compile stress tests">
@ -876,8 +784,6 @@
<target name="_write-poms" depends="maven-declare-dependencies">
<artifact:writepom pomRefId="parent-pom" file="${build.dir}/${final.name}-parent.pom"/>
<artifact:writepom pomRefId="thrift-pom"
file="${build.dir}/${ant.project.name}-thrift-${version}.pom"/>
<artifact:writepom pomRefId="all-pom" file="${build.dir}/${final.name}.pom"/>
</target>
@ -892,35 +798,14 @@
depends="build, build-test, stress-build, write-poms"
description="Assemble Cassandra JAR files">
<mkdir dir="${build.classes.main}/META-INF" />
<mkdir dir="${build.classes.thrift}/META-INF" />
<copy file="LICENSE.txt"
tofile="${build.classes.main}/META-INF/LICENSE.txt"/>
<copy file="LICENSE.txt"
tofile="${build.classes.thrift}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.classes.main}/META-INF/NOTICE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.classes.thrift}/META-INF/NOTICE.txt"/>
<!-- Thrift Jar -->
<jar jarfile="${build.dir}/${ant.project.name}-thrift-${version}.jar"
basedir="${build.classes.thrift}">
<fileset dir="${build.classes.main}">
<include name="org/apache/cassandra/thrift/ITransportFactory*.class" />
<include name="org/apache/cassandra/thrift/TFramedTransportFactory*.class" />
</fileset>
<manifest>
<attribute name="Implementation-Title" value="Cassandra"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache"/>
</manifest>
</jar>
<!-- Main Jar -->
<jar jarfile="${build.dir}/${final.name}.jar">
<fileset dir="${build.classes.main}">
<exclude name="org/apache/cassandra/thrift/ITransportFactory*.class" />
<exclude name="org/apache/cassandra/thrift/TFramedTransportFactory*.class" />
</fileset>
<manifest>
<!-- <section name="org/apache/cassandra/infrastructure"> -->
@ -929,8 +814,6 @@
<attribute name="Implementation-Vendor" value="Apache"/>
<attribute name="Premain-Class"
value="org.apache.cassandra.infrastructure.continuations.CAgent"/>
<attribute name="Class-Path"
value="${ant.project.name}-thrift-${version}.jar" />
<!-- </section> -->
</manifest>
</jar>
@ -952,16 +835,6 @@
-->
<target name="javadoc-jar" description="Assemble Cassandra JavaDoc JAR file">
<mkdir dir="${javadoc.jars.dir}"/>
<create-javadoc destdir="${javadoc.jars.dir}/thrift">
<filesets>
<fileset dir="${interface.thrift.dir}/gen-java" defaultexcludes="yes">
<include name="org/apache/**/*.java"/>
</fileset>
</filesets>
</create-javadoc>
<jar jarfile="${build.dir}/${ant.project.name}-thrift-${version}-javadoc.jar"
basedir="${javadoc.jars.dir}/thrift"/>
<create-javadoc destdir="${javadoc.jars.dir}/main">
<filesets>
<fileset dir="${build.src.java}" defaultexcludes="yes">
@ -984,11 +857,6 @@
The sources-jar target makes cassandra-sources.jar output required for publishing to Maven central repository.
-->
<target name="sources-jar" depends="init" description="Assemble Cassandra Sources JAR file">
<jar jarfile="${build.dir}/${ant.project.name}-thrift-${version}-sources.jar">
<fileset dir="${interface.thrift.dir}/gen-java" defaultexcludes="yes">
<include name="org/apache/**/*.java"/>
</fileset>
</jar>
<jar jarfile="${build.dir}/${final.name}-sources.jar">
<fileset dir="${build.src.java}" defaultexcludes="yes">
<include name="org/apache/**/*.java"/>
@ -1011,7 +879,6 @@
<fileset dir="${build.lib}"/>
<fileset dir="${build.dir}">
<include name="${final.name}.jar" />
<include name="${ant.project.name}-thrift-${version}.jar" />
</fileset>
</copy>
<copy todir="${dist.dir}/javadoc">
@ -1034,11 +901,6 @@
<copy todir="${dist.dir}/conf">
<fileset dir="conf"/>
</copy>
<copy todir="${dist.dir}/interface">
<fileset dir="interface">
<include name="**/*.thrift" />
</fileset>
</copy>
<copy todir="${dist.dir}/pylib">
<fileset dir="pylib">
<include name="**" />
@ -1594,14 +1456,9 @@
<target name="javadoc" depends="init" description="Create javadoc" unless="no-javadoc">
<create-javadoc destdir="${javadoc.dir}">
<filesets>
<fileset dir="${build.src.java}" defaultexcludes="yes">
<include name="org/apache/**/*.java"/>
</fileset>
<fileset dir="${interface.thrift.gen-java}" defaultexcludes="yes">
<include name="org/apache/**/*.java"/>
</fileset>
</filesets>
</create-javadoc>
</target>
@ -1779,7 +1636,6 @@
<classpathentry kind="src" path="src/resources"/>
<classpathentry kind="src" path="src/gen-java"/>
<classpathentry kind="src" path="conf" including="hotspot_compiler"/>
<classpathentry kind="src" path="interface/thrift/gen-java"/>
<classpathentry kind="src" output="build/test/classes" path="test/unit"/>
<classpathentry kind="src" output="build/test/classes" path="test/long"/>
<classpathentry kind="src" output="build/test/classes" path="test/resources" />
@ -1787,7 +1643,6 @@
<classpathentry kind="src" output="build/test/stress-classes" path="tools/stress/test/unit" />
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes/eclipse"/>
<classpathentry kind="lib" path="build/classes/thrift" sourcepath="interface/thrift/gen-java/"/>
<classpathentry kind="lib" path="test/conf"/>
<classpathentry kind="lib" path="${java.home}/../lib/tools.jar"/>
]]>
@ -1900,16 +1755,6 @@
packaging="tar.gz"
classifier="src"/>
<!-- the cassandra-thrift jar -->
<install pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
file="${build.dir}/${ant.project.name}-thrift-${version}.jar"/>
<install pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
file="${build.dir}/${ant.project.name}-thrift-${version}-sources.jar"
classifier="sources"/>
<install pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
file="${build.dir}/${ant.project.name}-thrift-${version}-javadoc.jar"
classifier="javadoc"/>
<!-- the cassandra-all jar -->
<install pomFile="${build.dir}/${final.name}.pom"
file="${build.dir}/${final.name}.jar"/>
@ -1944,16 +1789,6 @@
packaging="tar.gz"
classifier="src"/>
<!-- the cassandra-thrift jar -->
<deploy pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
file="${build.dir}/${ant.project.name}-thrift-${version}.jar"/>
<deploy pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
file="${build.dir}/${ant.project.name}-thrift-${version}-sources.jar"
classifier="sources"/>
<deploy pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
file="${build.dir}/${ant.project.name}-thrift-${version}-javadoc.jar"
classifier="javadoc"/>
<!-- the cassandra-all jar -->
<deploy pomFile="${build.dir}/${final.name}.pom"
file="${build.dir}/${final.name}.jar"/>

View File

@ -47,7 +47,7 @@ Function BuildClassPath
}
# Add build/classes/main so it works in development
$cp = $cp + ";" + """$env:CASSANDRA_HOME\build\classes\main"";""$env:CASSANDRA_HOME\build\classes\thrift"""
$cp = $cp + ";" + """$env:CASSANDRA_HOME\build\classes\main"""
$env:CLASSPATH=$cp
}

View File

@ -232,10 +232,10 @@ disk_failure_policy: stop
# Policy for commit disk failures:
#
# die
# shut down gossip and Thrift and kill the JVM, so the node can be replaced.
# shut down the node and kill the JVM, so the node can be replaced.
#
# stop
# shut down gossip and Thrift, leaving the node effectively dead, but
# shut down the node, leaving the node effectively dead, but
# can still be inspected via JMX.
#
# stop_commit
@ -265,15 +265,6 @@ commit_failure_policy: stop
# Default value ("auto") is 1/256th of the heap or 10MB, whichever is greater
prepared_statements_cache_size_mb:
# Maximum size of the Thrift prepared statement cache
#
# If you do not use Thrift at all, it is safe to leave this value at "auto".
#
# See description of 'prepared_statements_cache_size_mb' above for more information.
#
# Default value ("auto") is 1/256th of the heap or 10MB, whichever is greater
thrift_prepared_statements_cache_size_mb:
# Maximum size of the key cache in memory.
#
# Each key cache hit saves 1 seek and each row cache hit saves 2 seeks at the
@ -624,8 +615,7 @@ listen_address: localhost
# internode_authenticator: org.apache.cassandra.auth.AllowAllInternodeAuthenticator
# Whether to start the native transport server.
# Please note that the address on which the native transport is bound is the
# same as the rpc_address. The port however is different and specified below.
# The address on which the native transport is bound is defined by rpc_address.
start_native_transport: true
# port for the CQL native transport to listen for clients on
# For security reasons, you should not expose this port to the internet. Firewall it if needed.
@ -638,10 +628,8 @@ native_transport_port: 9042
# from native_transport_port will use encryption for native_transport_port_ssl while
# keeping native_transport_port unencrypted.
# native_transport_port_ssl: 9142
# The maximum threads for handling requests when the native transport is used.
# This is similar to rpc_max_threads though the default differs slightly (and
# there is no native_transport_min_threads, idle threads will always be stopped
# after 30 seconds).
# The maximum threads for handling requests (note that idle threads are stopped
# after 30 seconds so there is not corresponding minimum setting).
# native_transport_max_threads: 128
#
# The maximum size of allowed frame. Frame (requests) larger than this will
@ -657,11 +645,7 @@ native_transport_port: 9042
# The default is -1, which means unlimited.
# native_transport_max_concurrent_connections_per_ip: -1
# Whether to start the thrift rpc server.
start_rpc: false
# The address or interface to bind the Thrift RPC service and native transport
# server to.
# The address or interface to bind the native transport server to.
#
# Set rpc_address OR rpc_interface, not both.
#
@ -684,9 +668,6 @@ rpc_address: localhost
# ipv4. If there is only one address it will be selected regardless of ipv4/ipv6.
# rpc_interface_prefer_ipv6: false
# port for Thrift to listen for clients on
rpc_port: 9160
# RPC address to broadcast to drivers and other Cassandra nodes. This cannot
# be set to 0.0.0.0. If left blank, this will be set to the value of
# rpc_address. If rpc_address is set to 0.0.0.0, broadcast_rpc_address must
@ -696,45 +677,6 @@ rpc_port: 9160
# enable or disable keepalive on rpc/native connections
rpc_keepalive: true
# Cassandra provides two out-of-the-box options for the RPC Server:
#
# sync
# One thread per thrift connection. For a very large number of clients, memory
# will be your limiting factor. On a 64 bit JVM, 180KB is the minimum stack size
# per thread, and that will correspond to your use of virtual memory (but physical memory
# may be limited depending on use of stack space).
#
# hsha
# Stands for "half synchronous, half asynchronous." All thrift clients are handled
# asynchronously using a small number of threads that does not vary with the amount
# of thrift clients (and thus scales well to many clients). The rpc requests are still
# synchronous (one thread per active request). If hsha is selected then it is essential
# that rpc_max_threads is changed from the default value of unlimited.
#
# The default is sync because on Windows hsha is about 30% slower. On Linux,
# sync/hsha performance is about the same, with hsha of course using less memory.
#
# Alternatively, can provide your own RPC server by providing the fully-qualified class name
# of an o.a.c.t.TServerFactory that can create an instance of it.
rpc_server_type: sync
# Uncomment rpc_min|max_thread to set request pool size limits.
#
# Regardless of your choice of RPC server (see above), the number of maximum requests in the
# RPC thread pool dictates how many concurrent requests are possible (but if you are using the sync
# RPC server, it also dictates the number of clients that can be connected at all).
#
# The default is unlimited and thus provides no protection against clients overwhelming the server. You are
# encouraged to set a maximum that makes sense for you in production, but do keep in mind that
# rpc_max_threads represents the maximum number of client requests this server may execute concurrently.
#
# rpc_min_threads: 16
# rpc_max_threads: 2048
# uncomment to set socket buffer sizes on rpc connections
# rpc_send_buff_size_in_bytes:
# rpc_recv_buff_size_in_bytes:
# Uncomment to set socket buffer size for internode communication
# Note that when setting this, the buffer size is limited by net.core.wmem_max
# and when not setting it it is defined by net.ipv4.tcp_wmem
@ -751,9 +693,6 @@ rpc_server_type: sync
# and when not setting it it is defined by net.ipv4.tcp_wmem
# internode_recv_buff_size_in_bytes:
# Frame size for thrift (maximum message length).
thrift_framed_transport_size_in_mb: 15
# Set to true to have Cassandra create a hard link to each sstable
# flushed or streamed locally in a backups/ subdirectory of the
# keyspace data. Removing these links is the operator's
@ -962,52 +901,6 @@ dynamic_snitch_reset_interval_in_ms: 600000
# until the pinned host was 20% worse than the fastest.
dynamic_snitch_badness_threshold: 0.1
# request_scheduler -- Set this to a class that implements
# RequestScheduler, which will schedule incoming client requests
# according to the specific policy. This is useful for multi-tenancy
# with a single Cassandra cluster.
# NOTE: This is specifically for requests from the client and does
# not affect inter node communication.
# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place
# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of
# client requests to a node with a separate queue for each
# request_scheduler_id. The scheduler is further customized by
# request_scheduler_options as described below.
request_scheduler: org.apache.cassandra.scheduler.NoScheduler
# Scheduler Options vary based on the type of scheduler
#
# NoScheduler
# Has no options
#
# RoundRobin
# throttle_limit
# The throttle_limit is the number of in-flight
# requests per client. Requests beyond
# that limit are queued up until
# running requests can complete.
# The value of 80 here is twice the number of
# concurrent_reads + concurrent_writes.
# default_weight
# default_weight is optional and allows for
# overriding the default which is 1.
# weights
# Weights are optional and will default to 1 or the
# overridden default_weight. The weight translates into how
# many requests are handled during each turn of the
# RoundRobin, based on the scheduler id.
#
# request_scheduler_options:
# throttle_limit: 80
# default_weight: 5
# weights:
# Keyspace1: 1
# Keyspace2: 5
# request_scheduler_id -- An identifier based on which to perform
# the request scheduling. Currently the only valid option is keyspace.
# request_scheduler_id: keyspace
# Enable or disable inter-node encryption
# JVM defaults for supported SSL socket protocols and cipher suites can
# be replaced using custom encryption options. This is not recommended

View File

@ -53,18 +53,12 @@
# before joining the ring.
#-Dcassandra.ring_delay_ms=ms
# Set the port for the Thrift RPC service, which is used for client connections. (Default: 9160)
#-Dcassandra.rpc_port=port
# Set the SSL port for encrypted communication. (Default: 7001)
#-Dcassandra.ssl_storage_port=port
# Enable or disable the native transport server. See start_native_transport in cassandra.yaml.
# cassandra.start_native_transport=true|false
# Enable or disable the Thrift RPC server. (Default: true)
#-Dcassandra.start_rpc=true/false
# Set the port for inter-node communication. (Default: 7000)
#-Dcassandra.storage_port=port

View File

@ -98,5 +98,4 @@ appender reference in the root level section below.
</root>
<logger name="org.apache.cassandra" level="DEBUG"/>
<logger name="com.thinkaurelius.thrift" level="ERROR"/>
</configuration>

View File

@ -62,13 +62,11 @@ have nodetool && have cqlsh &&
disablebinary
disablegossip
disablehandoff
disablethrift
drain
enablebackup
enablebinary
enablegossip
enablehandoff
enablethrift
getcompactionthroughput
getlogginglevels
getstreamthroughput
@ -89,7 +87,6 @@ have nodetool && have cqlsh &&
setlogginglevel
status
statusbinary
statusthrift
stopdaemon
tpstats
version

View File

@ -24,7 +24,7 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch'
+commitlog_directory: /var/lib/cassandra/commitlog
# policy for data disk failures:
# stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
# stop_paranoid: shut down gossip even for single-sstable errors.
@@ -203,7 +203,7 @@
# saved caches

2
debian/rules vendored
View File

@ -45,8 +45,6 @@ install: build
# Copy in the jar and symlink to something stable
dh_install build/apache-cassandra-$(VERSION).jar \
usr/share/cassandra
dh_install build/apache-cassandra-thrift-$(VERSION).jar \
usr/share/cassandra
# Copy stress jars
dh_install build/tools/lib/stress.jar \

View File

@ -19,8 +19,7 @@ implementation.
## Using SASI
The examples below walk through creating a table and indexes on its
columns, and performing queries on some inserted data. The patchset in
this repository includes support for the Thrift and CQL3 interfaces.
columns, and performing queries on some inserted data.
The examples below assume the `demo` keyspace has been created and is
in use.

View File

@ -41,7 +41,6 @@ commented_re = re.compile(r"^# ?(.*)")
# that these can be commented out (making it useless to use a yaml parser).
COMPLEX_OPTIONS = (
'seed_provider',
'request_scheduler_options',
'data_file_directories',
'commitlog_compression',
'hints_compression',

View File

@ -396,15 +396,14 @@ Compact tables
.. warning:: Since Cassandra 3.0, compact tables have the exact same layout internally than non compact ones (for the
same schema obviously), and declaring a table compact **only** creates artificial limitations on the table definition
and usage that are necessary to ensure backward compatibility with the deprecated Thrift API. And as ``COMPACT
and usage. It only exists for historical reason and is preserved for backward compatibility And as ``COMPACT
STORAGE`` cannot, as of Cassandra |version|, be removed, it is strongly discouraged to create new table with the
``COMPACT STORAGE`` option.
A *compact* table is one defined with the ``COMPACT STORAGE`` option. This option is mainly targeted towards backward
compatibility for definitions created before CQL version 3 (see `www.datastax.com/dev/blog/thrift-to-cql3
<http://www.datastax.com/dev/blog/thrift-to-cql3>`__ for more details) and shouldn't be used for new tables. Declaring a
table with this option creates limitations for the table which are largely arbitrary but necessary for backward
compatibility with the (deprecated) Thrift API. Amongst those limitation:
A *compact* table is one defined with the ``COMPACT STORAGE`` option. This option is only maintained for backward
compatibility for definitions created before CQL version 3 and shouldn't be used for new tables. Declaring a
table with this option creates limitations for the table which are largely arbitrary (and exists for historical
reasons). Amongst those limitation:
- a compact table cannot use collections nor static columns.
- if a compact table has at least one clustering column, then it must have *exactly* one column outside of the primary

View File

@ -24,8 +24,7 @@ the languages. However, the `changes <#changes>`_ section provides the diff betw
CQL offers a model close to SQL in the sense that data is put in *tables* containing *rows* of *columns*. For
that reason, when used in this document, these terms (tables, rows and columns) have the same definition than they have
in SQL. But please note that as such, they do **not** refer to the concept of rows and columns found in the deprecated
thrift API (and earlier version 1 and 2 of CQL).
in SQL.
.. toctree::
:maxdepth: 2

View File

@ -58,7 +58,7 @@ What ports does Cassandra use?
------------------------------
By default, Cassandra uses 7000 for cluster communication (7001 if SSL is enabled), 9042 for native protocol clients,
and 7199 for JMX (and 9160 for the deprecated Thrift interface). The internode communication and native protocol ports
and 7199 for JMX. The internode communication and native protocol ports
are configurable in the :ref:`cassandra-yaml`. The JMX port is configurable in ``cassandra-env.sh`` (through JVM
options). All ports are TCP.

View File

@ -584,7 +584,6 @@ Reported name format:
Name Type Description
=========================== ============== ===========
connectedNativeClients Counter Number of clients connected to this nodes native protocol server
connectedThriftClients Counter Number of clients connected to this nodes thrift protocol server
=========================== ============== ===========

View File

@ -1,51 +0,0 @@
Introduction
============
WordCount hadoop example: Inserts a bunch of words across multiple rows,
and counts them, with RandomPartitioner. The word_count_counters example sums
the value of counter columns for a key.
The scripts in bin/ assume you are running with cwd of examples/word_count.
Running
=======
First build and start a Cassandra server with the default configuration*. Ensure that the Thrift
interface is enabled, either by setting start_rpc:true in cassandra.yaml or by running
`nodetool enablethrift` after startup.
Once Cassandra has started and the Thrift interface is available, run
contrib/word_count$ ant
contrib/word_count$ bin/word_count_setup
contrib/word_count$ bin/word_count
contrib/word_count$ bin/word_count_counters
In order to view the results in Cassandra, one can use bin/cqlsh and
perform the following operations:
$ bin/cqlsh localhost
> use cql3_wordcount;
> select * from output_words;
The output of the word count can now be configured. In the bin/word_count
file, you can specify the OUTPUT_REDUCER. The two options are 'filesystem'
and 'cassandra'. The filesystem option outputs to the /tmp/word_count*
directories. The cassandra option outputs to the 'output_words' column family
in the 'cql3_wordcount' keyspace. 'cassandra' is the default.
Read the code in src/ for more details.
The word_count_counters example sums the counter columns for a row. The output
is written to a text file in /tmp/word_count_counters.
*It is recommended to turn off vnodes when running Cassandra with hadoop.
This is done by setting "num_tokens: 1" in cassandra.yaml. If you want to
point wordcount at a real cluster, modify the seed and listenaddress
settings accordingly.
Troubleshooting
===============
word_count uses conf/logback.xml to log to wc.out.

View File

@ -1,62 +0,0 @@
#!/bin/sh
# 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.
cwd=`dirname $0`
# Cassandra class files.
if [ ! -d $cwd/../../../build/classes/main ]; then
echo "Unable to locate cassandra class files" >&2
exit 1
fi
# word_count Jar.
if [ ! -e $cwd/../build/word_count.jar ]; then
echo "Unable to locate word_count jar" >&2
exit 1
fi
CLASSPATH=$CLASSPATH:$cwd/../conf
CLASSPATH=$CLASSPATH:$cwd/../build/word_count.jar
CLASSPATH=$CLASSPATH:$cwd/../../../build/classes/main
CLASSPATH=$CLASSPATH:$cwd/../../../build/classes/thrift
for jar in $cwd/../build/lib/jars/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
for jar in $cwd/../../../lib/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
for jar in $cwd/../../../build/lib/jars/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
if [ -x $JAVA_HOME/bin/java ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
fi
if [ "x$JAVA" = "x" ]; then
echo "Java executable not found (hint: set JAVA_HOME)" >&2
exit 1
fi
OUTPUT_REDUCER=cassandra
INPUT_MAPPER=native
#echo $CLASSPATH
"$JAVA" -Xmx1G -ea -cp "$CLASSPATH" WordCount output_reducer=$OUTPUT_REDUCER input_mapper=$INPUT_MAPPER

View File

@ -1,61 +0,0 @@
#!/bin/sh
# 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.
cwd=`dirname $0`
# Cassandra class files.
if [ ! -d $cwd/../../../build/classes/main ]; then
echo "Unable to locate cassandra class files" >&2
exit 1
fi
# word_count Jar.
if [ ! -e $cwd/../build/word_count.jar ]; then
echo "Unable to locate word_count jar" >&2
exit 1
fi
CLASSPATH=$CLASSPATH:$cwd/../conf
CLASSPATH=$CLASSPATH:$cwd/../build/word_count.jar
CLASSPATH=$CLASSPATH:$cwd/../../../build/classes/main
CLASSPATH=$CLASSPATH:$cwd/../../../build/classes/thrift
for jar in $cwd/../build/lib/jars/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
for jar in $cwd/../../../lib/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
for jar in $cwd/../../../build/lib/jars/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
if [ -x $JAVA_HOME/bin/java ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
fi
if [ "x$JAVA" = "x" ]; then
echo "Java executable not found (hint: set JAVA_HOME)" >&2
exit 1
fi
INPUT_MAPPER=native
#echo $CLASSPATH
"$JAVA" -Xmx1G -ea -cp "$CLASSPATH" WordCountCounters input_mapper=$INPUT_MAPPER

View File

@ -1,61 +0,0 @@
#!/bin/sh
# 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.
cwd=`dirname $0`
# Cassandra class files.
if [ ! -d $cwd/../../../build/classes/main ]; then
echo "Unable to locate cassandra class files" >&2
exit 1
fi
# word_count Jar.
if [ ! -e $cwd/../build/word_count.jar ]; then
echo "Unable to locate word_count jar" >&2
exit 1
fi
CLASSPATH=$CLASSPATH:$cwd/../build/word_count.jar
CLASSPATH=$CLASSPATH:.:$cwd/../../../build/classes/main
CLASSPATH=$CLASSPATH:.:$cwd/../../../build/classes/thrift
for jar in $cwd/../build/lib/jars/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
for jar in $cwd/../../../lib/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
for jar in $cwd/../../../build/lib/jars/*.jar; do
CLASSPATH=$CLASSPATH:$jar
done
if [ -x $JAVA_HOME/bin/java ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
fi
if [ "x$JAVA" = "x" ]; then
echo "Java executable not found (hint: set JAVA_HOME)" >&2
exit 1
fi
HOST=localhost
PORT=9160
FRAMED=true
"$JAVA" -Xmx1G -ea -Dcassandra.host=$HOST -Dcassandra.port=$PORT -Dcassandra.framed=$FRAMED -cp "$CLASSPATH" WordCountSetup

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project default="jar" name="word_count" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="cassandra.dir" value="../.." />
<property name="cassandra.dir.lib" value="${cassandra.dir}/lib" />
<property name="cassandra.classes" value="${cassandra.dir}/build/classes" />
<property name="build.src" value="${basedir}/src" />
<property name="build.dir" value="${basedir}/build" />
<property name="ivy.lib.dir" value="${build.dir}/lib" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="final.name" value="word_count" />
<property name="ivy.version" value="2.1.0" />
<property name="ivy.url"
value="http://repo2.maven.org/maven2/org/apache/ivy/ivy" />
<condition property="ivy.jar.exists">
<available file="${build.dir}/ivy-${ivy.version}.jar" />
</condition>
<path id="autoivy.classpath">
<fileset dir="${ivy.lib.dir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${build.dir}/ivy-${ivy.version}.jar"/>
</path>
<path id="wordcount.build.classpath">
<fileset dir="${ivy.lib.dir}">
<include name="**/*.jar" />
</fileset>
<!-- cassandra dependencies -->
<fileset dir="${cassandra.dir.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${cassandra.dir}/build/lib/jars">
<include name="**/*.jar" />
</fileset>
<pathelement location="${cassandra.classes}/main" />
<pathelement location="${cassandra.classes}/thrift" />
</path>
<target name="init">
<mkdir dir="${build.classes}" />
</target>
<target depends="init,ivy-retrieve-build" name="build">
<javac destdir="${build.classes}">
<src path="${build.src}" />
<classpath refid="wordcount.build.classpath" />
</javac>
</target>
<target name="jar" depends="build">
<mkdir dir="${build.classes}/META-INF" />
<jar jarfile="${build.dir}/${final.name}.jar">
<fileset dir="${build.classes}" />
<fileset dir="${cassandra.classes}/main" />
<fileset dir="${cassandra.classes}/thrift" />
<fileset dir="${cassandra.dir}">
<include name="lib/**/*.jar" />
</fileset>
<zipfileset dir="${cassandra.dir}/build/lib/jars/" prefix="lib">
<include name="**/*.jar" />
</zipfileset>
<fileset file="${basedir}/cassandra.yaml" />
</jar>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<!--
Ivy Specific targets
to fetch Ivy and this project's dependencies
-->
<target name="ivy-download" unless="ivy.jar.exists">
<echo>Downloading Ivy...</echo>
<mkdir dir="${build.dir}" />
<get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar"
dest="${build.dir}/ivy-${ivy.version}.jar" usetimestamp="true" />
</target>
<target name="ivy-init" depends="ivy-download" unless="ivy.initialized">
<mkdir dir="${ivy.lib.dir}"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="autoivy.classpath"/>
<property name="ivy.initialized" value="true"/>
</target>
<target name="ivy-retrieve-build" depends="ivy-init">
<ivy:retrieve type="jar,source" sync="true"
pattern="${ivy.lib.dir}/[type]s/[artifact]-[revision].[ext]" />
</target>
</project>

View File

@ -1,42 +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.
-->
<configuration scan="true">
<jmxConfigurator />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>wc.out</file>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level %date{HH:mm:ss,SSS} %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -1,24 +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.
-->
<ivy-module version="2.0">
<info organisation="apache-cassandra" module="word-count"/>
<dependencies>
<dependency org="org.apache.hadoop" name="hadoop-core" rev="1.0.3"/>
</dependencies>
</ivy-module>

View File

@ -1,259 +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.
*/
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.Map.Entry;
import org.apache.cassandra.hadoop.cql3.CqlConfigHelper;
import org.apache.cassandra.hadoop.cql3.CqlOutputFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.hadoop.cql3.CqlInputFormat;
import org.apache.cassandra.hadoop.ConfigHelper;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import com.datastax.driver.core.Row;
/**
* This counts the occurrences of words in ColumnFamily
* cql3_wordcount ( id uuid,
* line text,
* PRIMARY KEY (id))
*
* For each word, we output the total number of occurrences across all body texts.
*
* When outputting to Cassandra, we write the word counts to column family
* output_words ( word text,
* count_num text,
* PRIMARY KEY (word))
* as a {word, count} to columns: word, count_num with a row key of "word sum"
*/
public class WordCount extends Configured implements Tool
{
private static final Logger logger = LoggerFactory.getLogger(WordCount.class);
static final String INPUT_MAPPER_VAR = "input_mapper";
static final String KEYSPACE = "cql3_wordcount";
static final String COLUMN_FAMILY = "inputs";
static final String OUTPUT_REDUCER_VAR = "output_reducer";
static final String OUTPUT_COLUMN_FAMILY = "output_words";
private static final String OUTPUT_PATH_PREFIX = "/tmp/word_count";
private static final String PRIMARY_KEY = "row_key";
public static void main(String[] args) throws Exception
{
// Let ToolRunner handle generic command-line options
ToolRunner.run(new Configuration(), new WordCount(), args);
System.exit(0);
}
public static class TokenizerMapper extends Mapper<Map<String, ByteBuffer>, Map<String, ByteBuffer>, Text, IntWritable>
{
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
private ByteBuffer sourceColumn;
protected void setup(org.apache.hadoop.mapreduce.Mapper.Context context)
throws IOException, InterruptedException
{
}
public void map(Map<String, ByteBuffer> keys, Map<String, ByteBuffer> columns, Context context) throws IOException, InterruptedException
{
for (Entry<String, ByteBuffer> column : columns.entrySet())
{
if (!"line".equalsIgnoreCase(column.getKey()))
continue;
String value = ByteBufferUtil.string(column.getValue());
StringTokenizer itr = new StringTokenizer(value);
while (itr.hasMoreTokens())
{
word.set(itr.nextToken());
context.write(word, one);
}
}
}
}
public static class NativeTokenizerMapper extends Mapper<Long, Row, Text, IntWritable>
{
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
private ByteBuffer sourceColumn;
protected void setup(org.apache.hadoop.mapreduce.Mapper.Context context)
throws IOException, InterruptedException
{
}
public void map(Long key, Row row, Context context) throws IOException, InterruptedException
{
String value = row.getString("line");
logger.debug("read {}:{}={} from {}", key, "line", value, context.getInputSplit());
StringTokenizer itr = new StringTokenizer(value);
while (itr.hasMoreTokens())
{
word.set(itr.nextToken());
context.write(word, one);
}
}
}
public static class ReducerToFilesystem extends Reducer<Text, IntWritable, Text, IntWritable>
{
public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException
{
int sum = 0;
for (IntWritable val : values)
sum += val.get();
context.write(key, new IntWritable(sum));
}
}
public static class ReducerToCassandra extends Reducer<Text, IntWritable, Map<String, ByteBuffer>, List<ByteBuffer>>
{
private Map<String, ByteBuffer> keys;
private ByteBuffer key;
protected void setup(org.apache.hadoop.mapreduce.Reducer.Context context)
throws IOException, InterruptedException
{
keys = new LinkedHashMap<String, ByteBuffer>();
}
public void reduce(Text word, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException
{
int sum = 0;
for (IntWritable val : values)
sum += val.get();
keys.put("word", ByteBufferUtil.bytes(word.toString()));
context.write(keys, getBindVariables(word, sum));
}
private List<ByteBuffer> getBindVariables(Text word, int sum)
{
List<ByteBuffer> variables = new ArrayList<ByteBuffer>();
variables.add(ByteBufferUtil.bytes(String.valueOf(sum)));
return variables;
}
}
public int run(String[] args) throws Exception
{
String outputReducerType = "filesystem";
String inputMapperType = "native";
String outputReducer = null;
String inputMapper = null;
if (args != null)
{
if(args[0].startsWith(OUTPUT_REDUCER_VAR))
outputReducer = args[0];
if(args[0].startsWith(INPUT_MAPPER_VAR))
inputMapper = args[0];
if (args.length == 2)
{
if(args[1].startsWith(OUTPUT_REDUCER_VAR))
outputReducer = args[1];
if(args[1].startsWith(INPUT_MAPPER_VAR))
inputMapper = args[1];
}
}
if (outputReducer != null)
{
String[] s = outputReducer.split("=");
if (s != null && s.length == 2)
outputReducerType = s[1];
}
logger.info("output reducer type: " + outputReducerType);
if (inputMapper != null)
{
String[] s = inputMapper.split("=");
if (s != null && s.length == 2)
inputMapperType = s[1];
}
Job job = new Job(getConf(), "wordcount");
job.setJarByClass(WordCount.class);
if (outputReducerType.equalsIgnoreCase("filesystem"))
{
job.setCombinerClass(ReducerToFilesystem.class);
job.setReducerClass(ReducerToFilesystem.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileOutputFormat.setOutputPath(job, new Path(OUTPUT_PATH_PREFIX));
}
else
{
job.setReducerClass(ReducerToCassandra.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(IntWritable.class);
job.setOutputKeyClass(Map.class);
job.setOutputValueClass(List.class);
job.setOutputFormatClass(CqlOutputFormat.class);
ConfigHelper.setOutputColumnFamily(job.getConfiguration(), KEYSPACE, OUTPUT_COLUMN_FAMILY);
job.getConfiguration().set(PRIMARY_KEY, "word,sum");
String query = "UPDATE " + KEYSPACE + "." + OUTPUT_COLUMN_FAMILY +
" SET count_num = ? ";
CqlConfigHelper.setOutputCql(job.getConfiguration(), query);
ConfigHelper.setOutputInitialAddress(job.getConfiguration(), "localhost");
ConfigHelper.setOutputPartitioner(job.getConfiguration(), "Murmur3Partitioner");
}
if (inputMapperType.equalsIgnoreCase("native"))
{
job.setMapperClass(NativeTokenizerMapper.class);
job.setInputFormatClass(CqlInputFormat.class);
CqlConfigHelper.setInputCql(job.getConfiguration(), "select * from " + COLUMN_FAMILY + " where token(id) > ? and token(id) <= ? allow filtering");
}
else
{
job.setMapperClass(TokenizerMapper.class);
job.setInputFormatClass(CqlInputFormat.class);
ConfigHelper.setInputRpcPort(job.getConfiguration(), "9160");
}
ConfigHelper.setInputInitialAddress(job.getConfiguration(), "localhost");
ConfigHelper.setInputColumnFamily(job.getConfiguration(), KEYSPACE, COLUMN_FAMILY);
ConfigHelper.setInputPartitioner(job.getConfiguration(), "Murmur3Partitioner");
CqlConfigHelper.setInputCQLPageRowSize(job.getConfiguration(), "3");
job.waitForCompletion(true);
return 0;
}
}

View File

@ -1,168 +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.
*/
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.hadoop.cql3.CqlConfigHelper;
import org.apache.cassandra.hadoop.cql3.CqlInputFormat;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import com.datastax.driver.core.Row;
import org.apache.cassandra.hadoop.ConfigHelper;
import org.apache.cassandra.utils.ByteBufferUtil;
/**
* This sums the word count stored in the input_words_count ColumnFamily for the key "sum".
*
* Output is written to a text file.
*/
public class WordCountCounters extends Configured implements Tool
{
private static final Logger logger = LoggerFactory.getLogger(WordCountCounters.class);
static final String INPUT_MAPPER_VAR = "input_mapper";
static final String COUNTER_COLUMN_FAMILY = "input_words_count";
private static final String OUTPUT_PATH_PREFIX = "/tmp/word_count_counters";
public static void main(String[] args) throws Exception
{
// Let ToolRunner handle generic command-line options
ToolRunner.run(new Configuration(), new WordCountCounters(), args);
System.exit(0);
}
public static class SumNativeMapper extends Mapper<Long, Row, Text, LongWritable>
{
long sum = -1;
public void map(Long key, Row row, Context context) throws IOException, InterruptedException
{
if (sum < 0)
sum = 0;
logger.debug("read " + key + ":count_num from " + context.getInputSplit());
sum += Long.valueOf(row.getString("count_num"));
}
protected void cleanup(Context context) throws IOException, InterruptedException {
if (sum > 0)
context.write(new Text("total_count"), new LongWritable(sum));
}
}
public static class SumMapper extends Mapper<Map<String, ByteBuffer>, Map<String, ByteBuffer>, Text, LongWritable>
{
long sum = -1;
public void map(Map<String, ByteBuffer> key, Map<String, ByteBuffer> columns, Context context) throws IOException, InterruptedException
{
if (sum < 0)
sum = 0;
logger.debug("read " + toString(key) + ":count_num from " + context.getInputSplit());
sum += Long.valueOf(ByteBufferUtil.string(columns.get("count_num")));
}
protected void cleanup(Context context) throws IOException, InterruptedException {
if (sum > 0)
context.write(new Text("total_count"), new LongWritable(sum));
}
private String toString(Map<String, ByteBuffer> keys)
{
String result = "";
try
{
for (ByteBuffer key : keys.values())
result = result + ByteBufferUtil.string(key) + ":";
}
catch (CharacterCodingException e)
{
logger.error("Failed to print keys", e);
}
return result;
}
}
public static class ReducerToFilesystem extends Reducer<Text, LongWritable, Text, LongWritable>
{
long sum = 0;
public void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException
{
for (LongWritable val : values)
sum += val.get();
context.write(key, new LongWritable(sum));
}
}
public int run(String[] args) throws Exception
{
String inputMapperType = "native";
if (args != null && args[0].startsWith(INPUT_MAPPER_VAR))
{
String[] arg0 = args[0].split("=");
if (arg0 != null && arg0.length == 2)
inputMapperType = arg0[1];
}
Job job = new Job(getConf(), "wordcountcounters");
job.setCombinerClass(ReducerToFilesystem.class);
job.setReducerClass(ReducerToFilesystem.class);
job.setJarByClass(WordCountCounters.class);
ConfigHelper.setInputInitialAddress(job.getConfiguration(), "localhost");
ConfigHelper.setInputPartitioner(job.getConfiguration(), "Murmur3Partitioner");
ConfigHelper.setInputColumnFamily(job.getConfiguration(), WordCount.KEYSPACE, WordCount.OUTPUT_COLUMN_FAMILY);
CqlConfigHelper.setInputCQLPageRowSize(job.getConfiguration(), "3");
if ("native".equals(inputMapperType))
{
job.setMapperClass(SumNativeMapper.class);
job.setInputFormatClass(CqlInputFormat.class);
CqlConfigHelper.setInputCql(job.getConfiguration(), "select * from " + WordCount.OUTPUT_COLUMN_FAMILY + " where token(word) > ? and token(word) <= ? allow filtering");
}
else
{
job.setMapperClass(SumMapper.class);
job.setInputFormatClass(CqlInputFormat.class);
ConfigHelper.setInputRpcPort(job.getConfiguration(), "9160");
}
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(LongWritable.class);
FileOutputFormat.setOutputPath(job, new Path(OUTPUT_PATH_PREFIX));
job.waitForCompletion(true);
return 0;
}
}

View File

@ -1,181 +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.
*/
import java.nio.ByteBuffer;
import java.util.*;
import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
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;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WordCountSetup
{
private static final Logger logger = LoggerFactory.getLogger(WordCountSetup.class);
public static final int TEST_COUNT = 6;
public static void main(String[] args) throws Exception
{
Cassandra.Iface client = createConnection();
setupKeyspace(client);
client.set_keyspace(WordCount.KEYSPACE);
setupTable(client);
insertData(client);
System.exit(0);
}
private static void setupKeyspace(Cassandra.Iface client)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException
{
KsDef ks;
try
{
ks = client.describe_keyspace(WordCount.KEYSPACE);
}
catch(NotFoundException e)
{
logger.info("set up keyspace " + WordCount.KEYSPACE);
String query = "CREATE KEYSPACE " + WordCount.KEYSPACE +
" WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1}";
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
String verifyQuery = "select count(*) from system.peers";
CqlResult result = client.execute_cql3_query(ByteBufferUtil.bytes(verifyQuery), Compression.NONE, ConsistencyLevel.ONE);
long magnitude = ByteBufferUtil.toLong(result.rows.get(0).columns.get(0).value);
try
{
Thread.sleep(1000 * magnitude);
}
catch (InterruptedException ie)
{
throw new RuntimeException(ie);
}
}
}
private static void setupTable(Cassandra.Iface client)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException
{
String query = "CREATE TABLE " + WordCount.KEYSPACE + "." + WordCount.COLUMN_FAMILY +
" ( id uuid," +
" line text, " +
" PRIMARY KEY (id) ) ";
try
{
logger.info("set up table " + WordCount.COLUMN_FAMILY);
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
}
catch (InvalidRequestException e)
{
logger.error("failed to create table " + WordCount.KEYSPACE + "." + WordCount.COLUMN_FAMILY, e);
}
query = "CREATE TABLE " + WordCount.KEYSPACE + "." + WordCount.OUTPUT_COLUMN_FAMILY +
" ( word text," +
" count_num text," +
" PRIMARY KEY (word) ) ";
try
{
logger.info("set up table " + WordCount.OUTPUT_COLUMN_FAMILY);
client.execute_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE, ConsistencyLevel.ONE);
}
catch (InvalidRequestException e)
{
logger.error("failed to create table " + WordCount.KEYSPACE + "." + WordCount.OUTPUT_COLUMN_FAMILY, e);
}
}
private static Cassandra.Iface createConnection() throws TTransportException
{
if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null)
{
logger.warn("cassandra.host or cassandra.port is not defined, using default");
}
return createConnection(System.getProperty("cassandra.host", "localhost"),
Integer.valueOf(System.getProperty("cassandra.port", "9160")));
}
private static Cassandra.Client createConnection(String host, Integer port) throws TTransportException
{
TSocket socket = new TSocket(host, port);
TTransport trans = new TFramedTransport(socket);
trans.open();
TProtocol protocol = new TBinaryProtocol(trans);
return new Cassandra.Client(protocol);
}
private static void insertData(Cassandra.Iface client)
throws InvalidRequestException,
UnavailableException,
TimedOutException,
SchemaDisagreementException,
TException
{
String query = "INSERT INTO " + WordCount.COLUMN_FAMILY +
"(id, line) " +
" values (?, ?) ";
CqlPreparedResult result = client.prepare_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE);
String [] body = bodyData();
for (int i = 0; i < 5; i++)
{
for (int j = 1; j <= 200; j++)
{
List<ByteBuffer> values = new ArrayList<ByteBuffer>();
values.add(ByteBufferUtil.bytes(UUID.randomUUID()));
values.add(ByteBufferUtil.bytes(body[i]));
client.execute_prepared_cql3_query(result.itemId, values, ConsistencyLevel.ONE);
}
}
}
private static String[] bodyData()
{ // Public domain context, source http://en.wikisource.org/wiki/If%E2%80%94
return new String[]{
"If you can keep your head when all about you",
"Are losing theirs and blaming it on you",
"If you can trust yourself when all men doubt you,",
"But make allowance for their doubting too:",
"If you can wait and not be tired by waiting,"
};
}
}

View File

@ -26,7 +26,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/gen-java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/interface/thrift/gen-java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tools/stress/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tools/stress/test/unit" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/test/unit" isTestSource="true" />

View File

@ -289,11 +289,8 @@
<filter targetName="maven-ant-tasks-retrieve-build" isVisible="false" />
<filter targetName="maven-ant-tasks-retrieve-test" isVisible="false" />
<filter targetName="maven-ant-tasks-retrieve-pig-test" isVisible="false" />
<filter targetName="check-gen-thrift-java" isVisible="false" />
<filter targetName="gen-thrift-java" isVisible="true" />
<filter targetName="_write-java-license-headers" isVisible="false" />
<filter targetName="write-java-license-headers" isVisible="true" />
<filter targetName="gen-thrift-py" isVisible="true" />
<filter targetName="createVersionPropFile" isVisible="false" />
<filter targetName="test-run" isVisible="true" />
<filter targetName="build" isVisible="true" />

View File

@ -1,945 +0,0 @@
#!/usr/local/bin/thrift --java --php --py
# 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.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# *** PLEASE REMEMBER TO EDIT THE VERSION CONSTANT WHEN MAKING CHANGES ***
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Interface definition for Cassandra Service
#
namespace java org.apache.cassandra.thrift
namespace cpp org.apache.cassandra
namespace csharp Apache.Cassandra
namespace py cassandra
namespace php cassandra
namespace perl Cassandra
# Thrift.rb has a bug where top-level modules that include modules
# with the same name are not properly referenced, so we can't do
# Cassandra::Cassandra::Client.
namespace rb CassandraThrift
# The API version (NOT the product version), composed as a dot delimited
# string with major, minor, and patch level components.
#
# - Major: Incremented for backward incompatible changes. An example would
# be changes to the number or disposition of method arguments.
# - Minor: Incremented for backward compatible changes. An example would
# be the addition of a new (optional) method.
# - Patch: Incremented for bug fixes. The patch level should be increased
# for every edit that doesn't result in a change to major/minor.
#
# See the Semantic Versioning Specification (SemVer) http://semver.org.
#
# Note that this backwards compatibility is from the perspective of the server,
# not the client. Cassandra should always be able to talk to older client
# software, but client software may not be able to talk to older Cassandra
# instances.
#
# An effort should be made not to break forward-client-compatibility either
# (e.g. one should avoid removing obsolete fields from the IDL), but no
# guarantees in this respect are made by the Cassandra project.
const string VERSION = "20.1.0"
#
# data structures
#
/** Basic unit of data within a ColumnFamily.
* @param name, the name by which this column is set and retrieved. Maximum 64KB long.
* @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small numbers of MB (since Thrift must read the full value into memory to operate on it).
* @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to be compared.
* @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted.
*/
struct Column {
1: required binary name,
2: optional binary value,
3: optional i64 timestamp,
4: optional i32 ttl,
}
/** 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).
*/
struct SuperColumn {
1: required binary name,
2: required list<Column> columns,
}
struct CounterColumn {
1: required binary name,
2: required i64 value
}
struct CounterSuperColumn {
1: required binary name,
2: required list<CounterColumn> columns
}
/**
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.
If the query was on a counter column family, you will either get a counter_column (instead of a column) or a
counter_super_column (instead of a super_column)
@param column. The Column returned by get() or get_slice().
@param super_column. The SuperColumn returned by get() or get_slice().
@param counter_column. The Counterolumn returned by get() or get_slice().
@param counter_super_column. The CounterSuperColumn returned by get() or get_slice().
*/
struct ColumnOrSuperColumn {
1: optional Column column,
2: optional SuperColumn super_column,
3: optional CounterColumn counter_column,
4: optional CounterSuperColumn counter_super_column
}
#
# Exceptions
# (note that internal server errors will raise a TApplicationException, courtesy of Thrift)
#
/** A specific column was requested that does not exist. */
exception NotFoundException {
}
/** 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.
*/
exception InvalidRequestException {
1: required string why
}
/** Not all the replicas required could be created and/or read. */
exception UnavailableException {
}
/** RPC timeout was exceeded. either a node failed mid-operation, or load was too high, or the requested op was too large. */
exception TimedOutException {
/**
* if a write operation was acknowledged by some replicas but not by enough to
* satisfy the required ConsistencyLevel, the number of successful
* replies will be given here. In case of atomic_batch_mutate method this field
* will be set to -1 if the batch was written to the batchlog and to 0 if it wasn't.
*/
1: optional i32 acknowledged_by
/**
* in case of atomic_batch_mutate method this field tells if the batch
* was written to the batchlog.
*/
2: optional bool acknowledged_by_batchlog
/**
* for the CAS method, this field tells if we timed out during the paxos
* protocol, as opposed to during the commit of our update
*/
3: optional bool paxos_in_progress
}
/** invalid authentication request (invalid keyspace, user does not exist, or credentials invalid) */
exception AuthenticationException {
1: required string why
}
/** invalid authorization request (user does not have access to keyspace) */
exception AuthorizationException {
1: required string why
}
/**
* NOTE: This up outdated exception left for backward compatibility reasons,
* no actual schema agreement validation is done starting from Cassandra 1.2
*
* schemas are not in agreement across all nodes
*/
exception SchemaDisagreementException {
}
#
# service api
#
/**
* The ConsistencyLevel is an enum that controls both read and write
* behavior based on the ReplicationFactor of the keyspace. The
* different consistency levels have different meanings, depending on
* if you're doing a write or read operation.
*
* 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.
*
* Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number
* of replicas rather than a logical concept that adjusts
* automatically with the replication factor. Of these, only ONE is
* commonly used; TWO and (even more rarely) THREE are only useful
* when you care more about guaranteeing a certain level of
* durability, than consistency.
*
* Write consistency levels make the following guarantees before reporting success to the client:
* 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
* TWO Ensure that the write has been written to at least 2 node's commit log and memory table
* THREE Ensure that the write has been written to at least 3 node's commit log and memory table
* QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes
* LOCAL_ONE Ensure that the write has been written to 1 node within the local datacenter (requires NetworkTopologyStrategy)
* LOCAL_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
* EACH_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
* ALL Ensure that the write is written to <code>&lt;ReplicationFactor&gt;</code> nodes before responding to the client.
*
* Read consistency levels make the following guarantees before returning successful results to the client:
* ANY Not supported. You probably want ONE instead.
* ONE Returns the record obtained from a single replica.
* TWO Returns the record with the most recent timestamp once two replicas have replied.
* THREE Returns the record with the most recent timestamp once three replicas have replied.
* QUORUM Returns the record with the most recent timestamp once a majority of replicas have replied.
* LOCAL_ONE Returns the record with the most recent timestamp once a single replica within the local datacenter have replied.
* LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied.
* EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied.
* ALL Returns the record with the most recent timestamp once all replicas have replied (implies no replica may be down)..
*/
enum ConsistencyLevel {
ONE = 1,
QUORUM = 2,
LOCAL_QUORUM = 3,
EACH_QUORUM = 4,
ALL = 5,
ANY = 6,
TWO = 7,
THREE = 8,
SERIAL = 9,
LOCAL_SERIAL = 10,
LOCAL_ONE = 11,
}
/**
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>
*/
struct ColumnParent {
3: required string column_family,
4: optional binary super_column,
}
/** 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.
*/
struct ColumnPath {
3: required string column_family,
4: optional binary super_column,
5: optional binary column,
}
/**
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 valid 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 columns to return. Similar to LIMIT 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.
*/
struct SliceRange {
1: required binary start,
2: required binary finish,
3: required bool reversed=0,
4: required i32 count=100,
}
/**
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.
*/
struct SlicePredicate {
1: optional list<binary> column_names,
2: optional SliceRange slice_range,
}
enum IndexOperator {
EQ,
GTE,
GT,
LTE,
LT
}
struct IndexExpression {
1: required binary column_name,
2: required IndexOperator op,
3: required binary value,
}
/**
* @deprecated use a KeyRange with row_filter in get_range_slices instead
*/
struct IndexClause {
1: required list<IndexExpression> expressions,
2: required binary start_key,
3: required i32 count=100,
}
/**
The semantics of start keys and tokens are slightly different.
Keys are start-inclusive; tokens are start-exclusive. Token
ranges may also wrap -- that is, the end token may be less
than the start one. Thus, a range from keyX to keyX is a
one-element range, but a range from tokenY to tokenY is the
full ring.
*/
struct KeyRange {
1: optional binary start_key,
2: optional binary end_key,
3: optional string start_token,
4: optional string end_token,
6: optional list<IndexExpression> row_filter,
5: required i32 count=100
}
/**
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.
*/
struct KeySlice {
1: required binary key,
2: required list<ColumnOrSuperColumn> columns,
}
struct KeyCount {
1: required binary key,
2: required i32 count
}
/**
* Note that the timestamp is only optional in case of counter deletion.
*/
struct Deletion {
1: optional i64 timestamp,
2: optional binary super_column,
3: optional SlicePredicate predicate,
}
/**
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 (possibly counter column or supercolumn)
@param deletion. A deletion of a column or supercolumn
*/
struct Mutation {
1: optional ColumnOrSuperColumn column_or_supercolumn,
2: optional Deletion deletion,
}
struct EndpointDetails {
1: string host,
2: string datacenter,
3: optional string rack
}
struct CASResult {
1: required bool success,
2: optional list<Column> current_values,
}
/**
A TokenRange describes part of the Cassandra ring, it is a mapping from a range to
endpoints responsible for that range.
@param start_token The first token in the range
@param end_token The last token in the range
@param endpoints The endpoints responsible for the range (listed by their configured listen_address)
@param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address)
*/
struct TokenRange {
1: required string start_token,
2: required string end_token,
3: required list<string> endpoints,
4: optional list<string> rpc_endpoints
5: optional list<EndpointDetails> endpoint_details,
}
/**
Authentication requests can contain any data, dependent on the IAuthenticator used
*/
struct AuthenticationRequest {
1: required map<string, string> credentials
}
enum IndexType {
KEYS,
CUSTOM,
COMPOSITES
}
/* describes a column in a column family. */
struct ColumnDef {
1: required binary name,
2: required string validation_class,
3: optional IndexType index_type,
4: optional string index_name,
5: optional map<string,string> index_options
}
/**
Describes a trigger.
`options` should include at least 'class' param.
Other options are not supported yet.
*/
struct TriggerDef {
1: required string name,
2: required map<string,string> options
}
/* describes a column family. */
struct CfDef {
1: required string keyspace,
2: required string name,
3: optional string column_type="Standard",
5: optional string comparator_type="BytesType",
6: optional string subcomparator_type,
8: optional string comment,
12: optional double read_repair_chance,
13: optional list<ColumnDef> column_metadata,
14: optional i32 gc_grace_seconds,
15: optional string default_validation_class,
16: optional i32 id,
17: optional i32 min_compaction_threshold,
18: optional i32 max_compaction_threshold,
26: optional string key_validation_class,
28: optional binary key_alias,
29: optional string compaction_strategy,
30: optional map<string,string> compaction_strategy_options,
32: optional map<string,string> compression_options,
33: optional double bloom_filter_fp_chance,
34: optional string caching="keys_only",
37: optional double dclocal_read_repair_chance = 0.0,
39: optional i32 memtable_flush_period_in_ms,
40: optional i32 default_time_to_live,
42: optional string speculative_retry="NONE",
43: optional list<TriggerDef> triggers,
44: optional string cells_per_row_to_cache = "100",
45: optional i32 min_index_interval,
46: optional i32 max_index_interval,
/* All of the following are now ignored and unsupplied. */
/** @deprecated */
9: optional double row_cache_size,
/** @deprecated */
11: optional double key_cache_size,
/** @deprecated */
19: optional i32 row_cache_save_period_in_seconds,
/** @deprecated */
20: optional i32 key_cache_save_period_in_seconds,
/** @deprecated */
21: optional i32 memtable_flush_after_mins,
/** @deprecated */
22: optional i32 memtable_throughput_in_mb,
/** @deprecated */
23: optional double memtable_operations_in_millions,
/** @deprecated */
24: optional bool replicate_on_write,
/** @deprecated */
25: optional double merge_shards_chance,
/** @deprecated */
27: optional string row_cache_provider,
/** @deprecated */
31: optional i32 row_cache_keys_to_save,
/** @deprecated */
38: optional bool populate_io_cache_on_flush,
/** @deprecated */
41: optional i32 index_interval,
}
/* describes a keyspace. */
struct KsDef {
1: required string name,
2: required string strategy_class,
3: optional map<string,string> strategy_options,
/** @deprecated ignored */
4: optional i32 replication_factor,
5: required list<CfDef> cf_defs,
6: optional bool durable_writes=1,
}
/** CQL query compression */
enum Compression {
GZIP = 1,
NONE = 2
}
enum CqlResultType {
ROWS = 1,
VOID = 2,
INT = 3
}
/**
Row returned from a CQL query.
This struct is used for both CQL2 and CQL3 queries. For CQL2, the partition key
is special-cased and is always returned. For CQL3, it is not special cased;
it will be included in the columns list if it was included in the SELECT and
the key field is always null.
*/
struct CqlRow {
1: required binary key,
2: required list<Column> columns
}
struct CqlMetadata {
1: required map<binary,string> name_types,
2: required map<binary,string> value_types,
3: required string default_name_type,
4: required string default_value_type
}
struct CqlResult {
1: required CqlResultType type,
2: optional list<CqlRow> rows,
3: optional i32 num,
4: optional CqlMetadata schema
}
struct CqlPreparedResult {
1: required i32 itemId,
2: required i32 count,
3: optional list<string> variable_types,
4: optional list<string> variable_names
}
/** Represents input splits used by hadoop ColumnFamilyRecordReaders */
struct CfSplit {
1: required string start_token,
2: required string end_token,
3: required i64 row_count
}
/** The ColumnSlice is used to select a set of columns from inside a row.
* If start or finish are unspecified they will default to the start-of
* end-of value.
* @param start. The start of the ColumnSlice inclusive
* @param finish. The end of the ColumnSlice inclusive
*/
struct ColumnSlice {
1: optional binary start,
2: optional binary finish
}
/**
* Used to perform multiple slices on a single row key in one rpc operation
* @param key. The row key to be multi sliced
* @param column_parent. The column family (super columns are unsupported)
* @param column_slices. 0 to many ColumnSlice objects each will be used to select columns
* @param reversed. Direction of slice
* @param count. Maximum number of columns
* @param consistency_level. Level to perform the operation at
*/
struct MultiSliceRequest {
1: optional binary key,
2: optional ColumnParent column_parent,
3: optional list<ColumnSlice> column_slices,
4: optional bool reversed=false,
5: optional i32 count=1000,
6: optional ConsistencyLevel consistency_level=ConsistencyLevel.ONE
}
service Cassandra {
# auth methods
void login(1: required AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 2:AuthorizationException authzx),
# set keyspace
void set_keyspace(1: required string keyspace) throws (1:InvalidRequestException ire),
# retrieval methods
/**
Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This is
the only method that can throw an exception under non-failure conditions.)
*/
ColumnOrSuperColumn get(1:required binary key,
2:required ColumnPath column_path,
3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:NotFoundException nfe, 3:UnavailableException ue, 4:TimedOutException te),
/**
Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name
pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned.
*/
list<ColumnOrSuperColumn> get_slice(1:required binary key,
2:required ColumnParent column_parent,
3:required SlicePredicate predicate,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
returns the number of columns matching <code>predicate</code> for a particular <code>key</code>,
<code>ColumnFamily</code> and optionally <code>SuperColumn</code>.
*/
i32 get_count(1:required binary key,
2:required ColumnParent column_parent,
3:required SlicePredicate predicate,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Performs a get_slice for column_parent and predicate for the given keys in parallel.
*/
map<binary,list<ColumnOrSuperColumn>> multiget_slice(1:required list<binary> keys,
2:required ColumnParent column_parent,
3:required SlicePredicate predicate,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Perform a get_count in parallel on the given {@code List<binary>} keys. The return value maps keys to the count found.
*/
map<binary, i32> multiget_count(1:required list<binary> keys,
2:required ColumnParent column_parent,
3:required SlicePredicate predicate,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
returns a subset of columns for a contiguous range of keys.
*/
list<KeySlice> get_range_slices(1:required ColumnParent column_parent,
2:required SlicePredicate predicate,
3:required KeyRange range,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
returns a range of columns, wrapping to the next rows if necessary to collect max_results.
*/
list<KeySlice> get_paged_slice(1:required string column_family,
2:required KeyRange range,
3:required binary start_column,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause
@deprecated use get_range_slices instead with range.row_filter specified
*/
list<KeySlice> get_indexed_slices(1:required ColumnParent column_parent,
2:required IndexClause index_clause,
3:required SlicePredicate column_predicate,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
# modification methods
/**
* Insert a Column at the given column_parent.column_family and optional column_parent.super_column.
*/
void insert(1:required binary key,
2:required ColumnParent column_parent,
3:required Column column,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
* Increment or decrement a counter.
*/
void add(1:required binary key,
2:required ColumnParent column_parent,
3:required CounterColumn column,
4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
* Atomic compare and set.
*
* If the cas is successfull, the success boolean in CASResult will be true and there will be no current_values.
* Otherwise, success will be false and current_values will contain the current values for the columns in
* expected (that, by definition of compare-and-set, will differ from the values in expected).
*
* A cas operation takes 2 consistency level. The first one, serial_consistency_level, simply indicates the
* level of serialization required. This can be either ConsistencyLevel.SERIAL or ConsistencyLevel.LOCAL_SERIAL.
* The second one, commit_consistency_level, defines the consistency level for the commit phase of the cas. This
* is a more traditional consistency level (the same CL than for traditional writes are accepted) that impact
* the visibility for reads of the operation. For instance, if commit_consistency_level is QUORUM, then it is
* guaranteed that a followup QUORUM read will see the cas write (if that one was successful obviously). If
* commit_consistency_level is ANY, you will need to use a SERIAL/LOCAL_SERIAL read to be guaranteed to see
* the write.
*/
CASResult cas(1:required binary key,
2:required string column_family,
3:list<Column> expected,
4:list<Column> updates,
5:required ConsistencyLevel serial_consistency_level=ConsistencyLevel.SERIAL,
6:required ConsistencyLevel commit_consistency_level=ConsistencyLevel.QUORUM)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those levels too.
*/
void remove(1:required binary key,
2:required ColumnPath column_path,
3:required i64 timestamp,
4:ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
* Remove a counter at the specified location.
* Note that counters have limited support for deletes: if you remove a counter, you must wait to issue any following update
* until the delete has reached all the nodes and all of them have been fully compacted.
*/
void remove_counter(1:required binary key,
2:required ColumnPath path,
3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Mutate many columns or super columns for many row keys. See also: Mutation.
mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
**/
void batch_mutate(1:required map<binary, map<string, list<Mutation>>> mutation_map,
2:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Atomically mutate many columns or super columns for many row keys. See also: Mutation.
mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
**/
void atomic_batch_mutate(1:required map<binary, map<string, list<Mutation>>> mutation_map,
2:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
/**
Truncate will mark and entire column family as deleted.
From the user's perspective a successful call to truncate will result complete data deletion from cfname.
Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one
only marks the data as deleted.
The operation succeeds only if all hosts in the cluster at available and will throw an UnavailableException if
some hosts are down.
*/
void truncate(1:required string cfname)
throws (1: InvalidRequestException ire, 2: UnavailableException ue, 3: TimedOutException te),
/**
* Select multiple slices of a key in a single RPC operation
*/
list<ColumnOrSuperColumn> get_multi_slice(1:required MultiSliceRequest request)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
// Meta-APIs -- APIs to get information about the node or cluster,
// rather than user data. The nodeprobe program provides usage examples.
/**
* for each schema version present in the cluster, returns a list of nodes at that version.
* hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION.
* the cluster is all on the same version if the size of the map is 1.
*/
map<string, list<string>> describe_schema_versions()
throws (1: InvalidRequestException ire),
/** list the defined keyspaces in this cluster */
list<KsDef> describe_keyspaces()
throws (1:InvalidRequestException ire),
/** get the cluster name */
string describe_cluster_name(),
/** get the thrift api version */
string describe_version(),
/** get the token ring: a map of ranges to host addresses,
represented as a set of TokenRange instead of a map from range
to list of endpoints, because you can't use Thrift structs as
map keys:
https://issues.apache.org/jira/browse/THRIFT-162
for the same reason, we can't return a set here, even though
order is neither important nor predictable. */
list<TokenRange> describe_ring(1:required string keyspace)
throws (1:InvalidRequestException ire),
/** same as describe_ring, but considers only nodes in the local DC */
list<TokenRange> describe_local_ring(1:required string keyspace)
throws (1:InvalidRequestException ire),
/** get the mapping between token->node ip
without taking replication into consideration
https://issues.apache.org/jira/browse/CASSANDRA-4092 */
map<string, string> describe_token_map()
throws (1:InvalidRequestException ire),
/** returns the partitioner used by this cluster */
string describe_partitioner(),
/** returns the snitch used by this cluster */
string describe_snitch(),
/** describe specified keyspace */
KsDef describe_keyspace(1:required string keyspace)
throws (1:NotFoundException nfe, 2:InvalidRequestException ire),
/** experimental API for hadoop/parallel query support.
may change violently and without warning.
returns list of token strings such that first subrange is (list[0], list[1]],
next is (list[1], list[2]], etc. */
list<string> describe_splits(1:required string cfName,
2:required string start_token,
3:required string end_token,
4:required i32 keys_per_split)
throws (1:InvalidRequestException ire),
/** Enables tracing for the next query in this connection and returns the UUID for that trace session
The next query will be traced idependently of trace probability and the returned UUID can be used to query the trace keyspace */
binary trace_next_query(),
list<CfSplit> describe_splits_ex(1:required string cfName,
2:required string start_token,
3:required string end_token,
4:required i32 keys_per_split)
throws (1:InvalidRequestException ire),
/** adds a column family. returns the new schema id. */
string system_add_column_family(1:required CfDef cf_def)
throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
/** drops a column family. returns the new schema id. */
string system_drop_column_family(1:required string column_family)
throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
/** adds a keyspace and any column families that are part of it. returns the new schema id. */
string system_add_keyspace(1:required KsDef ks_def)
throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
/** drops a keyspace and any column families that are part of it. returns the new schema id. */
string system_drop_keyspace(1:required string keyspace)
throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
/** updates properties of a keyspace. returns the new schema id. */
string system_update_keyspace(1:required KsDef ks_def)
throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
/** updates properties of a column family. returns the new schema id. */
string system_update_column_family(1:required CfDef cf_def)
throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
/**
* @deprecated Throws InvalidRequestException since 2.2. Please use the CQL3 version instead.
*/
CqlResult execute_cql_query(1:required binary query, 2:required Compression compression)
throws (1:InvalidRequestException ire,
2:UnavailableException ue,
3:TimedOutException te,
4:SchemaDisagreementException sde)
/**
* Executes a CQL3 (Cassandra Query Language) statement and returns a
* CqlResult containing the results.
*/
CqlResult execute_cql3_query(1:required binary query, 2:required Compression compression, 3:required ConsistencyLevel consistency)
throws (1:InvalidRequestException ire,
2:UnavailableException ue,
3:TimedOutException te,
4:SchemaDisagreementException sde)
/**
* @deprecated Throws InvalidRequestException since 2.2. Please use the CQL3 version instead.
*/
CqlPreparedResult prepare_cql_query(1:required binary query, 2:required Compression compression)
throws (1:InvalidRequestException ire)
/**
* Prepare a CQL3 (Cassandra Query Language) statement by compiling and returning
* - the type of CQL statement
* - an id token of the compiled CQL stored on the server side.
* - a count of the discovered bound markers in the statement
*/
CqlPreparedResult prepare_cql3_query(1:required binary query, 2:required Compression compression)
throws (1:InvalidRequestException ire)
/**
* @deprecated Throws InvalidRequestException since 2.2. Please use the CQL3 version instead.
*/
CqlResult execute_prepared_cql_query(1:required i32 itemId, 2:required list<binary> values)
throws (1:InvalidRequestException ire,
2:UnavailableException ue,
3:TimedOutException te,
4:SchemaDisagreementException sde)
/**
* Executes a prepared CQL3 (Cassandra Query Language) statement by passing an id token, a list of variables
* to bind, and the consistency level, and returns a CqlResult containing the results.
*/
CqlResult execute_prepared_cql3_query(1:required i32 itemId, 2:required list<binary> values, 3:required ConsistencyLevel consistency)
throws (1:InvalidRequestException ire,
2:UnavailableException ue,
3:TimedOutException te,
4:SchemaDisagreementException sde)
/**
* @deprecated This is now a no-op. Please use the CQL3 specific methods instead.
*/
void set_cql_version(1: required string version) throws (1:InvalidRequestException ire)
}

View File

@ -1,400 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.TException;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
/**
* invalid authentication request (invalid keyspace, user does not exist, or credentials invalid)
*/
public class AuthenticationException extends TException implements org.apache.thrift.TBase<AuthenticationException, AuthenticationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthenticationException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationException");
private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new AuthenticationExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new AuthenticationExceptionTupleSchemeFactory());
}
public String why; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
WHY((short)1, "why");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // WHY
return WHY;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.WHY, new org.apache.thrift.meta_data.FieldMetaData("why", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthenticationException.class, metaDataMap);
}
public AuthenticationException() {
}
public AuthenticationException(
String why)
{
this();
this.why = why;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public AuthenticationException(AuthenticationException other) {
if (other.isSetWhy()) {
this.why = other.why;
}
}
public AuthenticationException deepCopy() {
return new AuthenticationException(this);
}
@Override
public void clear() {
this.why = null;
}
public String getWhy() {
return this.why;
}
public AuthenticationException setWhy(String why) {
this.why = why;
return this;
}
public void unsetWhy() {
this.why = null;
}
/** Returns true if field why is set (has been assigned a value) and false otherwise */
public boolean isSetWhy() {
return this.why != null;
}
public void setWhyIsSet(boolean value) {
if (!value) {
this.why = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case WHY:
if (value == null) {
unsetWhy();
} else {
setWhy((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case WHY:
return getWhy();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case WHY:
return isSetWhy();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof AuthenticationException)
return this.equals((AuthenticationException)that);
return false;
}
public boolean equals(AuthenticationException that) {
if (that == null)
return false;
boolean this_present_why = true && this.isSetWhy();
boolean that_present_why = true && that.isSetWhy();
if (this_present_why || that_present_why) {
if (!(this_present_why && that_present_why))
return false;
if (!this.why.equals(that.why))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_why = true && (isSetWhy());
builder.append(present_why);
if (present_why)
builder.append(why);
return builder.toHashCode();
}
@Override
public int compareTo(AuthenticationException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetWhy()).compareTo(other.isSetWhy());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWhy()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.why, other.why);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("AuthenticationException(");
boolean first = true;
sb.append("why:");
if (this.why == null) {
sb.append("null");
} else {
sb.append(this.why);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (why == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'why' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class AuthenticationExceptionStandardSchemeFactory implements SchemeFactory {
public AuthenticationExceptionStandardScheme getScheme() {
return new AuthenticationExceptionStandardScheme();
}
}
private static class AuthenticationExceptionStandardScheme extends StandardScheme<AuthenticationException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // WHY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.why = iprot.readString();
struct.setWhyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.why != null) {
oprot.writeFieldBegin(WHY_FIELD_DESC);
oprot.writeString(struct.why);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class AuthenticationExceptionTupleSchemeFactory implements SchemeFactory {
public AuthenticationExceptionTupleScheme getScheme() {
return new AuthenticationExceptionTupleScheme();
}
}
private static class AuthenticationExceptionTupleScheme extends TupleScheme<AuthenticationException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.why);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.why = iprot.readString();
struct.setWhyIsSet(true);
}
}
}

View File

@ -1,465 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Authentication requests can contain any data, dependent on the IAuthenticator used
*/
public class AuthenticationRequest implements org.apache.thrift.TBase<AuthenticationRequest, AuthenticationRequest._Fields>, java.io.Serializable, Cloneable, Comparable<AuthenticationRequest> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationRequest");
private static final org.apache.thrift.protocol.TField CREDENTIALS_FIELD_DESC = new org.apache.thrift.protocol.TField("credentials", org.apache.thrift.protocol.TType.MAP, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new AuthenticationRequestStandardSchemeFactory());
schemes.put(TupleScheme.class, new AuthenticationRequestTupleSchemeFactory());
}
public Map<String,String> credentials; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
CREDENTIALS((short)1, "credentials");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // CREDENTIALS
return CREDENTIALS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.CREDENTIALS, new org.apache.thrift.meta_data.FieldMetaData("credentials", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthenticationRequest.class, metaDataMap);
}
public AuthenticationRequest() {
}
public AuthenticationRequest(
Map<String,String> credentials)
{
this();
this.credentials = credentials;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public AuthenticationRequest(AuthenticationRequest other) {
if (other.isSetCredentials()) {
Map<String,String> __this__credentials = new HashMap<String,String>(other.credentials);
this.credentials = __this__credentials;
}
}
public AuthenticationRequest deepCopy() {
return new AuthenticationRequest(this);
}
@Override
public void clear() {
this.credentials = null;
}
public int getCredentialsSize() {
return (this.credentials == null) ? 0 : this.credentials.size();
}
public void putToCredentials(String key, String val) {
if (this.credentials == null) {
this.credentials = new HashMap<String,String>();
}
this.credentials.put(key, val);
}
public Map<String,String> getCredentials() {
return this.credentials;
}
public AuthenticationRequest setCredentials(Map<String,String> credentials) {
this.credentials = credentials;
return this;
}
public void unsetCredentials() {
this.credentials = null;
}
/** Returns true if field credentials is set (has been assigned a value) and false otherwise */
public boolean isSetCredentials() {
return this.credentials != null;
}
public void setCredentialsIsSet(boolean value) {
if (!value) {
this.credentials = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case CREDENTIALS:
if (value == null) {
unsetCredentials();
} else {
setCredentials((Map<String,String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case CREDENTIALS:
return getCredentials();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case CREDENTIALS:
return isSetCredentials();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof AuthenticationRequest)
return this.equals((AuthenticationRequest)that);
return false;
}
public boolean equals(AuthenticationRequest that) {
if (that == null)
return false;
boolean this_present_credentials = true && this.isSetCredentials();
boolean that_present_credentials = true && that.isSetCredentials();
if (this_present_credentials || that_present_credentials) {
if (!(this_present_credentials && that_present_credentials))
return false;
if (!this.credentials.equals(that.credentials))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_credentials = true && (isSetCredentials());
builder.append(present_credentials);
if (present_credentials)
builder.append(credentials);
return builder.toHashCode();
}
@Override
public int compareTo(AuthenticationRequest other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetCredentials()).compareTo(other.isSetCredentials());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCredentials()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credentials, other.credentials);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("AuthenticationRequest(");
boolean first = true;
sb.append("credentials:");
if (this.credentials == null) {
sb.append("null");
} else {
sb.append(this.credentials);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (credentials == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'credentials' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class AuthenticationRequestStandardSchemeFactory implements SchemeFactory {
public AuthenticationRequestStandardScheme getScheme() {
return new AuthenticationRequestStandardScheme();
}
}
private static class AuthenticationRequestStandardScheme extends StandardScheme<AuthenticationRequest> {
public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationRequest struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // CREDENTIALS
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map80 = iprot.readMapBegin();
struct.credentials = new HashMap<String,String>(2*_map80.size);
for (int _i81 = 0; _i81 < _map80.size; ++_i81)
{
String _key82;
String _val83;
_key82 = iprot.readString();
_val83 = iprot.readString();
struct.credentials.put(_key82, _val83);
}
iprot.readMapEnd();
}
struct.setCredentialsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.credentials != null) {
oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size()));
for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet())
{
oprot.writeString(_iter84.getKey());
oprot.writeString(_iter84.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class AuthenticationRequestTupleSchemeFactory implements SchemeFactory {
public AuthenticationRequestTupleScheme getScheme() {
return new AuthenticationRequestTupleScheme();
}
}
private static class AuthenticationRequestTupleScheme extends TupleScheme<AuthenticationRequest> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationRequest struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
{
oprot.writeI32(struct.credentials.size());
for (Map.Entry<String, String> _iter85 : struct.credentials.entrySet())
{
oprot.writeString(_iter85.getKey());
oprot.writeString(_iter85.getValue());
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationRequest struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
{
org.apache.thrift.protocol.TMap _map86 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.credentials = new HashMap<String,String>(2*_map86.size);
for (int _i87 = 0; _i87 < _map86.size; ++_i87)
{
String _key88;
String _val89;
_key88 = iprot.readString();
_val89 = iprot.readString();
struct.credentials.put(_key88, _val89);
}
}
struct.setCredentialsIsSet(true);
}
}
}

View File

@ -1,413 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* invalid authorization request (user does not have access to keyspace)
*/
public class AuthorizationException extends TException implements org.apache.thrift.TBase<AuthorizationException, AuthorizationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthorizationException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthorizationException");
private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new AuthorizationExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new AuthorizationExceptionTupleSchemeFactory());
}
public String why; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
WHY((short)1, "why");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // WHY
return WHY;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.WHY, new org.apache.thrift.meta_data.FieldMetaData("why", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthorizationException.class, metaDataMap);
}
public AuthorizationException() {
}
public AuthorizationException(
String why)
{
this();
this.why = why;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public AuthorizationException(AuthorizationException other) {
if (other.isSetWhy()) {
this.why = other.why;
}
}
public AuthorizationException deepCopy() {
return new AuthorizationException(this);
}
@Override
public void clear() {
this.why = null;
}
public String getWhy() {
return this.why;
}
public AuthorizationException setWhy(String why) {
this.why = why;
return this;
}
public void unsetWhy() {
this.why = null;
}
/** Returns true if field why is set (has been assigned a value) and false otherwise */
public boolean isSetWhy() {
return this.why != null;
}
public void setWhyIsSet(boolean value) {
if (!value) {
this.why = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case WHY:
if (value == null) {
unsetWhy();
} else {
setWhy((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case WHY:
return getWhy();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case WHY:
return isSetWhy();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof AuthorizationException)
return this.equals((AuthorizationException)that);
return false;
}
public boolean equals(AuthorizationException that) {
if (that == null)
return false;
boolean this_present_why = true && this.isSetWhy();
boolean that_present_why = true && that.isSetWhy();
if (this_present_why || that_present_why) {
if (!(this_present_why && that_present_why))
return false;
if (!this.why.equals(that.why))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_why = true && (isSetWhy());
builder.append(present_why);
if (present_why)
builder.append(why);
return builder.toHashCode();
}
@Override
public int compareTo(AuthorizationException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetWhy()).compareTo(other.isSetWhy());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWhy()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.why, other.why);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("AuthorizationException(");
boolean first = true;
sb.append("why:");
if (this.why == null) {
sb.append("null");
} else {
sb.append(this.why);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (why == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'why' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class AuthorizationExceptionStandardSchemeFactory implements SchemeFactory {
public AuthorizationExceptionStandardScheme getScheme() {
return new AuthorizationExceptionStandardScheme();
}
}
private static class AuthorizationExceptionStandardScheme extends StandardScheme<AuthorizationException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, AuthorizationException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // WHY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.why = iprot.readString();
struct.setWhyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthorizationException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.why != null) {
oprot.writeFieldBegin(WHY_FIELD_DESC);
oprot.writeString(struct.why);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class AuthorizationExceptionTupleSchemeFactory implements SchemeFactory {
public AuthorizationExceptionTupleScheme getScheme() {
return new AuthorizationExceptionTupleScheme();
}
}
private static class AuthorizationExceptionTupleScheme extends TupleScheme<AuthorizationException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.why);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.why = iprot.readString();
struct.setWhyIsSet(true);
}
}
}

View File

@ -1,574 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CASResult implements org.apache.thrift.TBase<CASResult, CASResult._Fields>, java.io.Serializable, Cloneable, Comparable<CASResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CASResult");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)1);
private static final org.apache.thrift.protocol.TField CURRENT_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("current_values", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CASResultStandardSchemeFactory());
schemes.put(TupleScheme.class, new CASResultTupleSchemeFactory());
}
public boolean success; // required
public List<Column> current_values; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)1, "success"),
CURRENT_VALUES((short)2, "current_values");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // SUCCESS
return SUCCESS;
case 2: // CURRENT_VALUES
return CURRENT_VALUES;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __SUCCESS_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.CURRENT_VALUES};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.CURRENT_VALUES, new org.apache.thrift.meta_data.FieldMetaData("current_values", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Column.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CASResult.class, metaDataMap);
}
public CASResult() {
}
public CASResult(
boolean success)
{
this();
this.success = success;
setSuccessIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CASResult(CASResult other) {
__isset_bitfield = other.__isset_bitfield;
this.success = other.success;
if (other.isSetCurrent_values()) {
List<Column> __this__current_values = new ArrayList<Column>(other.current_values.size());
for (Column other_element : other.current_values) {
__this__current_values.add(new Column(other_element));
}
this.current_values = __this__current_values;
}
}
public CASResult deepCopy() {
return new CASResult(this);
}
@Override
public void clear() {
setSuccessIsSet(false);
this.success = false;
this.current_values = null;
}
public boolean isSuccess() {
return this.success;
}
public CASResult setSuccess(boolean success) {
this.success = success;
setSuccessIsSet(true);
return this;
}
public void unsetSuccess() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
/** Returns true if field success is set (has been assigned a value) and false otherwise */
public boolean isSetSuccess() {
return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
public void setSuccessIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
}
public int getCurrent_valuesSize() {
return (this.current_values == null) ? 0 : this.current_values.size();
}
public java.util.Iterator<Column> getCurrent_valuesIterator() {
return (this.current_values == null) ? null : this.current_values.iterator();
}
public void addToCurrent_values(Column elem) {
if (this.current_values == null) {
this.current_values = new ArrayList<Column>();
}
this.current_values.add(elem);
}
public List<Column> getCurrent_values() {
return this.current_values;
}
public CASResult setCurrent_values(List<Column> current_values) {
this.current_values = current_values;
return this;
}
public void unsetCurrent_values() {
this.current_values = null;
}
/** Returns true if field current_values is set (has been assigned a value) and false otherwise */
public boolean isSetCurrent_values() {
return this.current_values != null;
}
public void setCurrent_valuesIsSet(boolean value) {
if (!value) {
this.current_values = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((Boolean)value);
}
break;
case CURRENT_VALUES:
if (value == null) {
unsetCurrent_values();
} else {
setCurrent_values((List<Column>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return Boolean.valueOf(isSuccess());
case CURRENT_VALUES:
return getCurrent_values();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SUCCESS:
return isSetSuccess();
case CURRENT_VALUES:
return isSetCurrent_values();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CASResult)
return this.equals((CASResult)that);
return false;
}
public boolean equals(CASResult that) {
if (that == null)
return false;
boolean this_present_success = true;
boolean that_present_success = true;
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
if (this.success != that.success)
return false;
}
boolean this_present_current_values = true && this.isSetCurrent_values();
boolean that_present_current_values = true && that.isSetCurrent_values();
if (this_present_current_values || that_present_current_values) {
if (!(this_present_current_values && that_present_current_values))
return false;
if (!this.current_values.equals(that.current_values))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_success = true;
builder.append(present_success);
if (present_success)
builder.append(success);
boolean present_current_values = true && (isSetCurrent_values());
builder.append(present_current_values);
if (present_current_values)
builder.append(current_values);
return builder.toHashCode();
}
@Override
public int compareTo(CASResult other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCurrent_values()).compareTo(other.isSetCurrent_values());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCurrent_values()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.current_values, other.current_values);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CASResult(");
boolean first = true;
sb.append("success:");
sb.append(this.success);
first = false;
if (isSetCurrent_values()) {
if (!first) sb.append(", ");
sb.append("current_values:");
if (this.current_values == null) {
sb.append("null");
} else {
sb.append(this.current_values);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// alas, we cannot check 'success' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CASResultStandardSchemeFactory implements SchemeFactory {
public CASResultStandardScheme getScheme() {
return new CASResultStandardScheme();
}
}
private static class CASResultStandardScheme extends StandardScheme<CASResult> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CASResult struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // SUCCESS
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.success = iprot.readBool();
struct.setSuccessIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // CURRENT_VALUES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list48 = iprot.readListBegin();
struct.current_values = new ArrayList<Column>(_list48.size);
for (int _i49 = 0; _i49 < _list48.size; ++_i49)
{
Column _elem50;
_elem50 = new Column();
_elem50.read(iprot);
struct.current_values.add(_elem50);
}
iprot.readListEnd();
}
struct.setCurrent_valuesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetSuccess()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'success' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CASResult struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
oprot.writeBool(struct.success);
oprot.writeFieldEnd();
if (struct.current_values != null) {
if (struct.isSetCurrent_values()) {
oprot.writeFieldBegin(CURRENT_VALUES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.current_values.size()));
for (Column _iter51 : struct.current_values)
{
_iter51.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CASResultTupleSchemeFactory implements SchemeFactory {
public CASResultTupleScheme getScheme() {
return new CASResultTupleScheme();
}
}
private static class CASResultTupleScheme extends TupleScheme<CASResult> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CASResult struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBool(struct.success);
BitSet optionals = new BitSet();
if (struct.isSetCurrent_values()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetCurrent_values()) {
{
oprot.writeI32(struct.current_values.size());
for (Column _iter52 : struct.current_values)
{
_iter52.write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CASResult struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.success = iprot.readBool();
struct.setSuccessIsSet(true);
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.current_values = new ArrayList<Column>(_list53.size);
for (int _i54 = 0; _i54 < _list53.size; ++_i54)
{
Column _elem55;
_elem55 = new Column();
_elem55.read(iprot);
struct.current_values.add(_elem55);
}
}
struct.setCurrent_valuesIsSet(true);
}
}
}
}

View File

@ -1,601 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.EncodingUtils;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
/**
* Represents input splits used by hadoop ColumnFamilyRecordReaders
*/
public class CfSplit implements org.apache.thrift.TBase<CfSplit, CfSplit._Fields>, java.io.Serializable, Cloneable, Comparable<CfSplit> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CfSplit");
private static final org.apache.thrift.protocol.TField START_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("start_token", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField END_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("end_token", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField ROW_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("row_count", org.apache.thrift.protocol.TType.I64, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CfSplitStandardSchemeFactory());
schemes.put(TupleScheme.class, new CfSplitTupleSchemeFactory());
}
public String start_token; // required
public String end_token; // required
public long row_count; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
START_TOKEN((short)1, "start_token"),
END_TOKEN((short)2, "end_token"),
ROW_COUNT((short)3, "row_count");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // START_TOKEN
return START_TOKEN;
case 2: // END_TOKEN
return END_TOKEN;
case 3: // ROW_COUNT
return ROW_COUNT;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __ROW_COUNT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.START_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("start_token", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.END_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("end_token", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ROW_COUNT, new org.apache.thrift.meta_data.FieldMetaData("row_count", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CfSplit.class, metaDataMap);
}
public CfSplit() {
}
public CfSplit(
String start_token,
String end_token,
long row_count)
{
this();
this.start_token = start_token;
this.end_token = end_token;
this.row_count = row_count;
setRow_countIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CfSplit(CfSplit other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetStart_token()) {
this.start_token = other.start_token;
}
if (other.isSetEnd_token()) {
this.end_token = other.end_token;
}
this.row_count = other.row_count;
}
public CfSplit deepCopy() {
return new CfSplit(this);
}
@Override
public void clear() {
this.start_token = null;
this.end_token = null;
setRow_countIsSet(false);
this.row_count = 0;
}
public String getStart_token() {
return this.start_token;
}
public CfSplit setStart_token(String start_token) {
this.start_token = start_token;
return this;
}
public void unsetStart_token() {
this.start_token = null;
}
/** Returns true if field start_token is set (has been assigned a value) and false otherwise */
public boolean isSetStart_token() {
return this.start_token != null;
}
public void setStart_tokenIsSet(boolean value) {
if (!value) {
this.start_token = null;
}
}
public String getEnd_token() {
return this.end_token;
}
public CfSplit setEnd_token(String end_token) {
this.end_token = end_token;
return this;
}
public void unsetEnd_token() {
this.end_token = null;
}
/** Returns true if field end_token is set (has been assigned a value) and false otherwise */
public boolean isSetEnd_token() {
return this.end_token != null;
}
public void setEnd_tokenIsSet(boolean value) {
if (!value) {
this.end_token = null;
}
}
public long getRow_count() {
return this.row_count;
}
public CfSplit setRow_count(long row_count) {
this.row_count = row_count;
setRow_countIsSet(true);
return this;
}
public void unsetRow_count() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ROW_COUNT_ISSET_ID);
}
/** Returns true if field row_count is set (has been assigned a value) and false otherwise */
public boolean isSetRow_count() {
return EncodingUtils.testBit(__isset_bitfield, __ROW_COUNT_ISSET_ID);
}
public void setRow_countIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ROW_COUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case START_TOKEN:
if (value == null) {
unsetStart_token();
} else {
setStart_token((String)value);
}
break;
case END_TOKEN:
if (value == null) {
unsetEnd_token();
} else {
setEnd_token((String)value);
}
break;
case ROW_COUNT:
if (value == null) {
unsetRow_count();
} else {
setRow_count((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case START_TOKEN:
return getStart_token();
case END_TOKEN:
return getEnd_token();
case ROW_COUNT:
return Long.valueOf(getRow_count());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case START_TOKEN:
return isSetStart_token();
case END_TOKEN:
return isSetEnd_token();
case ROW_COUNT:
return isSetRow_count();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CfSplit)
return this.equals((CfSplit)that);
return false;
}
public boolean equals(CfSplit that) {
if (that == null)
return false;
boolean this_present_start_token = true && this.isSetStart_token();
boolean that_present_start_token = true && that.isSetStart_token();
if (this_present_start_token || that_present_start_token) {
if (!(this_present_start_token && that_present_start_token))
return false;
if (!this.start_token.equals(that.start_token))
return false;
}
boolean this_present_end_token = true && this.isSetEnd_token();
boolean that_present_end_token = true && that.isSetEnd_token();
if (this_present_end_token || that_present_end_token) {
if (!(this_present_end_token && that_present_end_token))
return false;
if (!this.end_token.equals(that.end_token))
return false;
}
boolean this_present_row_count = true;
boolean that_present_row_count = true;
if (this_present_row_count || that_present_row_count) {
if (!(this_present_row_count && that_present_row_count))
return false;
if (this.row_count != that.row_count)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_start_token = true && (isSetStart_token());
builder.append(present_start_token);
if (present_start_token)
builder.append(start_token);
boolean present_end_token = true && (isSetEnd_token());
builder.append(present_end_token);
if (present_end_token)
builder.append(end_token);
boolean present_row_count = true;
builder.append(present_row_count);
if (present_row_count)
builder.append(row_count);
return builder.toHashCode();
}
@Override
public int compareTo(CfSplit other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetStart_token()).compareTo(other.isSetStart_token());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStart_token()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_token, other.start_token);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEnd_token()).compareTo(other.isSetEnd_token());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEnd_token()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.end_token, other.end_token);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRow_count()).compareTo(other.isSetRow_count());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRow_count()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row_count, other.row_count);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CfSplit(");
boolean first = true;
sb.append("start_token:");
if (this.start_token == null) {
sb.append("null");
} else {
sb.append(this.start_token);
}
first = false;
if (!first) sb.append(", ");
sb.append("end_token:");
if (this.end_token == null) {
sb.append("null");
} else {
sb.append(this.end_token);
}
first = false;
if (!first) sb.append(", ");
sb.append("row_count:");
sb.append(this.row_count);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (start_token == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'start_token' was not present! Struct: " + toString());
}
if (end_token == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'end_token' was not present! Struct: " + toString());
}
// alas, we cannot check 'row_count' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CfSplitStandardSchemeFactory implements SchemeFactory {
public CfSplitStandardScheme getScheme() {
return new CfSplitStandardScheme();
}
}
private static class CfSplitStandardScheme extends StandardScheme<CfSplit> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CfSplit struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // START_TOKEN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.start_token = iprot.readString();
struct.setStart_tokenIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // END_TOKEN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.end_token = iprot.readString();
struct.setEnd_tokenIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // ROW_COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.row_count = iprot.readI64();
struct.setRow_countIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetRow_count()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'row_count' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CfSplit struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.start_token != null) {
oprot.writeFieldBegin(START_TOKEN_FIELD_DESC);
oprot.writeString(struct.start_token);
oprot.writeFieldEnd();
}
if (struct.end_token != null) {
oprot.writeFieldBegin(END_TOKEN_FIELD_DESC);
oprot.writeString(struct.end_token);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(ROW_COUNT_FIELD_DESC);
oprot.writeI64(struct.row_count);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CfSplitTupleSchemeFactory implements SchemeFactory {
public CfSplitTupleScheme getScheme() {
return new CfSplitTupleScheme();
}
}
private static class CfSplitTupleScheme extends TupleScheme<CfSplit> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CfSplit struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.start_token);
oprot.writeString(struct.end_token);
oprot.writeI64(struct.row_count);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CfSplit struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.start_token = iprot.readString();
struct.setStart_tokenIsSet(true);
struct.end_token = iprot.readString();
struct.setEnd_tokenIsSet(true);
struct.row_count = iprot.readI64();
struct.setRow_countIsSet(true);
}
}
}

View File

@ -1,743 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.EncodingUtils;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
/**
* Basic unit of data within a ColumnFamily.
* @param name, the name by which this column is set and retrieved. Maximum 64KB long.
* @param value. The data associated with the name. Maximum 2GB long, but in practice you should limit it to small numbers of MB (since Thrift must read the full value into memory to operate on it).
* @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to be compared.
* @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted.
*/
public class Column implements org.apache.thrift.TBase<Column, Column._Fields>, java.io.Serializable, Cloneable, Comparable<Column> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Column");
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)3);
private static final org.apache.thrift.protocol.TField TTL_FIELD_DESC = new org.apache.thrift.protocol.TField("ttl", org.apache.thrift.protocol.TType.I32, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ColumnStandardSchemeFactory());
schemes.put(TupleScheme.class, new ColumnTupleSchemeFactory());
}
public ByteBuffer name; // required
public ByteBuffer value; // optional
public long timestamp; // optional
public int ttl; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME((short)1, "name"),
VALUE((short)2, "value"),
TIMESTAMP((short)3, "timestamp"),
TTL((short)4, "ttl");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // VALUE
return VALUE;
case 3: // TIMESTAMP
return TIMESTAMP;
case 4: // TTL
return TTL;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
private static final int __TTL_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.VALUE,_Fields.TIMESTAMP,_Fields.TTL};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.TTL, new org.apache.thrift.meta_data.FieldMetaData("ttl", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Column.class, metaDataMap);
}
public Column() {
}
public Column(
ByteBuffer name)
{
this();
this.name = name;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public Column(Column other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
}
if (other.isSetValue()) {
this.value = org.apache.thrift.TBaseHelper.copyBinary(other.value);
;
}
this.timestamp = other.timestamp;
this.ttl = other.ttl;
}
public Column deepCopy() {
return new Column(this);
}
@Override
public void clear() {
this.name = null;
this.value = null;
setTimestampIsSet(false);
this.timestamp = 0;
setTtlIsSet(false);
this.ttl = 0;
}
public byte[] getName() {
setName(org.apache.thrift.TBaseHelper.rightSize(name));
return name == null ? null : name.array();
}
public ByteBuffer bufferForName() {
return name;
}
public Column setName(byte[] name) {
setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
return this;
}
public Column setName(ByteBuffer name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public byte[] getValue() {
setValue(org.apache.thrift.TBaseHelper.rightSize(value));
return value == null ? null : value.array();
}
public ByteBuffer bufferForValue() {
return value;
}
public Column setValue(byte[] value) {
setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value));
return this;
}
public Column setValue(ByteBuffer value) {
this.value = value;
return this;
}
public void unsetValue() {
this.value = null;
}
/** Returns true if field value is set (has been assigned a value) and false otherwise */
public boolean isSetValue() {
return this.value != null;
}
public void setValueIsSet(boolean value) {
if (!value) {
this.value = null;
}
}
public long getTimestamp() {
return this.timestamp;
}
public Column setTimestamp(long timestamp) {
this.timestamp = timestamp;
setTimestampIsSet(true);
return this;
}
public void unsetTimestamp() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
/** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
public void setTimestampIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
}
public int getTtl() {
return this.ttl;
}
public Column setTtl(int ttl) {
this.ttl = ttl;
setTtlIsSet(true);
return this;
}
public void unsetTtl() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TTL_ISSET_ID);
}
/** Returns true if field ttl is set (has been assigned a value) and false otherwise */
public boolean isSetTtl() {
return EncodingUtils.testBit(__isset_bitfield, __TTL_ISSET_ID);
}
public void setTtlIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TTL_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((ByteBuffer)value);
}
break;
case VALUE:
if (value == null) {
unsetValue();
} else {
setValue((ByteBuffer)value);
}
break;
case TIMESTAMP:
if (value == null) {
unsetTimestamp();
} else {
setTimestamp((Long)value);
}
break;
case TTL:
if (value == null) {
unsetTtl();
} else {
setTtl((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case VALUE:
return getValue();
case TIMESTAMP:
return Long.valueOf(getTimestamp());
case TTL:
return Integer.valueOf(getTtl());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case VALUE:
return isSetValue();
case TIMESTAMP:
return isSetTimestamp();
case TTL:
return isSetTtl();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Column)
return this.equals((Column)that);
return false;
}
public boolean equals(Column that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_value = true && this.isSetValue();
boolean that_present_value = true && that.isSetValue();
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
if (!this.value.equals(that.value))
return false;
}
boolean this_present_timestamp = true && this.isSetTimestamp();
boolean that_present_timestamp = true && that.isSetTimestamp();
if (this_present_timestamp || that_present_timestamp) {
if (!(this_present_timestamp && that_present_timestamp))
return false;
if (this.timestamp != that.timestamp)
return false;
}
boolean this_present_ttl = true && this.isSetTtl();
boolean that_present_ttl = true && that.isSetTtl();
if (this_present_ttl || that_present_ttl) {
if (!(this_present_ttl && that_present_ttl))
return false;
if (this.ttl != that.ttl)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name = true && (isSetName());
builder.append(present_name);
if (present_name)
builder.append(name);
boolean present_value = true && (isSetValue());
builder.append(present_value);
if (present_value)
builder.append(value);
boolean present_timestamp = true && (isSetTimestamp());
builder.append(present_timestamp);
if (present_timestamp)
builder.append(timestamp);
boolean present_ttl = true && (isSetTtl());
builder.append(present_ttl);
if (present_ttl)
builder.append(ttl);
return builder.toHashCode();
}
@Override
public int compareTo(Column other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimestamp()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTtl()).compareTo(other.isSetTtl());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTtl()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ttl, other.ttl);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Column(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.name, sb);
}
first = false;
if (isSetValue()) {
if (!first) sb.append(", ");
sb.append("value:");
if (this.value == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.value, sb);
}
first = false;
}
if (isSetTimestamp()) {
if (!first) sb.append(", ");
sb.append("timestamp:");
sb.append(this.timestamp);
first = false;
}
if (isSetTtl()) {
if (!first) sb.append(", ");
sb.append("ttl:");
sb.append(this.ttl);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ColumnStandardSchemeFactory implements SchemeFactory {
public ColumnStandardScheme getScheme() {
return new ColumnStandardScheme();
}
}
private static class ColumnStandardScheme extends StandardScheme<Column> {
public void read(org.apache.thrift.protocol.TProtocol iprot, Column struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // VALUE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.value = iprot.readBinary();
struct.setValueIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // TIMESTAMP
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // TTL
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.ttl = iprot.readI32();
struct.setTtlIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, Column struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeBinary(struct.name);
oprot.writeFieldEnd();
}
if (struct.value != null) {
if (struct.isSetValue()) {
oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeBinary(struct.value);
oprot.writeFieldEnd();
}
}
if (struct.isSetTimestamp()) {
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(struct.timestamp);
oprot.writeFieldEnd();
}
if (struct.isSetTtl()) {
oprot.writeFieldBegin(TTL_FIELD_DESC);
oprot.writeI32(struct.ttl);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ColumnTupleSchemeFactory implements SchemeFactory {
public ColumnTupleScheme getScheme() {
return new ColumnTupleScheme();
}
}
private static class ColumnTupleScheme extends TupleScheme<Column> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, Column struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.name);
BitSet optionals = new BitSet();
if (struct.isSetValue()) {
optionals.set(0);
}
if (struct.isSetTimestamp()) {
optionals.set(1);
}
if (struct.isSetTtl()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetValue()) {
oprot.writeBinary(struct.value);
}
if (struct.isSetTimestamp()) {
oprot.writeI64(struct.timestamp);
}
if (struct.isSetTtl()) {
oprot.writeI32(struct.ttl);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, Column struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.value = iprot.readBinary();
struct.setValueIsSet(true);
}
if (incoming.get(1)) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
}
if (incoming.get(2)) {
struct.ttl = iprot.readI32();
struct.setTtlIsSet(true);
}
}
}
}

View File

@ -1,903 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
public class ColumnDef implements org.apache.thrift.TBase<ColumnDef, ColumnDef._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnDef> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnDef");
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField VALIDATION_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("validation_class", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField INDEX_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("index_type", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField INDEX_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("index_name", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField INDEX_OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("index_options", org.apache.thrift.protocol.TType.MAP, (short)5);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ColumnDefStandardSchemeFactory());
schemes.put(TupleScheme.class, new ColumnDefTupleSchemeFactory());
}
public ByteBuffer name; // required
public String validation_class; // required
/**
*
* @see IndexType
*/
public IndexType index_type; // optional
public String index_name; // optional
public Map<String,String> index_options; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME((short)1, "name"),
VALIDATION_CLASS((short)2, "validation_class"),
/**
*
* @see IndexType
*/
INDEX_TYPE((short)3, "index_type"),
INDEX_NAME((short)4, "index_name"),
INDEX_OPTIONS((short)5, "index_options");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // VALIDATION_CLASS
return VALIDATION_CLASS;
case 3: // INDEX_TYPE
return INDEX_TYPE;
case 4: // INDEX_NAME
return INDEX_NAME;
case 5: // INDEX_OPTIONS
return INDEX_OPTIONS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.INDEX_TYPE,_Fields.INDEX_NAME,_Fields.INDEX_OPTIONS};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.VALIDATION_CLASS, new org.apache.thrift.meta_data.FieldMetaData("validation_class", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.INDEX_TYPE, new org.apache.thrift.meta_data.FieldMetaData("index_type", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, IndexType.class)));
tmpMap.put(_Fields.INDEX_NAME, new org.apache.thrift.meta_data.FieldMetaData("index_name", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.INDEX_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("index_options", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnDef.class, metaDataMap);
}
public ColumnDef() {
}
public ColumnDef(
ByteBuffer name,
String validation_class)
{
this();
this.name = name;
this.validation_class = validation_class;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ColumnDef(ColumnDef other) {
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
}
if (other.isSetValidation_class()) {
this.validation_class = other.validation_class;
}
if (other.isSetIndex_type()) {
this.index_type = other.index_type;
}
if (other.isSetIndex_name()) {
this.index_name = other.index_name;
}
if (other.isSetIndex_options()) {
Map<String,String> __this__index_options = new HashMap<String,String>(other.index_options);
this.index_options = __this__index_options;
}
}
public ColumnDef deepCopy() {
return new ColumnDef(this);
}
@Override
public void clear() {
this.name = null;
this.validation_class = null;
this.index_type = null;
this.index_name = null;
this.index_options = null;
}
public byte[] getName() {
setName(org.apache.thrift.TBaseHelper.rightSize(name));
return name == null ? null : name.array();
}
public ByteBuffer bufferForName() {
return name;
}
public ColumnDef setName(byte[] name) {
setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
return this;
}
public ColumnDef setName(ByteBuffer name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public String getValidation_class() {
return this.validation_class;
}
public ColumnDef setValidation_class(String validation_class) {
this.validation_class = validation_class;
return this;
}
public void unsetValidation_class() {
this.validation_class = null;
}
/** Returns true if field validation_class is set (has been assigned a value) and false otherwise */
public boolean isSetValidation_class() {
return this.validation_class != null;
}
public void setValidation_classIsSet(boolean value) {
if (!value) {
this.validation_class = null;
}
}
/**
*
* @see IndexType
*/
public IndexType getIndex_type() {
return this.index_type;
}
/**
*
* @see IndexType
*/
public ColumnDef setIndex_type(IndexType index_type) {
this.index_type = index_type;
return this;
}
public void unsetIndex_type() {
this.index_type = null;
}
/** Returns true if field index_type is set (has been assigned a value) and false otherwise */
public boolean isSetIndex_type() {
return this.index_type != null;
}
public void setIndex_typeIsSet(boolean value) {
if (!value) {
this.index_type = null;
}
}
public String getIndex_name() {
return this.index_name;
}
public ColumnDef setIndex_name(String index_name) {
this.index_name = index_name;
return this;
}
public void unsetIndex_name() {
this.index_name = null;
}
/** Returns true if field index_name is set (has been assigned a value) and false otherwise */
public boolean isSetIndex_name() {
return this.index_name != null;
}
public void setIndex_nameIsSet(boolean value) {
if (!value) {
this.index_name = null;
}
}
public int getIndex_optionsSize() {
return (this.index_options == null) ? 0 : this.index_options.size();
}
public void putToIndex_options(String key, String val) {
if (this.index_options == null) {
this.index_options = new HashMap<String,String>();
}
this.index_options.put(key, val);
}
public Map<String,String> getIndex_options() {
return this.index_options;
}
public ColumnDef setIndex_options(Map<String,String> index_options) {
this.index_options = index_options;
return this;
}
public void unsetIndex_options() {
this.index_options = null;
}
/** Returns true if field index_options is set (has been assigned a value) and false otherwise */
public boolean isSetIndex_options() {
return this.index_options != null;
}
public void setIndex_optionsIsSet(boolean value) {
if (!value) {
this.index_options = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((ByteBuffer)value);
}
break;
case VALIDATION_CLASS:
if (value == null) {
unsetValidation_class();
} else {
setValidation_class((String)value);
}
break;
case INDEX_TYPE:
if (value == null) {
unsetIndex_type();
} else {
setIndex_type((IndexType)value);
}
break;
case INDEX_NAME:
if (value == null) {
unsetIndex_name();
} else {
setIndex_name((String)value);
}
break;
case INDEX_OPTIONS:
if (value == null) {
unsetIndex_options();
} else {
setIndex_options((Map<String,String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case VALIDATION_CLASS:
return getValidation_class();
case INDEX_TYPE:
return getIndex_type();
case INDEX_NAME:
return getIndex_name();
case INDEX_OPTIONS:
return getIndex_options();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case VALIDATION_CLASS:
return isSetValidation_class();
case INDEX_TYPE:
return isSetIndex_type();
case INDEX_NAME:
return isSetIndex_name();
case INDEX_OPTIONS:
return isSetIndex_options();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ColumnDef)
return this.equals((ColumnDef)that);
return false;
}
public boolean equals(ColumnDef that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_validation_class = true && this.isSetValidation_class();
boolean that_present_validation_class = true && that.isSetValidation_class();
if (this_present_validation_class || that_present_validation_class) {
if (!(this_present_validation_class && that_present_validation_class))
return false;
if (!this.validation_class.equals(that.validation_class))
return false;
}
boolean this_present_index_type = true && this.isSetIndex_type();
boolean that_present_index_type = true && that.isSetIndex_type();
if (this_present_index_type || that_present_index_type) {
if (!(this_present_index_type && that_present_index_type))
return false;
if (!this.index_type.equals(that.index_type))
return false;
}
boolean this_present_index_name = true && this.isSetIndex_name();
boolean that_present_index_name = true && that.isSetIndex_name();
if (this_present_index_name || that_present_index_name) {
if (!(this_present_index_name && that_present_index_name))
return false;
if (!this.index_name.equals(that.index_name))
return false;
}
boolean this_present_index_options = true && this.isSetIndex_options();
boolean that_present_index_options = true && that.isSetIndex_options();
if (this_present_index_options || that_present_index_options) {
if (!(this_present_index_options && that_present_index_options))
return false;
if (!this.index_options.equals(that.index_options))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name = true && (isSetName());
builder.append(present_name);
if (present_name)
builder.append(name);
boolean present_validation_class = true && (isSetValidation_class());
builder.append(present_validation_class);
if (present_validation_class)
builder.append(validation_class);
boolean present_index_type = true && (isSetIndex_type());
builder.append(present_index_type);
if (present_index_type)
builder.append(index_type.getValue());
boolean present_index_name = true && (isSetIndex_name());
builder.append(present_index_name);
if (present_index_name)
builder.append(index_name);
boolean present_index_options = true && (isSetIndex_options());
builder.append(present_index_options);
if (present_index_options)
builder.append(index_options);
return builder.toHashCode();
}
@Override
public int compareTo(ColumnDef other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValidation_class()).compareTo(other.isSetValidation_class());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValidation_class()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validation_class, other.validation_class);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetIndex_type()).compareTo(other.isSetIndex_type());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndex_type()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_type, other.index_type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetIndex_name()).compareTo(other.isSetIndex_name());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndex_name()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_name, other.index_name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetIndex_options()).compareTo(other.isSetIndex_options());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIndex_options()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index_options, other.index_options);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ColumnDef(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.name, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("validation_class:");
if (this.validation_class == null) {
sb.append("null");
} else {
sb.append(this.validation_class);
}
first = false;
if (isSetIndex_type()) {
if (!first) sb.append(", ");
sb.append("index_type:");
if (this.index_type == null) {
sb.append("null");
} else {
sb.append(this.index_type);
}
first = false;
}
if (isSetIndex_name()) {
if (!first) sb.append(", ");
sb.append("index_name:");
if (this.index_name == null) {
sb.append("null");
} else {
sb.append(this.index_name);
}
first = false;
}
if (isSetIndex_options()) {
if (!first) sb.append(", ");
sb.append("index_options:");
if (this.index_options == null) {
sb.append("null");
} else {
sb.append(this.index_options);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
if (validation_class == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'validation_class' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ColumnDefStandardSchemeFactory implements SchemeFactory {
public ColumnDefStandardScheme getScheme() {
return new ColumnDefStandardScheme();
}
}
private static class ColumnDefStandardScheme extends StandardScheme<ColumnDef> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnDef struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // VALIDATION_CLASS
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.validation_class = iprot.readString();
struct.setValidation_classIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // INDEX_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.index_type = IndexType.findByValue(iprot.readI32());
struct.setIndex_typeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // INDEX_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.index_name = iprot.readString();
struct.setIndex_nameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // INDEX_OPTIONS
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map90 = iprot.readMapBegin();
struct.index_options = new HashMap<String,String>(2*_map90.size);
for (int _i91 = 0; _i91 < _map90.size; ++_i91)
{
String _key92;
String _val93;
_key92 = iprot.readString();
_val93 = iprot.readString();
struct.index_options.put(_key92, _val93);
}
iprot.readMapEnd();
}
struct.setIndex_optionsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ColumnDef struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeBinary(struct.name);
oprot.writeFieldEnd();
}
if (struct.validation_class != null) {
oprot.writeFieldBegin(VALIDATION_CLASS_FIELD_DESC);
oprot.writeString(struct.validation_class);
oprot.writeFieldEnd();
}
if (struct.index_type != null) {
if (struct.isSetIndex_type()) {
oprot.writeFieldBegin(INDEX_TYPE_FIELD_DESC);
oprot.writeI32(struct.index_type.getValue());
oprot.writeFieldEnd();
}
}
if (struct.index_name != null) {
if (struct.isSetIndex_name()) {
oprot.writeFieldBegin(INDEX_NAME_FIELD_DESC);
oprot.writeString(struct.index_name);
oprot.writeFieldEnd();
}
}
if (struct.index_options != null) {
if (struct.isSetIndex_options()) {
oprot.writeFieldBegin(INDEX_OPTIONS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.index_options.size()));
for (Map.Entry<String, String> _iter94 : struct.index_options.entrySet())
{
oprot.writeString(_iter94.getKey());
oprot.writeString(_iter94.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ColumnDefTupleSchemeFactory implements SchemeFactory {
public ColumnDefTupleScheme getScheme() {
return new ColumnDefTupleScheme();
}
}
private static class ColumnDefTupleScheme extends TupleScheme<ColumnDef> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ColumnDef struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.name);
oprot.writeString(struct.validation_class);
BitSet optionals = new BitSet();
if (struct.isSetIndex_type()) {
optionals.set(0);
}
if (struct.isSetIndex_name()) {
optionals.set(1);
}
if (struct.isSetIndex_options()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetIndex_type()) {
oprot.writeI32(struct.index_type.getValue());
}
if (struct.isSetIndex_name()) {
oprot.writeString(struct.index_name);
}
if (struct.isSetIndex_options()) {
{
oprot.writeI32(struct.index_options.size());
for (Map.Entry<String, String> _iter95 : struct.index_options.entrySet())
{
oprot.writeString(_iter95.getKey());
oprot.writeString(_iter95.getValue());
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ColumnDef struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
struct.validation_class = iprot.readString();
struct.setValidation_classIsSet(true);
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.index_type = IndexType.findByValue(iprot.readI32());
struct.setIndex_typeIsSet(true);
}
if (incoming.get(1)) {
struct.index_name = iprot.readString();
struct.setIndex_nameIsSet(true);
}
if (incoming.get(2)) {
{
org.apache.thrift.protocol.TMap _map96 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.index_options = new HashMap<String,String>(2*_map96.size);
for (int _i97 = 0; _i97 < _map96.size; ++_i97)
{
String _key98;
String _val99;
_key98 = iprot.readString();
_val99 = iprot.readString();
struct.index_options.put(_key98, _val99);
}
}
struct.setIndex_optionsIsSet(true);
}
}
}
}

View File

@ -1,758 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
/**
* 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.
*
* If the query was on a counter column family, you will either get a counter_column (instead of a column) or a
* counter_super_column (instead of a super_column)
*
* @param column. The Column returned by get() or get_slice().
* @param super_column. The SuperColumn returned by get() or get_slice().
* @param counter_column. The Counterolumn returned by get() or get_slice().
* @param counter_super_column. The CounterSuperColumn returned by get() or get_slice().
*/
public class ColumnOrSuperColumn implements org.apache.thrift.TBase<ColumnOrSuperColumn, ColumnOrSuperColumn._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnOrSuperColumn> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnOrSuperColumn");
private static final org.apache.thrift.protocol.TField COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("super_column", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final org.apache.thrift.protocol.TField COUNTER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_column", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final org.apache.thrift.protocol.TField COUNTER_SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_super_column", org.apache.thrift.protocol.TType.STRUCT, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ColumnOrSuperColumnStandardSchemeFactory());
schemes.put(TupleScheme.class, new ColumnOrSuperColumnTupleSchemeFactory());
}
public Column column; // optional
public SuperColumn super_column; // optional
public CounterColumn counter_column; // optional
public CounterSuperColumn counter_super_column; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN((short)1, "column"),
SUPER_COLUMN((short)2, "super_column"),
COUNTER_COLUMN((short)3, "counter_column"),
COUNTER_SUPER_COLUMN((short)4, "counter_super_column");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COLUMN
return COLUMN;
case 2: // SUPER_COLUMN
return SUPER_COLUMN;
case 3: // COUNTER_COLUMN
return COUNTER_COLUMN;
case 4: // COUNTER_SUPER_COLUMN
return COUNTER_SUPER_COLUMN;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.COLUMN,_Fields.SUPER_COLUMN,_Fields.COUNTER_COLUMN,_Fields.COUNTER_SUPER_COLUMN};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Column.class)));
tmpMap.put(_Fields.SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SuperColumn.class)));
tmpMap.put(_Fields.COUNTER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("counter_column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CounterColumn.class)));
tmpMap.put(_Fields.COUNTER_SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("counter_super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CounterSuperColumn.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnOrSuperColumn.class, metaDataMap);
}
public ColumnOrSuperColumn() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ColumnOrSuperColumn(ColumnOrSuperColumn other) {
if (other.isSetColumn()) {
this.column = new Column(other.column);
}
if (other.isSetSuper_column()) {
this.super_column = new SuperColumn(other.super_column);
}
if (other.isSetCounter_column()) {
this.counter_column = new CounterColumn(other.counter_column);
}
if (other.isSetCounter_super_column()) {
this.counter_super_column = new CounterSuperColumn(other.counter_super_column);
}
}
public ColumnOrSuperColumn deepCopy() {
return new ColumnOrSuperColumn(this);
}
@Override
public void clear() {
this.column = null;
this.super_column = null;
this.counter_column = null;
this.counter_super_column = null;
}
public Column getColumn() {
return this.column;
}
public ColumnOrSuperColumn setColumn(Column column) {
this.column = column;
return this;
}
public void unsetColumn() {
this.column = null;
}
/** Returns true if field column is set (has been assigned a value) and false otherwise */
public boolean isSetColumn() {
return this.column != null;
}
public void setColumnIsSet(boolean value) {
if (!value) {
this.column = null;
}
}
public SuperColumn getSuper_column() {
return this.super_column;
}
public ColumnOrSuperColumn setSuper_column(SuperColumn super_column) {
this.super_column = super_column;
return this;
}
public void unsetSuper_column() {
this.super_column = null;
}
/** Returns true if field super_column is set (has been assigned a value) and false otherwise */
public boolean isSetSuper_column() {
return this.super_column != null;
}
public void setSuper_columnIsSet(boolean value) {
if (!value) {
this.super_column = null;
}
}
public CounterColumn getCounter_column() {
return this.counter_column;
}
public ColumnOrSuperColumn setCounter_column(CounterColumn counter_column) {
this.counter_column = counter_column;
return this;
}
public void unsetCounter_column() {
this.counter_column = null;
}
/** Returns true if field counter_column is set (has been assigned a value) and false otherwise */
public boolean isSetCounter_column() {
return this.counter_column != null;
}
public void setCounter_columnIsSet(boolean value) {
if (!value) {
this.counter_column = null;
}
}
public CounterSuperColumn getCounter_super_column() {
return this.counter_super_column;
}
public ColumnOrSuperColumn setCounter_super_column(CounterSuperColumn counter_super_column) {
this.counter_super_column = counter_super_column;
return this;
}
public void unsetCounter_super_column() {
this.counter_super_column = null;
}
/** Returns true if field counter_super_column is set (has been assigned a value) and false otherwise */
public boolean isSetCounter_super_column() {
return this.counter_super_column != null;
}
public void setCounter_super_columnIsSet(boolean value) {
if (!value) {
this.counter_super_column = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN:
if (value == null) {
unsetColumn();
} else {
setColumn((Column)value);
}
break;
case SUPER_COLUMN:
if (value == null) {
unsetSuper_column();
} else {
setSuper_column((SuperColumn)value);
}
break;
case COUNTER_COLUMN:
if (value == null) {
unsetCounter_column();
} else {
setCounter_column((CounterColumn)value);
}
break;
case COUNTER_SUPER_COLUMN:
if (value == null) {
unsetCounter_super_column();
} else {
setCounter_super_column((CounterSuperColumn)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN:
return getColumn();
case SUPER_COLUMN:
return getSuper_column();
case COUNTER_COLUMN:
return getCounter_column();
case COUNTER_SUPER_COLUMN:
return getCounter_super_column();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN:
return isSetColumn();
case SUPER_COLUMN:
return isSetSuper_column();
case COUNTER_COLUMN:
return isSetCounter_column();
case COUNTER_SUPER_COLUMN:
return isSetCounter_super_column();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ColumnOrSuperColumn)
return this.equals((ColumnOrSuperColumn)that);
return false;
}
public boolean equals(ColumnOrSuperColumn that) {
if (that == null)
return false;
boolean this_present_column = true && this.isSetColumn();
boolean that_present_column = true && that.isSetColumn();
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
if (!this.column.equals(that.column))
return false;
}
boolean this_present_super_column = true && this.isSetSuper_column();
boolean that_present_super_column = true && that.isSetSuper_column();
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
if (!this.super_column.equals(that.super_column))
return false;
}
boolean this_present_counter_column = true && this.isSetCounter_column();
boolean that_present_counter_column = true && that.isSetCounter_column();
if (this_present_counter_column || that_present_counter_column) {
if (!(this_present_counter_column && that_present_counter_column))
return false;
if (!this.counter_column.equals(that.counter_column))
return false;
}
boolean this_present_counter_super_column = true && this.isSetCounter_super_column();
boolean that_present_counter_super_column = true && that.isSetCounter_super_column();
if (this_present_counter_super_column || that_present_counter_super_column) {
if (!(this_present_counter_super_column && that_present_counter_super_column))
return false;
if (!this.counter_super_column.equals(that.counter_super_column))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_column = true && (isSetColumn());
builder.append(present_column);
if (present_column)
builder.append(column);
boolean present_super_column = true && (isSetSuper_column());
builder.append(present_super_column);
if (present_super_column)
builder.append(super_column);
boolean present_counter_column = true && (isSetCounter_column());
builder.append(present_counter_column);
if (present_counter_column)
builder.append(counter_column);
boolean present_counter_super_column = true && (isSetCounter_super_column());
builder.append(present_counter_super_column);
if (present_counter_super_column)
builder.append(counter_super_column);
return builder.toHashCode();
}
@Override
public int compareTo(ColumnOrSuperColumn other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetColumn()).compareTo(other.isSetColumn());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, other.column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSuper_column()).compareTo(other.isSetSuper_column());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuper_column()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.super_column, other.super_column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCounter_column()).compareTo(other.isSetCounter_column());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCounter_column()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counter_column, other.counter_column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCounter_super_column()).compareTo(other.isSetCounter_super_column());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCounter_super_column()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counter_super_column, other.counter_super_column);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ColumnOrSuperColumn(");
boolean first = true;
if (isSetColumn()) {
sb.append("column:");
if (this.column == null) {
sb.append("null");
} else {
sb.append(this.column);
}
first = false;
}
if (isSetSuper_column()) {
if (!first) sb.append(", ");
sb.append("super_column:");
if (this.super_column == null) {
sb.append("null");
} else {
sb.append(this.super_column);
}
first = false;
}
if (isSetCounter_column()) {
if (!first) sb.append(", ");
sb.append("counter_column:");
if (this.counter_column == null) {
sb.append("null");
} else {
sb.append(this.counter_column);
}
first = false;
}
if (isSetCounter_super_column()) {
if (!first) sb.append(", ");
sb.append("counter_super_column:");
if (this.counter_super_column == null) {
sb.append("null");
} else {
sb.append(this.counter_super_column);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (column != null) {
column.validate();
}
if (super_column != null) {
super_column.validate();
}
if (counter_column != null) {
counter_column.validate();
}
if (counter_super_column != null) {
counter_super_column.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ColumnOrSuperColumnStandardSchemeFactory implements SchemeFactory {
public ColumnOrSuperColumnStandardScheme getScheme() {
return new ColumnOrSuperColumnStandardScheme();
}
}
private static class ColumnOrSuperColumnStandardScheme extends StandardScheme<ColumnOrSuperColumn> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.column = new Column();
struct.column.read(iprot);
struct.setColumnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // SUPER_COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.super_column = new SuperColumn();
struct.super_column.read(iprot);
struct.setSuper_columnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // COUNTER_COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.counter_column = new CounterColumn();
struct.counter_column.read(iprot);
struct.setCounter_columnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // COUNTER_SUPER_COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.counter_super_column = new CounterSuperColumn();
struct.counter_super_column.read(iprot);
struct.setCounter_super_columnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.column != null) {
if (struct.isSetColumn()) {
oprot.writeFieldBegin(COLUMN_FIELD_DESC);
struct.column.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.super_column != null) {
if (struct.isSetSuper_column()) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
struct.super_column.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.counter_column != null) {
if (struct.isSetCounter_column()) {
oprot.writeFieldBegin(COUNTER_COLUMN_FIELD_DESC);
struct.counter_column.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.counter_super_column != null) {
if (struct.isSetCounter_super_column()) {
oprot.writeFieldBegin(COUNTER_SUPER_COLUMN_FIELD_DESC);
struct.counter_super_column.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ColumnOrSuperColumnTupleSchemeFactory implements SchemeFactory {
public ColumnOrSuperColumnTupleScheme getScheme() {
return new ColumnOrSuperColumnTupleScheme();
}
}
private static class ColumnOrSuperColumnTupleScheme extends TupleScheme<ColumnOrSuperColumn> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetColumn()) {
optionals.set(0);
}
if (struct.isSetSuper_column()) {
optionals.set(1);
}
if (struct.isSetCounter_column()) {
optionals.set(2);
}
if (struct.isSetCounter_super_column()) {
optionals.set(3);
}
oprot.writeBitSet(optionals, 4);
if (struct.isSetColumn()) {
struct.column.write(oprot);
}
if (struct.isSetSuper_column()) {
struct.super_column.write(oprot);
}
if (struct.isSetCounter_column()) {
struct.counter_column.write(oprot);
}
if (struct.isSetCounter_super_column()) {
struct.counter_super_column.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ColumnOrSuperColumn struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(4);
if (incoming.get(0)) {
struct.column = new Column();
struct.column.read(iprot);
struct.setColumnIsSet(true);
}
if (incoming.get(1)) {
struct.super_column = new SuperColumn();
struct.super_column.read(iprot);
struct.setSuper_columnIsSet(true);
}
if (incoming.get(2)) {
struct.counter_column = new CounterColumn();
struct.counter_column.read(iprot);
struct.setCounter_columnIsSet(true);
}
if (incoming.get(3)) {
struct.counter_super_column = new CounterSuperColumn();
struct.counter_super_column.read(iprot);
struct.setCounter_super_columnIsSet(true);
}
}
}
}

View File

@ -1,538 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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>
*/
public class ColumnParent implements org.apache.thrift.TBase<ColumnParent, ColumnParent._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnParent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnParent");
private static final org.apache.thrift.protocol.TField COLUMN_FAMILY_FIELD_DESC = new org.apache.thrift.protocol.TField("column_family", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("super_column", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ColumnParentStandardSchemeFactory());
schemes.put(TupleScheme.class, new ColumnParentTupleSchemeFactory());
}
public String column_family; // required
public ByteBuffer super_column; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN_FAMILY((short)3, "column_family"),
SUPER_COLUMN((short)4, "super_column");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 3: // COLUMN_FAMILY
return COLUMN_FAMILY;
case 4: // SUPER_COLUMN
return SUPER_COLUMN;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.SUPER_COLUMN};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN_FAMILY, new org.apache.thrift.meta_data.FieldMetaData("column_family", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnParent.class, metaDataMap);
}
public ColumnParent() {
}
public ColumnParent(
String column_family)
{
this();
this.column_family = column_family;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ColumnParent(ColumnParent other) {
if (other.isSetColumn_family()) {
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
this.super_column = org.apache.thrift.TBaseHelper.copyBinary(other.super_column);
;
}
}
public ColumnParent deepCopy() {
return new ColumnParent(this);
}
@Override
public void clear() {
this.column_family = null;
this.super_column = null;
}
public String getColumn_family() {
return this.column_family;
}
public ColumnParent setColumn_family(String column_family) {
this.column_family = column_family;
return this;
}
public void unsetColumn_family() {
this.column_family = null;
}
/** Returns true if field column_family is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_family() {
return this.column_family != null;
}
public void setColumn_familyIsSet(boolean value) {
if (!value) {
this.column_family = null;
}
}
public byte[] getSuper_column() {
setSuper_column(org.apache.thrift.TBaseHelper.rightSize(super_column));
return super_column == null ? null : super_column.array();
}
public ByteBuffer bufferForSuper_column() {
return super_column;
}
public ColumnParent setSuper_column(byte[] super_column) {
setSuper_column(super_column == null ? (ByteBuffer)null : ByteBuffer.wrap(super_column));
return this;
}
public ColumnParent setSuper_column(ByteBuffer super_column) {
this.super_column = super_column;
return this;
}
public void unsetSuper_column() {
this.super_column = null;
}
/** Returns true if field super_column is set (has been assigned a value) and false otherwise */
public boolean isSetSuper_column() {
return this.super_column != null;
}
public void setSuper_columnIsSet(boolean value) {
if (!value) {
this.super_column = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN_FAMILY:
if (value == null) {
unsetColumn_family();
} else {
setColumn_family((String)value);
}
break;
case SUPER_COLUMN:
if (value == null) {
unsetSuper_column();
} else {
setSuper_column((ByteBuffer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_FAMILY:
return getColumn_family();
case SUPER_COLUMN:
return getSuper_column();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_FAMILY:
return isSetColumn_family();
case SUPER_COLUMN:
return isSetSuper_column();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ColumnParent)
return this.equals((ColumnParent)that);
return false;
}
public boolean equals(ColumnParent that) {
if (that == null)
return false;
boolean this_present_column_family = true && this.isSetColumn_family();
boolean that_present_column_family = true && that.isSetColumn_family();
if (this_present_column_family || that_present_column_family) {
if (!(this_present_column_family && that_present_column_family))
return false;
if (!this.column_family.equals(that.column_family))
return false;
}
boolean this_present_super_column = true && this.isSetSuper_column();
boolean that_present_super_column = true && that.isSetSuper_column();
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
if (!this.super_column.equals(that.super_column))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_column_family = true && (isSetColumn_family());
builder.append(present_column_family);
if (present_column_family)
builder.append(column_family);
boolean present_super_column = true && (isSetSuper_column());
builder.append(present_super_column);
if (present_super_column)
builder.append(super_column);
return builder.toHashCode();
}
@Override
public int compareTo(ColumnParent other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetColumn_family()).compareTo(other.isSetColumn_family());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn_family()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_family, other.column_family);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSuper_column()).compareTo(other.isSetSuper_column());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuper_column()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.super_column, other.super_column);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ColumnParent(");
boolean first = true;
sb.append("column_family:");
if (this.column_family == null) {
sb.append("null");
} else {
sb.append(this.column_family);
}
first = false;
if (isSetSuper_column()) {
if (!first) sb.append(", ");
sb.append("super_column:");
if (this.super_column == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.super_column, sb);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (column_family == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'column_family' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ColumnParentStandardSchemeFactory implements SchemeFactory {
public ColumnParentStandardScheme getScheme() {
return new ColumnParentStandardScheme();
}
}
private static class ColumnParentStandardScheme extends StandardScheme<ColumnParent> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnParent struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 3: // COLUMN_FAMILY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.column_family = iprot.readString();
struct.setColumn_familyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // SUPER_COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.super_column = iprot.readBinary();
struct.setSuper_columnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ColumnParent struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.column_family != null) {
oprot.writeFieldBegin(COLUMN_FAMILY_FIELD_DESC);
oprot.writeString(struct.column_family);
oprot.writeFieldEnd();
}
if (struct.super_column != null) {
if (struct.isSetSuper_column()) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
oprot.writeBinary(struct.super_column);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ColumnParentTupleSchemeFactory implements SchemeFactory {
public ColumnParentTupleScheme getScheme() {
return new ColumnParentTupleScheme();
}
}
private static class ColumnParentTupleScheme extends TupleScheme<ColumnParent> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ColumnParent struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.column_family);
BitSet optionals = new BitSet();
if (struct.isSetSuper_column()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuper_column()) {
oprot.writeBinary(struct.super_column);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ColumnParent struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.column_family = iprot.readString();
struct.setColumn_familyIsSet(true);
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.super_column = iprot.readBinary();
struct.setSuper_columnIsSet(true);
}
}
}
}

View File

@ -1,648 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
/**
* 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.
*/
public class ColumnPath implements org.apache.thrift.TBase<ColumnPath, ColumnPath._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnPath> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnPath");
private static final org.apache.thrift.protocol.TField COLUMN_FAMILY_FIELD_DESC = new org.apache.thrift.protocol.TField("column_family", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("super_column", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ColumnPathStandardSchemeFactory());
schemes.put(TupleScheme.class, new ColumnPathTupleSchemeFactory());
}
public String column_family; // required
public ByteBuffer super_column; // optional
public ByteBuffer column; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN_FAMILY((short)3, "column_family"),
SUPER_COLUMN((short)4, "super_column"),
COLUMN((short)5, "column");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 3: // COLUMN_FAMILY
return COLUMN_FAMILY;
case 4: // SUPER_COLUMN
return SUPER_COLUMN;
case 5: // COLUMN
return COLUMN;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.SUPER_COLUMN,_Fields.COLUMN};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN_FAMILY, new org.apache.thrift.meta_data.FieldMetaData("column_family", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnPath.class, metaDataMap);
}
public ColumnPath() {
}
public ColumnPath(
String column_family)
{
this();
this.column_family = column_family;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ColumnPath(ColumnPath other) {
if (other.isSetColumn_family()) {
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
this.super_column = org.apache.thrift.TBaseHelper.copyBinary(other.super_column);
;
}
if (other.isSetColumn()) {
this.column = org.apache.thrift.TBaseHelper.copyBinary(other.column);
;
}
}
public ColumnPath deepCopy() {
return new ColumnPath(this);
}
@Override
public void clear() {
this.column_family = null;
this.super_column = null;
this.column = null;
}
public String getColumn_family() {
return this.column_family;
}
public ColumnPath setColumn_family(String column_family) {
this.column_family = column_family;
return this;
}
public void unsetColumn_family() {
this.column_family = null;
}
/** Returns true if field column_family is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_family() {
return this.column_family != null;
}
public void setColumn_familyIsSet(boolean value) {
if (!value) {
this.column_family = null;
}
}
public byte[] getSuper_column() {
setSuper_column(org.apache.thrift.TBaseHelper.rightSize(super_column));
return super_column == null ? null : super_column.array();
}
public ByteBuffer bufferForSuper_column() {
return super_column;
}
public ColumnPath setSuper_column(byte[] super_column) {
setSuper_column(super_column == null ? (ByteBuffer)null : ByteBuffer.wrap(super_column));
return this;
}
public ColumnPath setSuper_column(ByteBuffer super_column) {
this.super_column = super_column;
return this;
}
public void unsetSuper_column() {
this.super_column = null;
}
/** Returns true if field super_column is set (has been assigned a value) and false otherwise */
public boolean isSetSuper_column() {
return this.super_column != null;
}
public void setSuper_columnIsSet(boolean value) {
if (!value) {
this.super_column = null;
}
}
public byte[] getColumn() {
setColumn(org.apache.thrift.TBaseHelper.rightSize(column));
return column == null ? null : column.array();
}
public ByteBuffer bufferForColumn() {
return column;
}
public ColumnPath setColumn(byte[] column) {
setColumn(column == null ? (ByteBuffer)null : ByteBuffer.wrap(column));
return this;
}
public ColumnPath setColumn(ByteBuffer column) {
this.column = column;
return this;
}
public void unsetColumn() {
this.column = null;
}
/** Returns true if field column is set (has been assigned a value) and false otherwise */
public boolean isSetColumn() {
return this.column != null;
}
public void setColumnIsSet(boolean value) {
if (!value) {
this.column = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN_FAMILY:
if (value == null) {
unsetColumn_family();
} else {
setColumn_family((String)value);
}
break;
case SUPER_COLUMN:
if (value == null) {
unsetSuper_column();
} else {
setSuper_column((ByteBuffer)value);
}
break;
case COLUMN:
if (value == null) {
unsetColumn();
} else {
setColumn((ByteBuffer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_FAMILY:
return getColumn_family();
case SUPER_COLUMN:
return getSuper_column();
case COLUMN:
return getColumn();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_FAMILY:
return isSetColumn_family();
case SUPER_COLUMN:
return isSetSuper_column();
case COLUMN:
return isSetColumn();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ColumnPath)
return this.equals((ColumnPath)that);
return false;
}
public boolean equals(ColumnPath that) {
if (that == null)
return false;
boolean this_present_column_family = true && this.isSetColumn_family();
boolean that_present_column_family = true && that.isSetColumn_family();
if (this_present_column_family || that_present_column_family) {
if (!(this_present_column_family && that_present_column_family))
return false;
if (!this.column_family.equals(that.column_family))
return false;
}
boolean this_present_super_column = true && this.isSetSuper_column();
boolean that_present_super_column = true && that.isSetSuper_column();
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
if (!this.super_column.equals(that.super_column))
return false;
}
boolean this_present_column = true && this.isSetColumn();
boolean that_present_column = true && that.isSetColumn();
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
if (!this.column.equals(that.column))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_column_family = true && (isSetColumn_family());
builder.append(present_column_family);
if (present_column_family)
builder.append(column_family);
boolean present_super_column = true && (isSetSuper_column());
builder.append(present_super_column);
if (present_super_column)
builder.append(super_column);
boolean present_column = true && (isSetColumn());
builder.append(present_column);
if (present_column)
builder.append(column);
return builder.toHashCode();
}
@Override
public int compareTo(ColumnPath other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetColumn_family()).compareTo(other.isSetColumn_family());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn_family()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_family, other.column_family);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSuper_column()).compareTo(other.isSetSuper_column());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuper_column()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.super_column, other.super_column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumn()).compareTo(other.isSetColumn());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, other.column);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ColumnPath(");
boolean first = true;
sb.append("column_family:");
if (this.column_family == null) {
sb.append("null");
} else {
sb.append(this.column_family);
}
first = false;
if (isSetSuper_column()) {
if (!first) sb.append(", ");
sb.append("super_column:");
if (this.super_column == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.super_column, sb);
}
first = false;
}
if (isSetColumn()) {
if (!first) sb.append(", ");
sb.append("column:");
if (this.column == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.column, sb);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (column_family == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'column_family' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ColumnPathStandardSchemeFactory implements SchemeFactory {
public ColumnPathStandardScheme getScheme() {
return new ColumnPathStandardScheme();
}
}
private static class ColumnPathStandardScheme extends StandardScheme<ColumnPath> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnPath struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 3: // COLUMN_FAMILY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.column_family = iprot.readString();
struct.setColumn_familyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // SUPER_COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.super_column = iprot.readBinary();
struct.setSuper_columnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.column = iprot.readBinary();
struct.setColumnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ColumnPath struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.column_family != null) {
oprot.writeFieldBegin(COLUMN_FAMILY_FIELD_DESC);
oprot.writeString(struct.column_family);
oprot.writeFieldEnd();
}
if (struct.super_column != null) {
if (struct.isSetSuper_column()) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
oprot.writeBinary(struct.super_column);
oprot.writeFieldEnd();
}
}
if (struct.column != null) {
if (struct.isSetColumn()) {
oprot.writeFieldBegin(COLUMN_FIELD_DESC);
oprot.writeBinary(struct.column);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ColumnPathTupleSchemeFactory implements SchemeFactory {
public ColumnPathTupleScheme getScheme() {
return new ColumnPathTupleScheme();
}
}
private static class ColumnPathTupleScheme extends TupleScheme<ColumnPath> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ColumnPath struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.column_family);
BitSet optionals = new BitSet();
if (struct.isSetSuper_column()) {
optionals.set(0);
}
if (struct.isSetColumn()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetSuper_column()) {
oprot.writeBinary(struct.super_column);
}
if (struct.isSetColumn()) {
oprot.writeBinary(struct.column);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ColumnPath struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.column_family = iprot.readString();
struct.setColumn_familyIsSet(true);
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.super_column = iprot.readBinary();
struct.setSuper_columnIsSet(true);
}
if (incoming.get(1)) {
struct.column = iprot.readBinary();
struct.setColumnIsSet(true);
}
}
}
}

View File

@ -1,551 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The ColumnSlice is used to select a set of columns from inside a row.
* If start or finish are unspecified they will default to the start-of
* end-of value.
* @param start. The start of the ColumnSlice inclusive
* @param finish. The end of the ColumnSlice inclusive
*/
public class ColumnSlice implements org.apache.thrift.TBase<ColumnSlice, ColumnSlice._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnSlice> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnSlice");
private static final org.apache.thrift.protocol.TField START_FIELD_DESC = new org.apache.thrift.protocol.TField("start", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField FINISH_FIELD_DESC = new org.apache.thrift.protocol.TField("finish", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ColumnSliceStandardSchemeFactory());
schemes.put(TupleScheme.class, new ColumnSliceTupleSchemeFactory());
}
public ByteBuffer start; // optional
public ByteBuffer finish; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
START((short)1, "start"),
FINISH((short)2, "finish");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // START
return START;
case 2: // FINISH
return FINISH;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.START,_Fields.FINISH};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.START, new org.apache.thrift.meta_data.FieldMetaData("start", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.FINISH, new org.apache.thrift.meta_data.FieldMetaData("finish", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnSlice.class, metaDataMap);
}
public ColumnSlice() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ColumnSlice(ColumnSlice other) {
if (other.isSetStart()) {
this.start = org.apache.thrift.TBaseHelper.copyBinary(other.start);
;
}
if (other.isSetFinish()) {
this.finish = org.apache.thrift.TBaseHelper.copyBinary(other.finish);
;
}
}
public ColumnSlice deepCopy() {
return new ColumnSlice(this);
}
@Override
public void clear() {
this.start = null;
this.finish = null;
}
public byte[] getStart() {
setStart(org.apache.thrift.TBaseHelper.rightSize(start));
return start == null ? null : start.array();
}
public ByteBuffer bufferForStart() {
return start;
}
public ColumnSlice setStart(byte[] start) {
setStart(start == null ? (ByteBuffer)null : ByteBuffer.wrap(start));
return this;
}
public ColumnSlice setStart(ByteBuffer start) {
this.start = start;
return this;
}
public void unsetStart() {
this.start = null;
}
/** Returns true if field start is set (has been assigned a value) and false otherwise */
public boolean isSetStart() {
return this.start != null;
}
public void setStartIsSet(boolean value) {
if (!value) {
this.start = null;
}
}
public byte[] getFinish() {
setFinish(org.apache.thrift.TBaseHelper.rightSize(finish));
return finish == null ? null : finish.array();
}
public ByteBuffer bufferForFinish() {
return finish;
}
public ColumnSlice setFinish(byte[] finish) {
setFinish(finish == null ? (ByteBuffer)null : ByteBuffer.wrap(finish));
return this;
}
public ColumnSlice setFinish(ByteBuffer finish) {
this.finish = finish;
return this;
}
public void unsetFinish() {
this.finish = null;
}
/** Returns true if field finish is set (has been assigned a value) and false otherwise */
public boolean isSetFinish() {
return this.finish != null;
}
public void setFinishIsSet(boolean value) {
if (!value) {
this.finish = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case START:
if (value == null) {
unsetStart();
} else {
setStart((ByteBuffer)value);
}
break;
case FINISH:
if (value == null) {
unsetFinish();
} else {
setFinish((ByteBuffer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case START:
return getStart();
case FINISH:
return getFinish();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case START:
return isSetStart();
case FINISH:
return isSetFinish();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ColumnSlice)
return this.equals((ColumnSlice)that);
return false;
}
public boolean equals(ColumnSlice that) {
if (that == null)
return false;
boolean this_present_start = true && this.isSetStart();
boolean that_present_start = true && that.isSetStart();
if (this_present_start || that_present_start) {
if (!(this_present_start && that_present_start))
return false;
if (!this.start.equals(that.start))
return false;
}
boolean this_present_finish = true && this.isSetFinish();
boolean that_present_finish = true && that.isSetFinish();
if (this_present_finish || that_present_finish) {
if (!(this_present_finish && that_present_finish))
return false;
if (!this.finish.equals(that.finish))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_start = true && (isSetStart());
builder.append(present_start);
if (present_start)
builder.append(start);
boolean present_finish = true && (isSetFinish());
builder.append(present_finish);
if (present_finish)
builder.append(finish);
return builder.toHashCode();
}
@Override
public int compareTo(ColumnSlice other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetStart()).compareTo(other.isSetStart());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStart()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start, other.start);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFinish()).compareTo(other.isSetFinish());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFinish()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.finish, other.finish);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ColumnSlice(");
boolean first = true;
if (isSetStart()) {
sb.append("start:");
if (this.start == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.start, sb);
}
first = false;
}
if (isSetFinish()) {
if (!first) sb.append(", ");
sb.append("finish:");
if (this.finish == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.finish, sb);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ColumnSliceStandardSchemeFactory implements SchemeFactory {
public ColumnSliceStandardScheme getScheme() {
return new ColumnSliceStandardScheme();
}
}
private static class ColumnSliceStandardScheme extends StandardScheme<ColumnSlice> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnSlice struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // START
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.start = iprot.readBinary();
struct.setStartIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // FINISH
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.finish = iprot.readBinary();
struct.setFinishIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ColumnSlice struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.start != null) {
if (struct.isSetStart()) {
oprot.writeFieldBegin(START_FIELD_DESC);
oprot.writeBinary(struct.start);
oprot.writeFieldEnd();
}
}
if (struct.finish != null) {
if (struct.isSetFinish()) {
oprot.writeFieldBegin(FINISH_FIELD_DESC);
oprot.writeBinary(struct.finish);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ColumnSliceTupleSchemeFactory implements SchemeFactory {
public ColumnSliceTupleScheme getScheme() {
return new ColumnSliceTupleScheme();
}
}
private static class ColumnSliceTupleScheme extends TupleScheme<ColumnSlice> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ColumnSlice struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetStart()) {
optionals.set(0);
}
if (struct.isSetFinish()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetStart()) {
oprot.writeBinary(struct.start);
}
if (struct.isSetFinish()) {
oprot.writeBinary(struct.finish);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ColumnSlice struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.start = iprot.readBinary();
struct.setStartIsSet(true);
}
if (incoming.get(1)) {
struct.finish = iprot.readBinary();
struct.setFinishIsSet(true);
}
}
}
}

View File

@ -1,69 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
/**
* CQL query compression
*/
public enum Compression implements org.apache.thrift.TEnum {
GZIP(1),
NONE(2);
private final int value;
private Compression(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static Compression findByValue(int value) {
switch (value) {
case 1:
return GZIP;
case 2:
return NONE;
default:
return null;
}
}
}

View File

@ -1,137 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
/**
* The ConsistencyLevel is an enum that controls both read and write
* behavior based on the ReplicationFactor of the keyspace. The
* different consistency levels have different meanings, depending on
* if you're doing a write or read operation.
*
* 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.
*
* Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number
* of replicas rather than a logical concept that adjusts
* automatically with the replication factor. Of these, only ONE is
* commonly used; TWO and (even more rarely) THREE are only useful
* when you care more about guaranteeing a certain level of
* durability, than consistency.
*
* Write consistency levels make the following guarantees before reporting success to the client:
* 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
* TWO Ensure that the write has been written to at least 2 node's commit log and memory table
* THREE Ensure that the write has been written to at least 3 node's commit log and memory table
* QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes
* LOCAL_ONE Ensure that the write has been written to 1 node within the local datacenter (requires NetworkTopologyStrategy)
* LOCAL_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
* EACH_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
* ALL Ensure that the write is written to <code>&lt;ReplicationFactor&gt;</code> nodes before responding to the client.
*
* Read consistency levels make the following guarantees before returning successful results to the client:
* ANY Not supported. You probably want ONE instead.
* ONE Returns the record obtained from a single replica.
* TWO Returns the record with the most recent timestamp once two replicas have replied.
* THREE Returns the record with the most recent timestamp once three replicas have replied.
* QUORUM Returns the record with the most recent timestamp once a majority of replicas have replied.
* LOCAL_ONE Returns the record with the most recent timestamp once a single replica within the local datacenter have replied.
* LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied.
* EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied.
* ALL Returns the record with the most recent timestamp once all replicas have replied (implies no replica may be down)..
*/
public enum ConsistencyLevel implements org.apache.thrift.TEnum {
ONE(1),
QUORUM(2),
LOCAL_QUORUM(3),
EACH_QUORUM(4),
ALL(5),
ANY(6),
TWO(7),
THREE(8),
SERIAL(9),
LOCAL_SERIAL(10),
LOCAL_ONE(11);
private final int value;
private ConsistencyLevel(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static ConsistencyLevel findByValue(int value) {
switch (value) {
case 1:
return ONE;
case 2:
return QUORUM;
case 3:
return LOCAL_QUORUM;
case 4:
return EACH_QUORUM;
case 5:
return ALL;
case 6:
return ANY;
case 7:
return TWO;
case 8:
return THREE;
case 9:
return SERIAL;
case 10:
return LOCAL_SERIAL;
case 11:
return LOCAL_ONE;
default:
return null;
}
}
}

View File

@ -1,520 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, CounterColumn._Fields>, java.io.Serializable, Cloneable, Comparable<CounterColumn> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CounterColumn");
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.I64, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CounterColumnStandardSchemeFactory());
schemes.put(TupleScheme.class, new CounterColumnTupleSchemeFactory());
}
public ByteBuffer name; // required
public long value; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME((short)1, "name"),
VALUE((short)2, "value");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // VALUE
return VALUE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __VALUE_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CounterColumn.class, metaDataMap);
}
public CounterColumn() {
}
public CounterColumn(
ByteBuffer name,
long value)
{
this();
this.name = name;
this.value = value;
setValueIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CounterColumn(CounterColumn other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
}
this.value = other.value;
}
public CounterColumn deepCopy() {
return new CounterColumn(this);
}
@Override
public void clear() {
this.name = null;
setValueIsSet(false);
this.value = 0;
}
public byte[] getName() {
setName(org.apache.thrift.TBaseHelper.rightSize(name));
return name == null ? null : name.array();
}
public ByteBuffer bufferForName() {
return name;
}
public CounterColumn setName(byte[] name) {
setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
return this;
}
public CounterColumn setName(ByteBuffer name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public long getValue() {
return this.value;
}
public CounterColumn setValue(long value) {
this.value = value;
setValueIsSet(true);
return this;
}
public void unsetValue() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUE_ISSET_ID);
}
/** Returns true if field value is set (has been assigned a value) and false otherwise */
public boolean isSetValue() {
return EncodingUtils.testBit(__isset_bitfield, __VALUE_ISSET_ID);
}
public void setValueIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUE_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((ByteBuffer)value);
}
break;
case VALUE:
if (value == null) {
unsetValue();
} else {
setValue((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case VALUE:
return Long.valueOf(getValue());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case VALUE:
return isSetValue();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CounterColumn)
return this.equals((CounterColumn)that);
return false;
}
public boolean equals(CounterColumn that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_value = true;
boolean that_present_value = true;
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
if (this.value != that.value)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name = true && (isSetName());
builder.append(present_name);
if (present_name)
builder.append(name);
boolean present_value = true;
builder.append(present_value);
if (present_value)
builder.append(value);
return builder.toHashCode();
}
@Override
public int compareTo(CounterColumn other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CounterColumn(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.name, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("value:");
sb.append(this.value);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
// alas, we cannot check 'value' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CounterColumnStandardSchemeFactory implements SchemeFactory {
public CounterColumnStandardScheme getScheme() {
return new CounterColumnStandardScheme();
}
}
private static class CounterColumnStandardScheme extends StandardScheme<CounterColumn> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CounterColumn struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // VALUE
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.value = iprot.readI64();
struct.setValueIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetValue()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CounterColumn struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeBinary(struct.name);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeI64(struct.value);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CounterColumnTupleSchemeFactory implements SchemeFactory {
public CounterColumnTupleScheme getScheme() {
return new CounterColumnTupleScheme();
}
}
private static class CounterColumnTupleScheme extends TupleScheme<CounterColumn> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CounterColumn struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.name);
oprot.writeI64(struct.value);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CounterColumn struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
struct.value = iprot.readI64();
struct.setValueIsSet(true);
}
}
}

View File

@ -1,576 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CounterSuperColumn implements org.apache.thrift.TBase<CounterSuperColumn, CounterSuperColumn._Fields>, java.io.Serializable, Cloneable, Comparable<CounterSuperColumn> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CounterSuperColumn");
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CounterSuperColumnStandardSchemeFactory());
schemes.put(TupleScheme.class, new CounterSuperColumnTupleSchemeFactory());
}
public ByteBuffer name; // required
public List<CounterColumn> columns; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME((short)1, "name"),
COLUMNS((short)2, "columns");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // COLUMNS
return COLUMNS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CounterColumn.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CounterSuperColumn.class, metaDataMap);
}
public CounterSuperColumn() {
}
public CounterSuperColumn(
ByteBuffer name,
List<CounterColumn> columns)
{
this();
this.name = name;
this.columns = columns;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CounterSuperColumn(CounterSuperColumn other) {
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
}
if (other.isSetColumns()) {
List<CounterColumn> __this__columns = new ArrayList<CounterColumn>(other.columns.size());
for (CounterColumn other_element : other.columns) {
__this__columns.add(new CounterColumn(other_element));
}
this.columns = __this__columns;
}
}
public CounterSuperColumn deepCopy() {
return new CounterSuperColumn(this);
}
@Override
public void clear() {
this.name = null;
this.columns = null;
}
public byte[] getName() {
setName(org.apache.thrift.TBaseHelper.rightSize(name));
return name == null ? null : name.array();
}
public ByteBuffer bufferForName() {
return name;
}
public CounterSuperColumn setName(byte[] name) {
setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
return this;
}
public CounterSuperColumn setName(ByteBuffer name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public int getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
public java.util.Iterator<CounterColumn> getColumnsIterator() {
return (this.columns == null) ? null : this.columns.iterator();
}
public void addToColumns(CounterColumn elem) {
if (this.columns == null) {
this.columns = new ArrayList<CounterColumn>();
}
this.columns.add(elem);
}
public List<CounterColumn> getColumns() {
return this.columns;
}
public CounterSuperColumn setColumns(List<CounterColumn> columns) {
this.columns = columns;
return this;
}
public void unsetColumns() {
this.columns = null;
}
/** Returns true if field columns is set (has been assigned a value) and false otherwise */
public boolean isSetColumns() {
return this.columns != null;
}
public void setColumnsIsSet(boolean value) {
if (!value) {
this.columns = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((ByteBuffer)value);
}
break;
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((List<CounterColumn>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case COLUMNS:
return getColumns();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case COLUMNS:
return isSetColumns();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CounterSuperColumn)
return this.equals((CounterSuperColumn)that);
return false;
}
public boolean equals(CounterSuperColumn that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_columns = true && this.isSetColumns();
boolean that_present_columns = true && that.isSetColumns();
if (this_present_columns || that_present_columns) {
if (!(this_present_columns && that_present_columns))
return false;
if (!this.columns.equals(that.columns))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name = true && (isSetName());
builder.append(present_name);
if (present_name)
builder.append(name);
boolean present_columns = true && (isSetColumns());
builder.append(present_columns);
if (present_columns)
builder.append(columns);
return builder.toHashCode();
}
@Override
public int compareTo(CounterSuperColumn other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CounterSuperColumn(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.name, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("columns:");
if (this.columns == null) {
sb.append("null");
} else {
sb.append(this.columns);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
if (columns == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CounterSuperColumnStandardSchemeFactory implements SchemeFactory {
public CounterSuperColumnStandardScheme getScheme() {
return new CounterSuperColumnStandardScheme();
}
}
private static class CounterSuperColumnStandardScheme extends StandardScheme<CounterSuperColumn> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CounterSuperColumn struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COLUMNS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
struct.columns = new ArrayList<CounterColumn>(_list8.size);
for (int _i9 = 0; _i9 < _list8.size; ++_i9)
{
CounterColumn _elem10;
_elem10 = new CounterColumn();
_elem10.read(iprot);
struct.columns.add(_elem10);
}
iprot.readListEnd();
}
struct.setColumnsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CounterSuperColumn struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeBinary(struct.name);
oprot.writeFieldEnd();
}
if (struct.columns != null) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
for (CounterColumn _iter11 : struct.columns)
{
_iter11.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CounterSuperColumnTupleSchemeFactory implements SchemeFactory {
public CounterSuperColumnTupleScheme getScheme() {
return new CounterSuperColumnTupleScheme();
}
}
private static class CounterSuperColumnTupleScheme extends TupleScheme<CounterSuperColumn> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CounterSuperColumn struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.name);
{
oprot.writeI32(struct.columns.size());
for (CounterColumn _iter12 : struct.columns)
{
_iter12.write(oprot);
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CounterSuperColumn struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
{
org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.columns = new ArrayList<CounterColumn>(_list13.size);
for (int _i14 = 0; _i14 < _list13.size; ++_i14)
{
CounterColumn _elem15;
_elem15 = new CounterColumn();
_elem15.read(iprot);
struct.columns.add(_elem15);
}
}
struct.setColumnsIsSet(true);
}
}
}

View File

@ -1,817 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMetadata._Fields>, java.io.Serializable, Cloneable, Comparable<CqlMetadata> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CqlMetadata");
private static final org.apache.thrift.protocol.TField NAME_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("name_types", org.apache.thrift.protocol.TType.MAP, (short)1);
private static final org.apache.thrift.protocol.TField VALUE_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("value_types", org.apache.thrift.protocol.TType.MAP, (short)2);
private static final org.apache.thrift.protocol.TField DEFAULT_NAME_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("default_name_type", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField DEFAULT_VALUE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("default_value_type", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CqlMetadataStandardSchemeFactory());
schemes.put(TupleScheme.class, new CqlMetadataTupleSchemeFactory());
}
public Map<ByteBuffer,String> name_types; // required
public Map<ByteBuffer,String> value_types; // required
public String default_name_type; // required
public String default_value_type; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME_TYPES((short)1, "name_types"),
VALUE_TYPES((short)2, "value_types"),
DEFAULT_NAME_TYPE((short)3, "default_name_type"),
DEFAULT_VALUE_TYPE((short)4, "default_value_type");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME_TYPES
return NAME_TYPES;
case 2: // VALUE_TYPES
return VALUE_TYPES;
case 3: // DEFAULT_NAME_TYPE
return DEFAULT_NAME_TYPE;
case 4: // DEFAULT_VALUE_TYPE
return DEFAULT_VALUE_TYPE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME_TYPES, new org.apache.thrift.meta_data.FieldMetaData("name_types", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.VALUE_TYPES, new org.apache.thrift.meta_data.FieldMetaData("value_types", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.DEFAULT_NAME_TYPE, new org.apache.thrift.meta_data.FieldMetaData("default_name_type", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.DEFAULT_VALUE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("default_value_type", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CqlMetadata.class, metaDataMap);
}
public CqlMetadata() {
}
public CqlMetadata(
Map<ByteBuffer,String> name_types,
Map<ByteBuffer,String> value_types,
String default_name_type,
String default_value_type)
{
this();
this.name_types = name_types;
this.value_types = value_types;
this.default_name_type = default_name_type;
this.default_value_type = default_value_type;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CqlMetadata(CqlMetadata other) {
if (other.isSetName_types()) {
Map<ByteBuffer,String> __this__name_types = new HashMap<ByteBuffer,String>(other.name_types);
this.name_types = __this__name_types;
}
if (other.isSetValue_types()) {
Map<ByteBuffer,String> __this__value_types = new HashMap<ByteBuffer,String>(other.value_types);
this.value_types = __this__value_types;
}
if (other.isSetDefault_name_type()) {
this.default_name_type = other.default_name_type;
}
if (other.isSetDefault_value_type()) {
this.default_value_type = other.default_value_type;
}
}
public CqlMetadata deepCopy() {
return new CqlMetadata(this);
}
@Override
public void clear() {
this.name_types = null;
this.value_types = null;
this.default_name_type = null;
this.default_value_type = null;
}
public int getName_typesSize() {
return (this.name_types == null) ? 0 : this.name_types.size();
}
public void putToName_types(ByteBuffer key, String val) {
if (this.name_types == null) {
this.name_types = new HashMap<ByteBuffer,String>();
}
this.name_types.put(key, val);
}
public Map<ByteBuffer,String> getName_types() {
return this.name_types;
}
public CqlMetadata setName_types(Map<ByteBuffer,String> name_types) {
this.name_types = name_types;
return this;
}
public void unsetName_types() {
this.name_types = null;
}
/** Returns true if field name_types is set (has been assigned a value) and false otherwise */
public boolean isSetName_types() {
return this.name_types != null;
}
public void setName_typesIsSet(boolean value) {
if (!value) {
this.name_types = null;
}
}
public int getValue_typesSize() {
return (this.value_types == null) ? 0 : this.value_types.size();
}
public void putToValue_types(ByteBuffer key, String val) {
if (this.value_types == null) {
this.value_types = new HashMap<ByteBuffer,String>();
}
this.value_types.put(key, val);
}
public Map<ByteBuffer,String> getValue_types() {
return this.value_types;
}
public CqlMetadata setValue_types(Map<ByteBuffer,String> value_types) {
this.value_types = value_types;
return this;
}
public void unsetValue_types() {
this.value_types = null;
}
/** Returns true if field value_types is set (has been assigned a value) and false otherwise */
public boolean isSetValue_types() {
return this.value_types != null;
}
public void setValue_typesIsSet(boolean value) {
if (!value) {
this.value_types = null;
}
}
public String getDefault_name_type() {
return this.default_name_type;
}
public CqlMetadata setDefault_name_type(String default_name_type) {
this.default_name_type = default_name_type;
return this;
}
public void unsetDefault_name_type() {
this.default_name_type = null;
}
/** Returns true if field default_name_type is set (has been assigned a value) and false otherwise */
public boolean isSetDefault_name_type() {
return this.default_name_type != null;
}
public void setDefault_name_typeIsSet(boolean value) {
if (!value) {
this.default_name_type = null;
}
}
public String getDefault_value_type() {
return this.default_value_type;
}
public CqlMetadata setDefault_value_type(String default_value_type) {
this.default_value_type = default_value_type;
return this;
}
public void unsetDefault_value_type() {
this.default_value_type = null;
}
/** Returns true if field default_value_type is set (has been assigned a value) and false otherwise */
public boolean isSetDefault_value_type() {
return this.default_value_type != null;
}
public void setDefault_value_typeIsSet(boolean value) {
if (!value) {
this.default_value_type = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME_TYPES:
if (value == null) {
unsetName_types();
} else {
setName_types((Map<ByteBuffer,String>)value);
}
break;
case VALUE_TYPES:
if (value == null) {
unsetValue_types();
} else {
setValue_types((Map<ByteBuffer,String>)value);
}
break;
case DEFAULT_NAME_TYPE:
if (value == null) {
unsetDefault_name_type();
} else {
setDefault_name_type((String)value);
}
break;
case DEFAULT_VALUE_TYPE:
if (value == null) {
unsetDefault_value_type();
} else {
setDefault_value_type((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME_TYPES:
return getName_types();
case VALUE_TYPES:
return getValue_types();
case DEFAULT_NAME_TYPE:
return getDefault_name_type();
case DEFAULT_VALUE_TYPE:
return getDefault_value_type();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME_TYPES:
return isSetName_types();
case VALUE_TYPES:
return isSetValue_types();
case DEFAULT_NAME_TYPE:
return isSetDefault_name_type();
case DEFAULT_VALUE_TYPE:
return isSetDefault_value_type();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CqlMetadata)
return this.equals((CqlMetadata)that);
return false;
}
public boolean equals(CqlMetadata that) {
if (that == null)
return false;
boolean this_present_name_types = true && this.isSetName_types();
boolean that_present_name_types = true && that.isSetName_types();
if (this_present_name_types || that_present_name_types) {
if (!(this_present_name_types && that_present_name_types))
return false;
if (!this.name_types.equals(that.name_types))
return false;
}
boolean this_present_value_types = true && this.isSetValue_types();
boolean that_present_value_types = true && that.isSetValue_types();
if (this_present_value_types || that_present_value_types) {
if (!(this_present_value_types && that_present_value_types))
return false;
if (!this.value_types.equals(that.value_types))
return false;
}
boolean this_present_default_name_type = true && this.isSetDefault_name_type();
boolean that_present_default_name_type = true && that.isSetDefault_name_type();
if (this_present_default_name_type || that_present_default_name_type) {
if (!(this_present_default_name_type && that_present_default_name_type))
return false;
if (!this.default_name_type.equals(that.default_name_type))
return false;
}
boolean this_present_default_value_type = true && this.isSetDefault_value_type();
boolean that_present_default_value_type = true && that.isSetDefault_value_type();
if (this_present_default_value_type || that_present_default_value_type) {
if (!(this_present_default_value_type && that_present_default_value_type))
return false;
if (!this.default_value_type.equals(that.default_value_type))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name_types = true && (isSetName_types());
builder.append(present_name_types);
if (present_name_types)
builder.append(name_types);
boolean present_value_types = true && (isSetValue_types());
builder.append(present_value_types);
if (present_value_types)
builder.append(value_types);
boolean present_default_name_type = true && (isSetDefault_name_type());
builder.append(present_default_name_type);
if (present_default_name_type)
builder.append(default_name_type);
boolean present_default_value_type = true && (isSetDefault_value_type());
builder.append(present_default_value_type);
if (present_default_value_type)
builder.append(default_value_type);
return builder.toHashCode();
}
@Override
public int compareTo(CqlMetadata other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName_types()).compareTo(other.isSetName_types());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName_types()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name_types, other.name_types);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValue_types()).compareTo(other.isSetValue_types());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue_types()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value_types, other.value_types);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDefault_name_type()).compareTo(other.isSetDefault_name_type());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDefault_name_type()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.default_name_type, other.default_name_type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDefault_value_type()).compareTo(other.isSetDefault_value_type());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDefault_value_type()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.default_value_type, other.default_value_type);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CqlMetadata(");
boolean first = true;
sb.append("name_types:");
if (this.name_types == null) {
sb.append("null");
} else {
sb.append(this.name_types);
}
first = false;
if (!first) sb.append(", ");
sb.append("value_types:");
if (this.value_types == null) {
sb.append("null");
} else {
sb.append(this.value_types);
}
first = false;
if (!first) sb.append(", ");
sb.append("default_name_type:");
if (this.default_name_type == null) {
sb.append("null");
} else {
sb.append(this.default_name_type);
}
first = false;
if (!first) sb.append(", ");
sb.append("default_value_type:");
if (this.default_value_type == null) {
sb.append("null");
} else {
sb.append(this.default_value_type);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name_types == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name_types' was not present! Struct: " + toString());
}
if (value_types == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'value_types' was not present! Struct: " + toString());
}
if (default_name_type == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'default_name_type' was not present! Struct: " + toString());
}
if (default_value_type == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'default_value_type' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CqlMetadataStandardSchemeFactory implements SchemeFactory {
public CqlMetadataStandardScheme getScheme() {
return new CqlMetadataStandardScheme();
}
}
private static class CqlMetadataStandardScheme extends StandardScheme<CqlMetadata> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CqlMetadata struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME_TYPES
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map172 = iprot.readMapBegin();
struct.name_types = new HashMap<ByteBuffer,String>(2*_map172.size);
for (int _i173 = 0; _i173 < _map172.size; ++_i173)
{
ByteBuffer _key174;
String _val175;
_key174 = iprot.readBinary();
_val175 = iprot.readString();
struct.name_types.put(_key174, _val175);
}
iprot.readMapEnd();
}
struct.setName_typesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // VALUE_TYPES
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map176 = iprot.readMapBegin();
struct.value_types = new HashMap<ByteBuffer,String>(2*_map176.size);
for (int _i177 = 0; _i177 < _map176.size; ++_i177)
{
ByteBuffer _key178;
String _val179;
_key178 = iprot.readBinary();
_val179 = iprot.readString();
struct.value_types.put(_key178, _val179);
}
iprot.readMapEnd();
}
struct.setValue_typesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // DEFAULT_NAME_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.default_name_type = iprot.readString();
struct.setDefault_name_typeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // DEFAULT_VALUE_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.default_value_type = iprot.readString();
struct.setDefault_value_typeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CqlMetadata struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name_types != null) {
oprot.writeFieldBegin(NAME_TYPES_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.name_types.size()));
for (Map.Entry<ByteBuffer, String> _iter180 : struct.name_types.entrySet())
{
oprot.writeBinary(_iter180.getKey());
oprot.writeString(_iter180.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
if (struct.value_types != null) {
oprot.writeFieldBegin(VALUE_TYPES_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.value_types.size()));
for (Map.Entry<ByteBuffer, String> _iter181 : struct.value_types.entrySet())
{
oprot.writeBinary(_iter181.getKey());
oprot.writeString(_iter181.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
if (struct.default_name_type != null) {
oprot.writeFieldBegin(DEFAULT_NAME_TYPE_FIELD_DESC);
oprot.writeString(struct.default_name_type);
oprot.writeFieldEnd();
}
if (struct.default_value_type != null) {
oprot.writeFieldBegin(DEFAULT_VALUE_TYPE_FIELD_DESC);
oprot.writeString(struct.default_value_type);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CqlMetadataTupleSchemeFactory implements SchemeFactory {
public CqlMetadataTupleScheme getScheme() {
return new CqlMetadataTupleScheme();
}
}
private static class CqlMetadataTupleScheme extends TupleScheme<CqlMetadata> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CqlMetadata struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
{
oprot.writeI32(struct.name_types.size());
for (Map.Entry<ByteBuffer, String> _iter182 : struct.name_types.entrySet())
{
oprot.writeBinary(_iter182.getKey());
oprot.writeString(_iter182.getValue());
}
}
{
oprot.writeI32(struct.value_types.size());
for (Map.Entry<ByteBuffer, String> _iter183 : struct.value_types.entrySet())
{
oprot.writeBinary(_iter183.getKey());
oprot.writeString(_iter183.getValue());
}
}
oprot.writeString(struct.default_name_type);
oprot.writeString(struct.default_value_type);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CqlMetadata struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
{
org.apache.thrift.protocol.TMap _map184 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.name_types = new HashMap<ByteBuffer,String>(2*_map184.size);
for (int _i185 = 0; _i185 < _map184.size; ++_i185)
{
ByteBuffer _key186;
String _val187;
_key186 = iprot.readBinary();
_val187 = iprot.readString();
struct.name_types.put(_key186, _val187);
}
}
struct.setName_typesIsSet(true);
{
org.apache.thrift.protocol.TMap _map188 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.value_types = new HashMap<ByteBuffer,String>(2*_map188.size);
for (int _i189 = 0; _i189 < _map188.size; ++_i189)
{
ByteBuffer _key190;
String _val191;
_key190 = iprot.readBinary();
_val191 = iprot.readString();
struct.value_types.put(_key190, _val191);
}
}
struct.setValue_typesIsSet(true);
struct.default_name_type = iprot.readString();
struct.setDefault_name_typeIsSet(true);
struct.default_value_type = iprot.readString();
struct.setDefault_value_typeIsSet(true);
}
}
}

View File

@ -1,821 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedResult, CqlPreparedResult._Fields>, java.io.Serializable, Cloneable, Comparable<CqlPreparedResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CqlPreparedResult");
private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemId", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField VARIABLE_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("variable_types", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.protocol.TField VARIABLE_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("variable_names", org.apache.thrift.protocol.TType.LIST, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CqlPreparedResultStandardSchemeFactory());
schemes.put(TupleScheme.class, new CqlPreparedResultTupleSchemeFactory());
}
public int itemId; // required
public int count; // required
public List<String> variable_types; // optional
public List<String> variable_names; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
ITEM_ID((short)1, "itemId"),
COUNT((short)2, "count"),
VARIABLE_TYPES((short)3, "variable_types"),
VARIABLE_NAMES((short)4, "variable_names");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // ITEM_ID
return ITEM_ID;
case 2: // COUNT
return COUNT;
case 3: // VARIABLE_TYPES
return VARIABLE_TYPES;
case 4: // VARIABLE_NAMES
return VARIABLE_NAMES;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __ITEMID_ISSET_ID = 0;
private static final int __COUNT_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.VARIABLE_TYPES,_Fields.VARIABLE_NAMES};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemId", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.VARIABLE_TYPES, new org.apache.thrift.meta_data.FieldMetaData("variable_types", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.VARIABLE_NAMES, new org.apache.thrift.meta_data.FieldMetaData("variable_names", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CqlPreparedResult.class, metaDataMap);
}
public CqlPreparedResult() {
}
public CqlPreparedResult(
int itemId,
int count)
{
this();
this.itemId = itemId;
setItemIdIsSet(true);
this.count = count;
setCountIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CqlPreparedResult(CqlPreparedResult other) {
__isset_bitfield = other.__isset_bitfield;
this.itemId = other.itemId;
this.count = other.count;
if (other.isSetVariable_types()) {
List<String> __this__variable_types = new ArrayList<String>(other.variable_types);
this.variable_types = __this__variable_types;
}
if (other.isSetVariable_names()) {
List<String> __this__variable_names = new ArrayList<String>(other.variable_names);
this.variable_names = __this__variable_names;
}
}
public CqlPreparedResult deepCopy() {
return new CqlPreparedResult(this);
}
@Override
public void clear() {
setItemIdIsSet(false);
this.itemId = 0;
setCountIsSet(false);
this.count = 0;
this.variable_types = null;
this.variable_names = null;
}
public int getItemId() {
return this.itemId;
}
public CqlPreparedResult setItemId(int itemId) {
this.itemId = itemId;
setItemIdIsSet(true);
return this;
}
public void unsetItemId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ITEMID_ISSET_ID);
}
/** Returns true if field itemId is set (has been assigned a value) and false otherwise */
public boolean isSetItemId() {
return EncodingUtils.testBit(__isset_bitfield, __ITEMID_ISSET_ID);
}
public void setItemIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ITEMID_ISSET_ID, value);
}
public int getCount() {
return this.count;
}
public CqlPreparedResult setCount(int count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
public int getVariable_typesSize() {
return (this.variable_types == null) ? 0 : this.variable_types.size();
}
public java.util.Iterator<String> getVariable_typesIterator() {
return (this.variable_types == null) ? null : this.variable_types.iterator();
}
public void addToVariable_types(String elem) {
if (this.variable_types == null) {
this.variable_types = new ArrayList<String>();
}
this.variable_types.add(elem);
}
public List<String> getVariable_types() {
return this.variable_types;
}
public CqlPreparedResult setVariable_types(List<String> variable_types) {
this.variable_types = variable_types;
return this;
}
public void unsetVariable_types() {
this.variable_types = null;
}
/** Returns true if field variable_types is set (has been assigned a value) and false otherwise */
public boolean isSetVariable_types() {
return this.variable_types != null;
}
public void setVariable_typesIsSet(boolean value) {
if (!value) {
this.variable_types = null;
}
}
public int getVariable_namesSize() {
return (this.variable_names == null) ? 0 : this.variable_names.size();
}
public java.util.Iterator<String> getVariable_namesIterator() {
return (this.variable_names == null) ? null : this.variable_names.iterator();
}
public void addToVariable_names(String elem) {
if (this.variable_names == null) {
this.variable_names = new ArrayList<String>();
}
this.variable_names.add(elem);
}
public List<String> getVariable_names() {
return this.variable_names;
}
public CqlPreparedResult setVariable_names(List<String> variable_names) {
this.variable_names = variable_names;
return this;
}
public void unsetVariable_names() {
this.variable_names = null;
}
/** Returns true if field variable_names is set (has been assigned a value) and false otherwise */
public boolean isSetVariable_names() {
return this.variable_names != null;
}
public void setVariable_namesIsSet(boolean value) {
if (!value) {
this.variable_names = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ITEM_ID:
if (value == null) {
unsetItemId();
} else {
setItemId((Integer)value);
}
break;
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Integer)value);
}
break;
case VARIABLE_TYPES:
if (value == null) {
unsetVariable_types();
} else {
setVariable_types((List<String>)value);
}
break;
case VARIABLE_NAMES:
if (value == null) {
unsetVariable_names();
} else {
setVariable_names((List<String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ITEM_ID:
return Integer.valueOf(getItemId());
case COUNT:
return Integer.valueOf(getCount());
case VARIABLE_TYPES:
return getVariable_types();
case VARIABLE_NAMES:
return getVariable_names();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case ITEM_ID:
return isSetItemId();
case COUNT:
return isSetCount();
case VARIABLE_TYPES:
return isSetVariable_types();
case VARIABLE_NAMES:
return isSetVariable_names();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CqlPreparedResult)
return this.equals((CqlPreparedResult)that);
return false;
}
public boolean equals(CqlPreparedResult that) {
if (that == null)
return false;
boolean this_present_itemId = true;
boolean that_present_itemId = true;
if (this_present_itemId || that_present_itemId) {
if (!(this_present_itemId && that_present_itemId))
return false;
if (this.itemId != that.itemId)
return false;
}
boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
boolean this_present_variable_types = true && this.isSetVariable_types();
boolean that_present_variable_types = true && that.isSetVariable_types();
if (this_present_variable_types || that_present_variable_types) {
if (!(this_present_variable_types && that_present_variable_types))
return false;
if (!this.variable_types.equals(that.variable_types))
return false;
}
boolean this_present_variable_names = true && this.isSetVariable_names();
boolean that_present_variable_names = true && that.isSetVariable_names();
if (this_present_variable_names || that_present_variable_names) {
if (!(this_present_variable_names && that_present_variable_names))
return false;
if (!this.variable_names.equals(that.variable_names))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_itemId = true;
builder.append(present_itemId);
if (present_itemId)
builder.append(itemId);
boolean present_count = true;
builder.append(present_count);
if (present_count)
builder.append(count);
boolean present_variable_types = true && (isSetVariable_types());
builder.append(present_variable_types);
if (present_variable_types)
builder.append(variable_types);
boolean present_variable_names = true && (isSetVariable_names());
builder.append(present_variable_names);
if (present_variable_names)
builder.append(variable_names);
return builder.toHashCode();
}
@Override
public int compareTo(CqlPreparedResult other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetItemId()).compareTo(other.isSetItemId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetItemId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemId, other.itemId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCount()).compareTo(other.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, other.count);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetVariable_types()).compareTo(other.isSetVariable_types());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVariable_types()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.variable_types, other.variable_types);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetVariable_names()).compareTo(other.isSetVariable_names());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVariable_names()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.variable_names, other.variable_names);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CqlPreparedResult(");
boolean first = true;
sb.append("itemId:");
sb.append(this.itemId);
first = false;
if (!first) sb.append(", ");
sb.append("count:");
sb.append(this.count);
first = false;
if (isSetVariable_types()) {
if (!first) sb.append(", ");
sb.append("variable_types:");
if (this.variable_types == null) {
sb.append("null");
} else {
sb.append(this.variable_types);
}
first = false;
}
if (isSetVariable_names()) {
if (!first) sb.append(", ");
sb.append("variable_names:");
if (this.variable_names == null) {
sb.append("null");
} else {
sb.append(this.variable_names);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// alas, we cannot check 'itemId' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'count' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CqlPreparedResultStandardSchemeFactory implements SchemeFactory {
public CqlPreparedResultStandardScheme getScheme() {
return new CqlPreparedResultStandardScheme();
}
}
private static class CqlPreparedResultStandardScheme extends StandardScheme<CqlPreparedResult> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CqlPreparedResult struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // ITEM_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.itemId = iprot.readI32();
struct.setItemIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.count = iprot.readI32();
struct.setCountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // VARIABLE_TYPES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list200 = iprot.readListBegin();
struct.variable_types = new ArrayList<String>(_list200.size);
for (int _i201 = 0; _i201 < _list200.size; ++_i201)
{
String _elem202;
_elem202 = iprot.readString();
struct.variable_types.add(_elem202);
}
iprot.readListEnd();
}
struct.setVariable_typesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // VARIABLE_NAMES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list203 = iprot.readListBegin();
struct.variable_names = new ArrayList<String>(_list203.size);
for (int _i204 = 0; _i204 < _list203.size; ++_i204)
{
String _elem205;
_elem205 = iprot.readString();
struct.variable_names.add(_elem205);
}
iprot.readListEnd();
}
struct.setVariable_namesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetItemId()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'itemId' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetCount()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CqlPreparedResult struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
oprot.writeI32(struct.itemId);
oprot.writeFieldEnd();
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI32(struct.count);
oprot.writeFieldEnd();
if (struct.variable_types != null) {
if (struct.isSetVariable_types()) {
oprot.writeFieldBegin(VARIABLE_TYPES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.variable_types.size()));
for (String _iter206 : struct.variable_types)
{
oprot.writeString(_iter206);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.variable_names != null) {
if (struct.isSetVariable_names()) {
oprot.writeFieldBegin(VARIABLE_NAMES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.variable_names.size()));
for (String _iter207 : struct.variable_names)
{
oprot.writeString(_iter207);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CqlPreparedResultTupleSchemeFactory implements SchemeFactory {
public CqlPreparedResultTupleScheme getScheme() {
return new CqlPreparedResultTupleScheme();
}
}
private static class CqlPreparedResultTupleScheme extends TupleScheme<CqlPreparedResult> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CqlPreparedResult struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeI32(struct.itemId);
oprot.writeI32(struct.count);
BitSet optionals = new BitSet();
if (struct.isSetVariable_types()) {
optionals.set(0);
}
if (struct.isSetVariable_names()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetVariable_types()) {
{
oprot.writeI32(struct.variable_types.size());
for (String _iter208 : struct.variable_types)
{
oprot.writeString(_iter208);
}
}
}
if (struct.isSetVariable_names()) {
{
oprot.writeI32(struct.variable_names.size());
for (String _iter209 : struct.variable_names)
{
oprot.writeString(_iter209);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CqlPreparedResult struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.itemId = iprot.readI32();
struct.setItemIdIsSet(true);
struct.count = iprot.readI32();
struct.setCountIsSet(true);
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list210 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.variable_types = new ArrayList<String>(_list210.size);
for (int _i211 = 0; _i211 < _list210.size; ++_i211)
{
String _elem212;
_elem212 = iprot.readString();
struct.variable_types.add(_elem212);
}
}
struct.setVariable_typesIsSet(true);
}
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TList _list213 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.variable_names = new ArrayList<String>(_list213.size);
for (int _i214 = 0; _i214 < _list213.size; ++_i214)
{
String _elem215;
_elem215 = iprot.readString();
struct.variable_names.add(_elem215);
}
}
struct.setVariable_namesIsSet(true);
}
}
}
}

View File

@ -1,807 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._Fields>, java.io.Serializable, Cloneable, Comparable<CqlResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CqlResult");
private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("rows", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("num", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("schema", org.apache.thrift.protocol.TType.STRUCT, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CqlResultStandardSchemeFactory());
schemes.put(TupleScheme.class, new CqlResultTupleSchemeFactory());
}
/**
*
* @see CqlResultType
*/
public CqlResultType type; // required
public List<CqlRow> rows; // optional
public int num; // optional
public CqlMetadata schema; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
/**
*
* @see CqlResultType
*/
TYPE((short)1, "type"),
ROWS((short)2, "rows"),
NUM((short)3, "num"),
SCHEMA((short)4, "schema");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TYPE
return TYPE;
case 2: // ROWS
return ROWS;
case 3: // NUM
return NUM;
case 4: // SCHEMA
return SCHEMA;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __NUM_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.ROWS,_Fields.NUM,_Fields.SCHEMA};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CqlResultType.class)));
tmpMap.put(_Fields.ROWS, new org.apache.thrift.meta_data.FieldMetaData("rows", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CqlRow.class))));
tmpMap.put(_Fields.NUM, new org.apache.thrift.meta_data.FieldMetaData("num", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.SCHEMA, new org.apache.thrift.meta_data.FieldMetaData("schema", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CqlMetadata.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CqlResult.class, metaDataMap);
}
public CqlResult() {
}
public CqlResult(
CqlResultType type)
{
this();
this.type = type;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CqlResult(CqlResult other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetType()) {
this.type = other.type;
}
if (other.isSetRows()) {
List<CqlRow> __this__rows = new ArrayList<CqlRow>(other.rows.size());
for (CqlRow other_element : other.rows) {
__this__rows.add(new CqlRow(other_element));
}
this.rows = __this__rows;
}
this.num = other.num;
if (other.isSetSchema()) {
this.schema = new CqlMetadata(other.schema);
}
}
public CqlResult deepCopy() {
return new CqlResult(this);
}
@Override
public void clear() {
this.type = null;
this.rows = null;
setNumIsSet(false);
this.num = 0;
this.schema = null;
}
/**
*
* @see CqlResultType
*/
public CqlResultType getType() {
return this.type;
}
/**
*
* @see CqlResultType
*/
public CqlResult setType(CqlResultType type) {
this.type = type;
return this;
}
public void unsetType() {
this.type = null;
}
/** Returns true if field type is set (has been assigned a value) and false otherwise */
public boolean isSetType() {
return this.type != null;
}
public void setTypeIsSet(boolean value) {
if (!value) {
this.type = null;
}
}
public int getRowsSize() {
return (this.rows == null) ? 0 : this.rows.size();
}
public java.util.Iterator<CqlRow> getRowsIterator() {
return (this.rows == null) ? null : this.rows.iterator();
}
public void addToRows(CqlRow elem) {
if (this.rows == null) {
this.rows = new ArrayList<CqlRow>();
}
this.rows.add(elem);
}
public List<CqlRow> getRows() {
return this.rows;
}
public CqlResult setRows(List<CqlRow> rows) {
this.rows = rows;
return this;
}
public void unsetRows() {
this.rows = null;
}
/** Returns true if field rows is set (has been assigned a value) and false otherwise */
public boolean isSetRows() {
return this.rows != null;
}
public void setRowsIsSet(boolean value) {
if (!value) {
this.rows = null;
}
}
public int getNum() {
return this.num;
}
public CqlResult setNum(int num) {
this.num = num;
setNumIsSet(true);
return this;
}
public void unsetNum() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM_ISSET_ID);
}
/** Returns true if field num is set (has been assigned a value) and false otherwise */
public boolean isSetNum() {
return EncodingUtils.testBit(__isset_bitfield, __NUM_ISSET_ID);
}
public void setNumIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM_ISSET_ID, value);
}
public CqlMetadata getSchema() {
return this.schema;
}
public CqlResult setSchema(CqlMetadata schema) {
this.schema = schema;
return this;
}
public void unsetSchema() {
this.schema = null;
}
/** Returns true if field schema is set (has been assigned a value) and false otherwise */
public boolean isSetSchema() {
return this.schema != null;
}
public void setSchemaIsSet(boolean value) {
if (!value) {
this.schema = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TYPE:
if (value == null) {
unsetType();
} else {
setType((CqlResultType)value);
}
break;
case ROWS:
if (value == null) {
unsetRows();
} else {
setRows((List<CqlRow>)value);
}
break;
case NUM:
if (value == null) {
unsetNum();
} else {
setNum((Integer)value);
}
break;
case SCHEMA:
if (value == null) {
unsetSchema();
} else {
setSchema((CqlMetadata)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TYPE:
return getType();
case ROWS:
return getRows();
case NUM:
return Integer.valueOf(getNum());
case SCHEMA:
return getSchema();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case TYPE:
return isSetType();
case ROWS:
return isSetRows();
case NUM:
return isSetNum();
case SCHEMA:
return isSetSchema();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CqlResult)
return this.equals((CqlResult)that);
return false;
}
public boolean equals(CqlResult that) {
if (that == null)
return false;
boolean this_present_type = true && this.isSetType();
boolean that_present_type = true && that.isSetType();
if (this_present_type || that_present_type) {
if (!(this_present_type && that_present_type))
return false;
if (!this.type.equals(that.type))
return false;
}
boolean this_present_rows = true && this.isSetRows();
boolean that_present_rows = true && that.isSetRows();
if (this_present_rows || that_present_rows) {
if (!(this_present_rows && that_present_rows))
return false;
if (!this.rows.equals(that.rows))
return false;
}
boolean this_present_num = true && this.isSetNum();
boolean that_present_num = true && that.isSetNum();
if (this_present_num || that_present_num) {
if (!(this_present_num && that_present_num))
return false;
if (this.num != that.num)
return false;
}
boolean this_present_schema = true && this.isSetSchema();
boolean that_present_schema = true && that.isSetSchema();
if (this_present_schema || that_present_schema) {
if (!(this_present_schema && that_present_schema))
return false;
if (!this.schema.equals(that.schema))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_type = true && (isSetType());
builder.append(present_type);
if (present_type)
builder.append(type.getValue());
boolean present_rows = true && (isSetRows());
builder.append(present_rows);
if (present_rows)
builder.append(rows);
boolean present_num = true && (isSetNum());
builder.append(present_num);
if (present_num)
builder.append(num);
boolean present_schema = true && (isSetSchema());
builder.append(present_schema);
if (present_schema)
builder.append(schema);
return builder.toHashCode();
}
@Override
public int compareTo(CqlResult other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRows()).compareTo(other.isSetRows());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRows()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rows, other.rows);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNum()).compareTo(other.isSetNum());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNum()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num, other.num);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSchema()).compareTo(other.isSetSchema());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSchema()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.schema, other.schema);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CqlResult(");
boolean first = true;
sb.append("type:");
if (this.type == null) {
sb.append("null");
} else {
sb.append(this.type);
}
first = false;
if (isSetRows()) {
if (!first) sb.append(", ");
sb.append("rows:");
if (this.rows == null) {
sb.append("null");
} else {
sb.append(this.rows);
}
first = false;
}
if (isSetNum()) {
if (!first) sb.append(", ");
sb.append("num:");
sb.append(this.num);
first = false;
}
if (isSetSchema()) {
if (!first) sb.append(", ");
sb.append("schema:");
if (this.schema == null) {
sb.append("null");
} else {
sb.append(this.schema);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (type == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
}
// check for sub-struct validity
if (schema != null) {
schema.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CqlResultStandardSchemeFactory implements SchemeFactory {
public CqlResultStandardScheme getScheme() {
return new CqlResultStandardScheme();
}
}
private static class CqlResultStandardScheme extends StandardScheme<CqlResult> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CqlResult struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.type = CqlResultType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // ROWS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list192 = iprot.readListBegin();
struct.rows = new ArrayList<CqlRow>(_list192.size);
for (int _i193 = 0; _i193 < _list192.size; ++_i193)
{
CqlRow _elem194;
_elem194 = new CqlRow();
_elem194.read(iprot);
struct.rows.add(_elem194);
}
iprot.readListEnd();
}
struct.setRowsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // NUM
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.num = iprot.readI32();
struct.setNumIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // SCHEMA
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.schema = new CqlMetadata();
struct.schema.read(iprot);
struct.setSchemaIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CqlResult struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeI32(struct.type.getValue());
oprot.writeFieldEnd();
}
if (struct.rows != null) {
if (struct.isSetRows()) {
oprot.writeFieldBegin(ROWS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.rows.size()));
for (CqlRow _iter195 : struct.rows)
{
_iter195.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.isSetNum()) {
oprot.writeFieldBegin(NUM_FIELD_DESC);
oprot.writeI32(struct.num);
oprot.writeFieldEnd();
}
if (struct.schema != null) {
if (struct.isSetSchema()) {
oprot.writeFieldBegin(SCHEMA_FIELD_DESC);
struct.schema.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CqlResultTupleSchemeFactory implements SchemeFactory {
public CqlResultTupleScheme getScheme() {
return new CqlResultTupleScheme();
}
}
private static class CqlResultTupleScheme extends TupleScheme<CqlResult> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CqlResult struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeI32(struct.type.getValue());
BitSet optionals = new BitSet();
if (struct.isSetRows()) {
optionals.set(0);
}
if (struct.isSetNum()) {
optionals.set(1);
}
if (struct.isSetSchema()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetRows()) {
{
oprot.writeI32(struct.rows.size());
for (CqlRow _iter196 : struct.rows)
{
_iter196.write(oprot);
}
}
}
if (struct.isSetNum()) {
oprot.writeI32(struct.num);
}
if (struct.isSetSchema()) {
struct.schema.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CqlResult struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.type = CqlResultType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list197 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.rows = new ArrayList<CqlRow>(_list197.size);
for (int _i198 = 0; _i198 < _list197.size; ++_i198)
{
CqlRow _elem199;
_elem199 = new CqlRow();
_elem199.read(iprot);
struct.rows.add(_elem199);
}
}
struct.setRowsIsSet(true);
}
if (incoming.get(1)) {
struct.num = iprot.readI32();
struct.setNumIsSet(true);
}
if (incoming.get(2)) {
struct.schema = new CqlMetadata();
struct.schema.read(iprot);
struct.setSchemaIsSet(true);
}
}
}
}

View File

@ -1,69 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
public enum CqlResultType implements org.apache.thrift.TEnum {
ROWS(1),
VOID(2),
INT(3);
private final int value;
private CqlResultType(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static CqlResultType findByValue(int value) {
switch (value) {
case 1:
return ROWS;
case 2:
return VOID;
case 3:
return INT;
default:
return null;
}
}
}

View File

@ -1,584 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Row returned from a CQL query.
*
* This struct is used for both CQL2 and CQL3 queries. For CQL2, the partition key
* is special-cased and is always returned. For CQL3, it is not special cased;
* it will be included in the columns list if it was included in the SELECT and
* the key field is always null.
*/
public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>, java.io.Serializable, Cloneable, Comparable<CqlRow> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CqlRow");
private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new CqlRowStandardSchemeFactory());
schemes.put(TupleScheme.class, new CqlRowTupleSchemeFactory());
}
public ByteBuffer key; // required
public List<Column> columns; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
KEY((short)1, "key"),
COLUMNS((short)2, "columns");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // KEY
return KEY;
case 2: // COLUMNS
return COLUMNS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Column.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CqlRow.class, metaDataMap);
}
public CqlRow() {
}
public CqlRow(
ByteBuffer key,
List<Column> columns)
{
this();
this.key = key;
this.columns = columns;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public CqlRow(CqlRow other) {
if (other.isSetKey()) {
this.key = org.apache.thrift.TBaseHelper.copyBinary(other.key);
;
}
if (other.isSetColumns()) {
List<Column> __this__columns = new ArrayList<Column>(other.columns.size());
for (Column other_element : other.columns) {
__this__columns.add(new Column(other_element));
}
this.columns = __this__columns;
}
}
public CqlRow deepCopy() {
return new CqlRow(this);
}
@Override
public void clear() {
this.key = null;
this.columns = null;
}
public byte[] getKey() {
setKey(org.apache.thrift.TBaseHelper.rightSize(key));
return key == null ? null : key.array();
}
public ByteBuffer bufferForKey() {
return key;
}
public CqlRow setKey(byte[] key) {
setKey(key == null ? (ByteBuffer)null : ByteBuffer.wrap(key));
return this;
}
public CqlRow setKey(ByteBuffer key) {
this.key = key;
return this;
}
public void unsetKey() {
this.key = null;
}
/** Returns true if field key is set (has been assigned a value) and false otherwise */
public boolean isSetKey() {
return this.key != null;
}
public void setKeyIsSet(boolean value) {
if (!value) {
this.key = null;
}
}
public int getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
public java.util.Iterator<Column> getColumnsIterator() {
return (this.columns == null) ? null : this.columns.iterator();
}
public void addToColumns(Column elem) {
if (this.columns == null) {
this.columns = new ArrayList<Column>();
}
this.columns.add(elem);
}
public List<Column> getColumns() {
return this.columns;
}
public CqlRow setColumns(List<Column> columns) {
this.columns = columns;
return this;
}
public void unsetColumns() {
this.columns = null;
}
/** Returns true if field columns is set (has been assigned a value) and false otherwise */
public boolean isSetColumns() {
return this.columns != null;
}
public void setColumnsIsSet(boolean value) {
if (!value) {
this.columns = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case KEY:
if (value == null) {
unsetKey();
} else {
setKey((ByteBuffer)value);
}
break;
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((List<Column>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case KEY:
return getKey();
case COLUMNS:
return getColumns();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case KEY:
return isSetKey();
case COLUMNS:
return isSetColumns();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof CqlRow)
return this.equals((CqlRow)that);
return false;
}
public boolean equals(CqlRow that) {
if (that == null)
return false;
boolean this_present_key = true && this.isSetKey();
boolean that_present_key = true && that.isSetKey();
if (this_present_key || that_present_key) {
if (!(this_present_key && that_present_key))
return false;
if (!this.key.equals(that.key))
return false;
}
boolean this_present_columns = true && this.isSetColumns();
boolean that_present_columns = true && that.isSetColumns();
if (this_present_columns || that_present_columns) {
if (!(this_present_columns && that_present_columns))
return false;
if (!this.columns.equals(that.columns))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_key = true && (isSetKey());
builder.append(present_key);
if (present_key)
builder.append(key);
boolean present_columns = true && (isSetColumns());
builder.append(present_columns);
if (present_columns)
builder.append(columns);
return builder.toHashCode();
}
@Override
public int compareTo(CqlRow other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetKey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CqlRow(");
boolean first = true;
sb.append("key:");
if (this.key == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.key, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("columns:");
if (this.columns == null) {
sb.append("null");
} else {
sb.append(this.columns);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (key == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'key' was not present! Struct: " + toString());
}
if (columns == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class CqlRowStandardSchemeFactory implements SchemeFactory {
public CqlRowStandardScheme getScheme() {
return new CqlRowStandardScheme();
}
}
private static class CqlRowStandardScheme extends StandardScheme<CqlRow> {
public void read(org.apache.thrift.protocol.TProtocol iprot, CqlRow struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // KEY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.key = iprot.readBinary();
struct.setKeyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COLUMNS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list164 = iprot.readListBegin();
struct.columns = new ArrayList<Column>(_list164.size);
for (int _i165 = 0; _i165 < _list164.size; ++_i165)
{
Column _elem166;
_elem166 = new Column();
_elem166.read(iprot);
struct.columns.add(_elem166);
}
iprot.readListEnd();
}
struct.setColumnsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, CqlRow struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.key != null) {
oprot.writeFieldBegin(KEY_FIELD_DESC);
oprot.writeBinary(struct.key);
oprot.writeFieldEnd();
}
if (struct.columns != null) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
for (Column _iter167 : struct.columns)
{
_iter167.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class CqlRowTupleSchemeFactory implements SchemeFactory {
public CqlRowTupleScheme getScheme() {
return new CqlRowTupleScheme();
}
}
private static class CqlRowTupleScheme extends TupleScheme<CqlRow> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, CqlRow struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.key);
{
oprot.writeI32(struct.columns.size());
for (Column _iter168 : struct.columns)
{
_iter168.write(oprot);
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, CqlRow struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.key = iprot.readBinary();
struct.setKeyIsSet(true);
{
org.apache.thrift.protocol.TList _list169 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.columns = new ArrayList<Column>(_list169.size);
for (int _i170 = 0; _i170 < _list169.size; ++_i170)
{
Column _elem171;
_elem171 = new Column();
_elem171.read(iprot);
struct.columns.add(_elem171);
}
}
struct.setColumnsIsSet(true);
}
}
}

View File

@ -1,645 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Note that the timestamp is only optional in case of counter deletion.
*/
public class Deletion implements org.apache.thrift.TBase<Deletion, Deletion._Fields>, java.io.Serializable, Cloneable, Comparable<Deletion> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Deletion");
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("super_column", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField PREDICATE_FIELD_DESC = new org.apache.thrift.protocol.TField("predicate", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new DeletionStandardSchemeFactory());
schemes.put(TupleScheme.class, new DeletionTupleSchemeFactory());
}
public long timestamp; // optional
public ByteBuffer super_column; // optional
public SlicePredicate predicate; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TIMESTAMP((short)1, "timestamp"),
SUPER_COLUMN((short)2, "super_column"),
PREDICATE((short)3, "predicate");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TIMESTAMP
return TIMESTAMP;
case 2: // SUPER_COLUMN
return SUPER_COLUMN;
case 3: // PREDICATE
return PREDICATE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.SUPER_COLUMN,_Fields.PREDICATE};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.PREDICATE, new org.apache.thrift.meta_data.FieldMetaData("predicate", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SlicePredicate.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Deletion.class, metaDataMap);
}
public Deletion() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public Deletion(Deletion other) {
__isset_bitfield = other.__isset_bitfield;
this.timestamp = other.timestamp;
if (other.isSetSuper_column()) {
this.super_column = org.apache.thrift.TBaseHelper.copyBinary(other.super_column);
;
}
if (other.isSetPredicate()) {
this.predicate = new SlicePredicate(other.predicate);
}
}
public Deletion deepCopy() {
return new Deletion(this);
}
@Override
public void clear() {
setTimestampIsSet(false);
this.timestamp = 0;
this.super_column = null;
this.predicate = null;
}
public long getTimestamp() {
return this.timestamp;
}
public Deletion setTimestamp(long timestamp) {
this.timestamp = timestamp;
setTimestampIsSet(true);
return this;
}
public void unsetTimestamp() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
/** Returns true if field timestamp is set (has been assigned a value) and false otherwise */
public boolean isSetTimestamp() {
return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
}
public void setTimestampIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
}
public byte[] getSuper_column() {
setSuper_column(org.apache.thrift.TBaseHelper.rightSize(super_column));
return super_column == null ? null : super_column.array();
}
public ByteBuffer bufferForSuper_column() {
return super_column;
}
public Deletion setSuper_column(byte[] super_column) {
setSuper_column(super_column == null ? (ByteBuffer)null : ByteBuffer.wrap(super_column));
return this;
}
public Deletion setSuper_column(ByteBuffer super_column) {
this.super_column = super_column;
return this;
}
public void unsetSuper_column() {
this.super_column = null;
}
/** Returns true if field super_column is set (has been assigned a value) and false otherwise */
public boolean isSetSuper_column() {
return this.super_column != null;
}
public void setSuper_columnIsSet(boolean value) {
if (!value) {
this.super_column = null;
}
}
public SlicePredicate getPredicate() {
return this.predicate;
}
public Deletion setPredicate(SlicePredicate predicate) {
this.predicate = predicate;
return this;
}
public void unsetPredicate() {
this.predicate = null;
}
/** Returns true if field predicate is set (has been assigned a value) and false otherwise */
public boolean isSetPredicate() {
return this.predicate != null;
}
public void setPredicateIsSet(boolean value) {
if (!value) {
this.predicate = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TIMESTAMP:
if (value == null) {
unsetTimestamp();
} else {
setTimestamp((Long)value);
}
break;
case SUPER_COLUMN:
if (value == null) {
unsetSuper_column();
} else {
setSuper_column((ByteBuffer)value);
}
break;
case PREDICATE:
if (value == null) {
unsetPredicate();
} else {
setPredicate((SlicePredicate)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TIMESTAMP:
return Long.valueOf(getTimestamp());
case SUPER_COLUMN:
return getSuper_column();
case PREDICATE:
return getPredicate();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case TIMESTAMP:
return isSetTimestamp();
case SUPER_COLUMN:
return isSetSuper_column();
case PREDICATE:
return isSetPredicate();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Deletion)
return this.equals((Deletion)that);
return false;
}
public boolean equals(Deletion that) {
if (that == null)
return false;
boolean this_present_timestamp = true && this.isSetTimestamp();
boolean that_present_timestamp = true && that.isSetTimestamp();
if (this_present_timestamp || that_present_timestamp) {
if (!(this_present_timestamp && that_present_timestamp))
return false;
if (this.timestamp != that.timestamp)
return false;
}
boolean this_present_super_column = true && this.isSetSuper_column();
boolean that_present_super_column = true && that.isSetSuper_column();
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
if (!this.super_column.equals(that.super_column))
return false;
}
boolean this_present_predicate = true && this.isSetPredicate();
boolean that_present_predicate = true && that.isSetPredicate();
if (this_present_predicate || that_present_predicate) {
if (!(this_present_predicate && that_present_predicate))
return false;
if (!this.predicate.equals(that.predicate))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_timestamp = true && (isSetTimestamp());
builder.append(present_timestamp);
if (present_timestamp)
builder.append(timestamp);
boolean present_super_column = true && (isSetSuper_column());
builder.append(present_super_column);
if (present_super_column)
builder.append(super_column);
boolean present_predicate = true && (isSetPredicate());
builder.append(present_predicate);
if (present_predicate)
builder.append(predicate);
return builder.toHashCode();
}
@Override
public int compareTo(Deletion other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimestamp()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSuper_column()).compareTo(other.isSetSuper_column());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuper_column()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.super_column, other.super_column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPredicate()).compareTo(other.isSetPredicate());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPredicate()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.predicate, other.predicate);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Deletion(");
boolean first = true;
if (isSetTimestamp()) {
sb.append("timestamp:");
sb.append(this.timestamp);
first = false;
}
if (isSetSuper_column()) {
if (!first) sb.append(", ");
sb.append("super_column:");
if (this.super_column == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.super_column, sb);
}
first = false;
}
if (isSetPredicate()) {
if (!first) sb.append(", ");
sb.append("predicate:");
if (this.predicate == null) {
sb.append("null");
} else {
sb.append(this.predicate);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (predicate != null) {
predicate.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class DeletionStandardSchemeFactory implements SchemeFactory {
public DeletionStandardScheme getScheme() {
return new DeletionStandardScheme();
}
}
private static class DeletionStandardScheme extends StandardScheme<Deletion> {
public void read(org.apache.thrift.protocol.TProtocol iprot, Deletion struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // TIMESTAMP
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // SUPER_COLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.super_column = iprot.readBinary();
struct.setSuper_columnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // PREDICATE
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.predicate = new SlicePredicate();
struct.predicate.read(iprot);
struct.setPredicateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, Deletion struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.isSetTimestamp()) {
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(struct.timestamp);
oprot.writeFieldEnd();
}
if (struct.super_column != null) {
if (struct.isSetSuper_column()) {
oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC);
oprot.writeBinary(struct.super_column);
oprot.writeFieldEnd();
}
}
if (struct.predicate != null) {
if (struct.isSetPredicate()) {
oprot.writeFieldBegin(PREDICATE_FIELD_DESC);
struct.predicate.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class DeletionTupleSchemeFactory implements SchemeFactory {
public DeletionTupleScheme getScheme() {
return new DeletionTupleScheme();
}
}
private static class DeletionTupleScheme extends TupleScheme<Deletion> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, Deletion struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetTimestamp()) {
optionals.set(0);
}
if (struct.isSetSuper_column()) {
optionals.set(1);
}
if (struct.isSetPredicate()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetTimestamp()) {
oprot.writeI64(struct.timestamp);
}
if (struct.isSetSuper_column()) {
oprot.writeBinary(struct.super_column);
}
if (struct.isSetPredicate()) {
struct.predicate.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, Deletion struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
}
if (incoming.get(1)) {
struct.super_column = iprot.readBinary();
struct.setSuper_columnIsSet(true);
}
if (incoming.get(2)) {
struct.predicate = new SlicePredicate();
struct.predicate.read(iprot);
struct.setPredicateIsSet(true);
}
}
}
}

View File

@ -1,630 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EndpointDetails implements org.apache.thrift.TBase<EndpointDetails, EndpointDetails._Fields>, java.io.Serializable, Cloneable, Comparable<EndpointDetails> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("EndpointDetails");
private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField DATACENTER_FIELD_DESC = new org.apache.thrift.protocol.TField("datacenter", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField RACK_FIELD_DESC = new org.apache.thrift.protocol.TField("rack", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new EndpointDetailsStandardSchemeFactory());
schemes.put(TupleScheme.class, new EndpointDetailsTupleSchemeFactory());
}
public String host; // required
public String datacenter; // required
public String rack; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
HOST((short)1, "host"),
DATACENTER((short)2, "datacenter"),
RACK((short)3, "rack");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // HOST
return HOST;
case 2: // DATACENTER
return DATACENTER;
case 3: // RACK
return RACK;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.RACK};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.DATACENTER, new org.apache.thrift.meta_data.FieldMetaData("datacenter", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.RACK, new org.apache.thrift.meta_data.FieldMetaData("rack", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EndpointDetails.class, metaDataMap);
}
public EndpointDetails() {
}
public EndpointDetails(
String host,
String datacenter)
{
this();
this.host = host;
this.datacenter = datacenter;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public EndpointDetails(EndpointDetails other) {
if (other.isSetHost()) {
this.host = other.host;
}
if (other.isSetDatacenter()) {
this.datacenter = other.datacenter;
}
if (other.isSetRack()) {
this.rack = other.rack;
}
}
public EndpointDetails deepCopy() {
return new EndpointDetails(this);
}
@Override
public void clear() {
this.host = null;
this.datacenter = null;
this.rack = null;
}
public String getHost() {
return this.host;
}
public EndpointDetails setHost(String host) {
this.host = host;
return this;
}
public void unsetHost() {
this.host = null;
}
/** Returns true if field host is set (has been assigned a value) and false otherwise */
public boolean isSetHost() {
return this.host != null;
}
public void setHostIsSet(boolean value) {
if (!value) {
this.host = null;
}
}
public String getDatacenter() {
return this.datacenter;
}
public EndpointDetails setDatacenter(String datacenter) {
this.datacenter = datacenter;
return this;
}
public void unsetDatacenter() {
this.datacenter = null;
}
/** Returns true if field datacenter is set (has been assigned a value) and false otherwise */
public boolean isSetDatacenter() {
return this.datacenter != null;
}
public void setDatacenterIsSet(boolean value) {
if (!value) {
this.datacenter = null;
}
}
public String getRack() {
return this.rack;
}
public EndpointDetails setRack(String rack) {
this.rack = rack;
return this;
}
public void unsetRack() {
this.rack = null;
}
/** Returns true if field rack is set (has been assigned a value) and false otherwise */
public boolean isSetRack() {
return this.rack != null;
}
public void setRackIsSet(boolean value) {
if (!value) {
this.rack = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case HOST:
if (value == null) {
unsetHost();
} else {
setHost((String)value);
}
break;
case DATACENTER:
if (value == null) {
unsetDatacenter();
} else {
setDatacenter((String)value);
}
break;
case RACK:
if (value == null) {
unsetRack();
} else {
setRack((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case HOST:
return getHost();
case DATACENTER:
return getDatacenter();
case RACK:
return getRack();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case HOST:
return isSetHost();
case DATACENTER:
return isSetDatacenter();
case RACK:
return isSetRack();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof EndpointDetails)
return this.equals((EndpointDetails)that);
return false;
}
public boolean equals(EndpointDetails that) {
if (that == null)
return false;
boolean this_present_host = true && this.isSetHost();
boolean that_present_host = true && that.isSetHost();
if (this_present_host || that_present_host) {
if (!(this_present_host && that_present_host))
return false;
if (!this.host.equals(that.host))
return false;
}
boolean this_present_datacenter = true && this.isSetDatacenter();
boolean that_present_datacenter = true && that.isSetDatacenter();
if (this_present_datacenter || that_present_datacenter) {
if (!(this_present_datacenter && that_present_datacenter))
return false;
if (!this.datacenter.equals(that.datacenter))
return false;
}
boolean this_present_rack = true && this.isSetRack();
boolean that_present_rack = true && that.isSetRack();
if (this_present_rack || that_present_rack) {
if (!(this_present_rack && that_present_rack))
return false;
if (!this.rack.equals(that.rack))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_host = true && (isSetHost());
builder.append(present_host);
if (present_host)
builder.append(host);
boolean present_datacenter = true && (isSetDatacenter());
builder.append(present_datacenter);
if (present_datacenter)
builder.append(datacenter);
boolean present_rack = true && (isSetRack());
builder.append(present_rack);
if (present_rack)
builder.append(rack);
return builder.toHashCode();
}
@Override
public int compareTo(EndpointDetails other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetHost()).compareTo(other.isSetHost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHost()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDatacenter()).compareTo(other.isSetDatacenter());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDatacenter()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.datacenter, other.datacenter);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRack()).compareTo(other.isSetRack());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRack()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rack, other.rack);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("EndpointDetails(");
boolean first = true;
sb.append("host:");
if (this.host == null) {
sb.append("null");
} else {
sb.append(this.host);
}
first = false;
if (!first) sb.append(", ");
sb.append("datacenter:");
if (this.datacenter == null) {
sb.append("null");
} else {
sb.append(this.datacenter);
}
first = false;
if (isSetRack()) {
if (!first) sb.append(", ");
sb.append("rack:");
if (this.rack == null) {
sb.append("null");
} else {
sb.append(this.rack);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class EndpointDetailsStandardSchemeFactory implements SchemeFactory {
public EndpointDetailsStandardScheme getScheme() {
return new EndpointDetailsStandardScheme();
}
}
private static class EndpointDetailsStandardScheme extends StandardScheme<EndpointDetails> {
public void read(org.apache.thrift.protocol.TProtocol iprot, EndpointDetails struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // HOST
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.host = iprot.readString();
struct.setHostIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // DATACENTER
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.datacenter = iprot.readString();
struct.setDatacenterIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // RACK
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.rack = iprot.readString();
struct.setRackIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, EndpointDetails struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.host != null) {
oprot.writeFieldBegin(HOST_FIELD_DESC);
oprot.writeString(struct.host);
oprot.writeFieldEnd();
}
if (struct.datacenter != null) {
oprot.writeFieldBegin(DATACENTER_FIELD_DESC);
oprot.writeString(struct.datacenter);
oprot.writeFieldEnd();
}
if (struct.rack != null) {
if (struct.isSetRack()) {
oprot.writeFieldBegin(RACK_FIELD_DESC);
oprot.writeString(struct.rack);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class EndpointDetailsTupleSchemeFactory implements SchemeFactory {
public EndpointDetailsTupleScheme getScheme() {
return new EndpointDetailsTupleScheme();
}
}
private static class EndpointDetailsTupleScheme extends TupleScheme<EndpointDetails> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, EndpointDetails struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetHost()) {
optionals.set(0);
}
if (struct.isSetDatacenter()) {
optionals.set(1);
}
if (struct.isSetRack()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetHost()) {
oprot.writeString(struct.host);
}
if (struct.isSetDatacenter()) {
oprot.writeString(struct.datacenter);
}
if (struct.isSetRack()) {
oprot.writeString(struct.rack);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, EndpointDetails struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.host = iprot.readString();
struct.setHostIsSet(true);
}
if (incoming.get(1)) {
struct.datacenter = iprot.readString();
struct.setDatacenterIsSet(true);
}
if (incoming.get(2)) {
struct.rack = iprot.readString();
struct.setRackIsSet(true);
}
}
}
}

View File

@ -1,681 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @deprecated use a KeyRange with row_filter in get_range_slices instead
*/
public class IndexClause implements org.apache.thrift.TBase<IndexClause, IndexClause._Fields>, java.io.Serializable, Cloneable, Comparable<IndexClause> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IndexClause");
private static final org.apache.thrift.protocol.TField EXPRESSIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("expressions", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final org.apache.thrift.protocol.TField START_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("start_key", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I32, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new IndexClauseStandardSchemeFactory());
schemes.put(TupleScheme.class, new IndexClauseTupleSchemeFactory());
}
public List<IndexExpression> expressions; // required
public ByteBuffer start_key; // required
public int count; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
EXPRESSIONS((short)1, "expressions"),
START_KEY((short)2, "start_key"),
COUNT((short)3, "count");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // EXPRESSIONS
return EXPRESSIONS;
case 2: // START_KEY
return START_KEY;
case 3: // COUNT
return COUNT;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __COUNT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.EXPRESSIONS, new org.apache.thrift.meta_data.FieldMetaData("expressions", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IndexExpression.class))));
tmpMap.put(_Fields.START_KEY, new org.apache.thrift.meta_data.FieldMetaData("start_key", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IndexClause.class, metaDataMap);
}
public IndexClause() {
this.count = 100;
}
public IndexClause(
List<IndexExpression> expressions,
ByteBuffer start_key,
int count)
{
this();
this.expressions = expressions;
this.start_key = start_key;
this.count = count;
setCountIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public IndexClause(IndexClause other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetExpressions()) {
List<IndexExpression> __this__expressions = new ArrayList<IndexExpression>(other.expressions.size());
for (IndexExpression other_element : other.expressions) {
__this__expressions.add(new IndexExpression(other_element));
}
this.expressions = __this__expressions;
}
if (other.isSetStart_key()) {
this.start_key = org.apache.thrift.TBaseHelper.copyBinary(other.start_key);
;
}
this.count = other.count;
}
public IndexClause deepCopy() {
return new IndexClause(this);
}
@Override
public void clear() {
this.expressions = null;
this.start_key = null;
this.count = 100;
}
public int getExpressionsSize() {
return (this.expressions == null) ? 0 : this.expressions.size();
}
public java.util.Iterator<IndexExpression> getExpressionsIterator() {
return (this.expressions == null) ? null : this.expressions.iterator();
}
public void addToExpressions(IndexExpression elem) {
if (this.expressions == null) {
this.expressions = new ArrayList<IndexExpression>();
}
this.expressions.add(elem);
}
public List<IndexExpression> getExpressions() {
return this.expressions;
}
public IndexClause setExpressions(List<IndexExpression> expressions) {
this.expressions = expressions;
return this;
}
public void unsetExpressions() {
this.expressions = null;
}
/** Returns true if field expressions is set (has been assigned a value) and false otherwise */
public boolean isSetExpressions() {
return this.expressions != null;
}
public void setExpressionsIsSet(boolean value) {
if (!value) {
this.expressions = null;
}
}
public byte[] getStart_key() {
setStart_key(org.apache.thrift.TBaseHelper.rightSize(start_key));
return start_key == null ? null : start_key.array();
}
public ByteBuffer bufferForStart_key() {
return start_key;
}
public IndexClause setStart_key(byte[] start_key) {
setStart_key(start_key == null ? (ByteBuffer)null : ByteBuffer.wrap(start_key));
return this;
}
public IndexClause setStart_key(ByteBuffer start_key) {
this.start_key = start_key;
return this;
}
public void unsetStart_key() {
this.start_key = null;
}
/** Returns true if field start_key is set (has been assigned a value) and false otherwise */
public boolean isSetStart_key() {
return this.start_key != null;
}
public void setStart_keyIsSet(boolean value) {
if (!value) {
this.start_key = null;
}
}
public int getCount() {
return this.count;
}
public IndexClause setCount(int count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case EXPRESSIONS:
if (value == null) {
unsetExpressions();
} else {
setExpressions((List<IndexExpression>)value);
}
break;
case START_KEY:
if (value == null) {
unsetStart_key();
} else {
setStart_key((ByteBuffer)value);
}
break;
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case EXPRESSIONS:
return getExpressions();
case START_KEY:
return getStart_key();
case COUNT:
return Integer.valueOf(getCount());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case EXPRESSIONS:
return isSetExpressions();
case START_KEY:
return isSetStart_key();
case COUNT:
return isSetCount();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof IndexClause)
return this.equals((IndexClause)that);
return false;
}
public boolean equals(IndexClause that) {
if (that == null)
return false;
boolean this_present_expressions = true && this.isSetExpressions();
boolean that_present_expressions = true && that.isSetExpressions();
if (this_present_expressions || that_present_expressions) {
if (!(this_present_expressions && that_present_expressions))
return false;
if (!this.expressions.equals(that.expressions))
return false;
}
boolean this_present_start_key = true && this.isSetStart_key();
boolean that_present_start_key = true && that.isSetStart_key();
if (this_present_start_key || that_present_start_key) {
if (!(this_present_start_key && that_present_start_key))
return false;
if (!this.start_key.equals(that.start_key))
return false;
}
boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_expressions = true && (isSetExpressions());
builder.append(present_expressions);
if (present_expressions)
builder.append(expressions);
boolean present_start_key = true && (isSetStart_key());
builder.append(present_start_key);
if (present_start_key)
builder.append(start_key);
boolean present_count = true;
builder.append(present_count);
if (present_count)
builder.append(count);
return builder.toHashCode();
}
@Override
public int compareTo(IndexClause other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetExpressions()).compareTo(other.isSetExpressions());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetExpressions()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expressions, other.expressions);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetStart_key()).compareTo(other.isSetStart_key());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStart_key()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_key, other.start_key);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCount()).compareTo(other.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, other.count);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("IndexClause(");
boolean first = true;
sb.append("expressions:");
if (this.expressions == null) {
sb.append("null");
} else {
sb.append(this.expressions);
}
first = false;
if (!first) sb.append(", ");
sb.append("start_key:");
if (this.start_key == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.start_key, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("count:");
sb.append(this.count);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (expressions == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'expressions' was not present! Struct: " + toString());
}
if (start_key == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'start_key' was not present! Struct: " + toString());
}
// alas, we cannot check 'count' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class IndexClauseStandardSchemeFactory implements SchemeFactory {
public IndexClauseStandardScheme getScheme() {
return new IndexClauseStandardScheme();
}
}
private static class IndexClauseStandardScheme extends StandardScheme<IndexClause> {
public void read(org.apache.thrift.protocol.TProtocol iprot, IndexClause struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // EXPRESSIONS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
struct.expressions = new ArrayList<IndexExpression>(_list24.size);
for (int _i25 = 0; _i25 < _list24.size; ++_i25)
{
IndexExpression _elem26;
_elem26 = new IndexExpression();
_elem26.read(iprot);
struct.expressions.add(_elem26);
}
iprot.readListEnd();
}
struct.setExpressionsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // START_KEY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.start_key = iprot.readBinary();
struct.setStart_keyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.count = iprot.readI32();
struct.setCountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetCount()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, IndexClause struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.expressions != null) {
oprot.writeFieldBegin(EXPRESSIONS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.expressions.size()));
for (IndexExpression _iter27 : struct.expressions)
{
_iter27.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (struct.start_key != null) {
oprot.writeFieldBegin(START_KEY_FIELD_DESC);
oprot.writeBinary(struct.start_key);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI32(struct.count);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class IndexClauseTupleSchemeFactory implements SchemeFactory {
public IndexClauseTupleScheme getScheme() {
return new IndexClauseTupleScheme();
}
}
private static class IndexClauseTupleScheme extends TupleScheme<IndexClause> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, IndexClause struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
{
oprot.writeI32(struct.expressions.size());
for (IndexExpression _iter28 : struct.expressions)
{
_iter28.write(oprot);
}
}
oprot.writeBinary(struct.start_key);
oprot.writeI32(struct.count);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, IndexClause struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
{
org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.expressions = new ArrayList<IndexExpression>(_list29.size);
for (int _i30 = 0; _i30 < _list29.size; ++_i30)
{
IndexExpression _elem31;
_elem31 = new IndexExpression();
_elem31.read(iprot);
struct.expressions.add(_elem31);
}
}
struct.setExpressionsIsSet(true);
struct.start_key = iprot.readBinary();
struct.setStart_keyIsSet(true);
struct.count = iprot.readI32();
struct.setCountIsSet(true);
}
}
}

View File

@ -1,650 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class IndexExpression implements org.apache.thrift.TBase<IndexExpression, IndexExpression._Fields>, java.io.Serializable, Cloneable, Comparable<IndexExpression> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IndexExpression");
private static final org.apache.thrift.protocol.TField COLUMN_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("column_name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField OP_FIELD_DESC = new org.apache.thrift.protocol.TField("op", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new IndexExpressionStandardSchemeFactory());
schemes.put(TupleScheme.class, new IndexExpressionTupleSchemeFactory());
}
public ByteBuffer column_name; // required
/**
*
* @see IndexOperator
*/
public IndexOperator op; // required
public ByteBuffer value; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN_NAME((short)1, "column_name"),
/**
*
* @see IndexOperator
*/
OP((short)2, "op"),
VALUE((short)3, "value");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COLUMN_NAME
return COLUMN_NAME;
case 2: // OP
return OP;
case 3: // VALUE
return VALUE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN_NAME, new org.apache.thrift.meta_data.FieldMetaData("column_name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.OP, new org.apache.thrift.meta_data.FieldMetaData("op", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, IndexOperator.class)));
tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IndexExpression.class, metaDataMap);
}
public IndexExpression() {
}
public IndexExpression(
ByteBuffer column_name,
IndexOperator op,
ByteBuffer value)
{
this();
this.column_name = column_name;
this.op = op;
this.value = value;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public IndexExpression(IndexExpression other) {
if (other.isSetColumn_name()) {
this.column_name = org.apache.thrift.TBaseHelper.copyBinary(other.column_name);
;
}
if (other.isSetOp()) {
this.op = other.op;
}
if (other.isSetValue()) {
this.value = org.apache.thrift.TBaseHelper.copyBinary(other.value);
;
}
}
public IndexExpression deepCopy() {
return new IndexExpression(this);
}
@Override
public void clear() {
this.column_name = null;
this.op = null;
this.value = null;
}
public byte[] getColumn_name() {
setColumn_name(org.apache.thrift.TBaseHelper.rightSize(column_name));
return column_name == null ? null : column_name.array();
}
public ByteBuffer bufferForColumn_name() {
return column_name;
}
public IndexExpression setColumn_name(byte[] column_name) {
setColumn_name(column_name == null ? (ByteBuffer)null : ByteBuffer.wrap(column_name));
return this;
}
public IndexExpression setColumn_name(ByteBuffer column_name) {
this.column_name = column_name;
return this;
}
public void unsetColumn_name() {
this.column_name = null;
}
/** Returns true if field column_name is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_name() {
return this.column_name != null;
}
public void setColumn_nameIsSet(boolean value) {
if (!value) {
this.column_name = null;
}
}
/**
*
* @see IndexOperator
*/
public IndexOperator getOp() {
return this.op;
}
/**
*
* @see IndexOperator
*/
public IndexExpression setOp(IndexOperator op) {
this.op = op;
return this;
}
public void unsetOp() {
this.op = null;
}
/** Returns true if field op is set (has been assigned a value) and false otherwise */
public boolean isSetOp() {
return this.op != null;
}
public void setOpIsSet(boolean value) {
if (!value) {
this.op = null;
}
}
public byte[] getValue() {
setValue(org.apache.thrift.TBaseHelper.rightSize(value));
return value == null ? null : value.array();
}
public ByteBuffer bufferForValue() {
return value;
}
public IndexExpression setValue(byte[] value) {
setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value));
return this;
}
public IndexExpression setValue(ByteBuffer value) {
this.value = value;
return this;
}
public void unsetValue() {
this.value = null;
}
/** Returns true if field value is set (has been assigned a value) and false otherwise */
public boolean isSetValue() {
return this.value != null;
}
public void setValueIsSet(boolean value) {
if (!value) {
this.value = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN_NAME:
if (value == null) {
unsetColumn_name();
} else {
setColumn_name((ByteBuffer)value);
}
break;
case OP:
if (value == null) {
unsetOp();
} else {
setOp((IndexOperator)value);
}
break;
case VALUE:
if (value == null) {
unsetValue();
} else {
setValue((ByteBuffer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_NAME:
return getColumn_name();
case OP:
return getOp();
case VALUE:
return getValue();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_NAME:
return isSetColumn_name();
case OP:
return isSetOp();
case VALUE:
return isSetValue();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof IndexExpression)
return this.equals((IndexExpression)that);
return false;
}
public boolean equals(IndexExpression that) {
if (that == null)
return false;
boolean this_present_column_name = true && this.isSetColumn_name();
boolean that_present_column_name = true && that.isSetColumn_name();
if (this_present_column_name || that_present_column_name) {
if (!(this_present_column_name && that_present_column_name))
return false;
if (!this.column_name.equals(that.column_name))
return false;
}
boolean this_present_op = true && this.isSetOp();
boolean that_present_op = true && that.isSetOp();
if (this_present_op || that_present_op) {
if (!(this_present_op && that_present_op))
return false;
if (!this.op.equals(that.op))
return false;
}
boolean this_present_value = true && this.isSetValue();
boolean that_present_value = true && that.isSetValue();
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
if (!this.value.equals(that.value))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_column_name = true && (isSetColumn_name());
builder.append(present_column_name);
if (present_column_name)
builder.append(column_name);
boolean present_op = true && (isSetOp());
builder.append(present_op);
if (present_op)
builder.append(op.getValue());
boolean present_value = true && (isSetValue());
builder.append(present_value);
if (present_value)
builder.append(value);
return builder.toHashCode();
}
@Override
public int compareTo(IndexExpression other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetColumn_name()).compareTo(other.isSetColumn_name());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn_name()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_name, other.column_name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetOp()).compareTo(other.isSetOp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetOp()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.op, other.op);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("IndexExpression(");
boolean first = true;
sb.append("column_name:");
if (this.column_name == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.column_name, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("op:");
if (this.op == null) {
sb.append("null");
} else {
sb.append(this.op);
}
first = false;
if (!first) sb.append(", ");
sb.append("value:");
if (this.value == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.value, sb);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (column_name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'column_name' was not present! Struct: " + toString());
}
if (op == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'op' was not present! Struct: " + toString());
}
if (value == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class IndexExpressionStandardSchemeFactory implements SchemeFactory {
public IndexExpressionStandardScheme getScheme() {
return new IndexExpressionStandardScheme();
}
}
private static class IndexExpressionStandardScheme extends StandardScheme<IndexExpression> {
public void read(org.apache.thrift.protocol.TProtocol iprot, IndexExpression struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // COLUMN_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.column_name = iprot.readBinary();
struct.setColumn_nameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // OP
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.op = IndexOperator.findByValue(iprot.readI32());
struct.setOpIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // VALUE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.value = iprot.readBinary();
struct.setValueIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, IndexExpression struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.column_name != null) {
oprot.writeFieldBegin(COLUMN_NAME_FIELD_DESC);
oprot.writeBinary(struct.column_name);
oprot.writeFieldEnd();
}
if (struct.op != null) {
oprot.writeFieldBegin(OP_FIELD_DESC);
oprot.writeI32(struct.op.getValue());
oprot.writeFieldEnd();
}
if (struct.value != null) {
oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeBinary(struct.value);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class IndexExpressionTupleSchemeFactory implements SchemeFactory {
public IndexExpressionTupleScheme getScheme() {
return new IndexExpressionTupleScheme();
}
}
private static class IndexExpressionTupleScheme extends TupleScheme<IndexExpression> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, IndexExpression struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.column_name);
oprot.writeI32(struct.op.getValue());
oprot.writeBinary(struct.value);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, IndexExpression struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.column_name = iprot.readBinary();
struct.setColumn_nameIsSet(true);
struct.op = IndexOperator.findByValue(iprot.readI32());
struct.setOpIsSet(true);
struct.value = iprot.readBinary();
struct.setValueIsSet(true);
}
}
}

View File

@ -1,75 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
public enum IndexOperator implements org.apache.thrift.TEnum {
EQ(0),
GTE(1),
GT(2),
LTE(3),
LT(4);
private final int value;
private IndexOperator(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static IndexOperator findByValue(int value) {
switch (value) {
case 0:
return EQ;
case 1:
return GTE;
case 2:
return GT;
case 3:
return LTE;
case 4:
return LT;
default:
return null;
}
}
}

View File

@ -1,69 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import java.util.Map;
import java.util.HashMap;
import org.apache.thrift.TEnum;
public enum IndexType implements org.apache.thrift.TEnum {
KEYS(0),
CUSTOM(1),
COMPOSITES(2);
private final int value;
private IndexType(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
public static IndexType findByValue(int value) {
switch (value) {
case 0:
return KEYS;
case 1:
return CUSTOM;
case 2:
return COMPOSITES;
default:
return null;
}
}
}

View File

@ -1,414 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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.
*/
public class InvalidRequestException extends TException implements org.apache.thrift.TBase<InvalidRequestException, InvalidRequestException._Fields>, java.io.Serializable, Cloneable, Comparable<InvalidRequestException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidRequestException");
private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new InvalidRequestExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new InvalidRequestExceptionTupleSchemeFactory());
}
public String why; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
WHY((short)1, "why");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // WHY
return WHY;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.WHY, new org.apache.thrift.meta_data.FieldMetaData("why", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InvalidRequestException.class, metaDataMap);
}
public InvalidRequestException() {
}
public InvalidRequestException(
String why)
{
this();
this.why = why;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public InvalidRequestException(InvalidRequestException other) {
if (other.isSetWhy()) {
this.why = other.why;
}
}
public InvalidRequestException deepCopy() {
return new InvalidRequestException(this);
}
@Override
public void clear() {
this.why = null;
}
public String getWhy() {
return this.why;
}
public InvalidRequestException setWhy(String why) {
this.why = why;
return this;
}
public void unsetWhy() {
this.why = null;
}
/** Returns true if field why is set (has been assigned a value) and false otherwise */
public boolean isSetWhy() {
return this.why != null;
}
public void setWhyIsSet(boolean value) {
if (!value) {
this.why = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case WHY:
if (value == null) {
unsetWhy();
} else {
setWhy((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case WHY:
return getWhy();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case WHY:
return isSetWhy();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof InvalidRequestException)
return this.equals((InvalidRequestException)that);
return false;
}
public boolean equals(InvalidRequestException that) {
if (that == null)
return false;
boolean this_present_why = true && this.isSetWhy();
boolean that_present_why = true && that.isSetWhy();
if (this_present_why || that_present_why) {
if (!(this_present_why && that_present_why))
return false;
if (!this.why.equals(that.why))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_why = true && (isSetWhy());
builder.append(present_why);
if (present_why)
builder.append(why);
return builder.toHashCode();
}
@Override
public int compareTo(InvalidRequestException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetWhy()).compareTo(other.isSetWhy());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWhy()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.why, other.why);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("InvalidRequestException(");
boolean first = true;
sb.append("why:");
if (this.why == null) {
sb.append("null");
} else {
sb.append(this.why);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (why == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'why' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class InvalidRequestExceptionStandardSchemeFactory implements SchemeFactory {
public InvalidRequestExceptionStandardScheme getScheme() {
return new InvalidRequestExceptionStandardScheme();
}
}
private static class InvalidRequestExceptionStandardScheme extends StandardScheme<InvalidRequestException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, InvalidRequestException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // WHY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.why = iprot.readString();
struct.setWhyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, InvalidRequestException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.why != null) {
oprot.writeFieldBegin(WHY_FIELD_DESC);
oprot.writeString(struct.why);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class InvalidRequestExceptionTupleSchemeFactory implements SchemeFactory {
public InvalidRequestExceptionTupleScheme getScheme() {
return new InvalidRequestExceptionTupleScheme();
}
}
private static class InvalidRequestExceptionTupleScheme extends TupleScheme<InvalidRequestException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, InvalidRequestException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.why);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, InvalidRequestException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.why = iprot.readString();
struct.setWhyIsSet(true);
}
}
}

View File

@ -1,521 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class KeyCount implements org.apache.thrift.TBase<KeyCount, KeyCount._Fields>, java.io.Serializable, Cloneable, Comparable<KeyCount> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("KeyCount");
private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I32, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new KeyCountStandardSchemeFactory());
schemes.put(TupleScheme.class, new KeyCountTupleSchemeFactory());
}
public ByteBuffer key; // required
public int count; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
KEY((short)1, "key"),
COUNT((short)2, "count");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // KEY
return KEY;
case 2: // COUNT
return COUNT;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __COUNT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(KeyCount.class, metaDataMap);
}
public KeyCount() {
}
public KeyCount(
ByteBuffer key,
int count)
{
this();
this.key = key;
this.count = count;
setCountIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public KeyCount(KeyCount other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetKey()) {
this.key = org.apache.thrift.TBaseHelper.copyBinary(other.key);
;
}
this.count = other.count;
}
public KeyCount deepCopy() {
return new KeyCount(this);
}
@Override
public void clear() {
this.key = null;
setCountIsSet(false);
this.count = 0;
}
public byte[] getKey() {
setKey(org.apache.thrift.TBaseHelper.rightSize(key));
return key == null ? null : key.array();
}
public ByteBuffer bufferForKey() {
return key;
}
public KeyCount setKey(byte[] key) {
setKey(key == null ? (ByteBuffer)null : ByteBuffer.wrap(key));
return this;
}
public KeyCount setKey(ByteBuffer key) {
this.key = key;
return this;
}
public void unsetKey() {
this.key = null;
}
/** Returns true if field key is set (has been assigned a value) and false otherwise */
public boolean isSetKey() {
return this.key != null;
}
public void setKeyIsSet(boolean value) {
if (!value) {
this.key = null;
}
}
public int getCount() {
return this.count;
}
public KeyCount setCount(int count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case KEY:
if (value == null) {
unsetKey();
} else {
setKey((ByteBuffer)value);
}
break;
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case KEY:
return getKey();
case COUNT:
return Integer.valueOf(getCount());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case KEY:
return isSetKey();
case COUNT:
return isSetCount();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof KeyCount)
return this.equals((KeyCount)that);
return false;
}
public boolean equals(KeyCount that) {
if (that == null)
return false;
boolean this_present_key = true && this.isSetKey();
boolean that_present_key = true && that.isSetKey();
if (this_present_key || that_present_key) {
if (!(this_present_key && that_present_key))
return false;
if (!this.key.equals(that.key))
return false;
}
boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_key = true && (isSetKey());
builder.append(present_key);
if (present_key)
builder.append(key);
boolean present_count = true;
builder.append(present_count);
if (present_count)
builder.append(count);
return builder.toHashCode();
}
@Override
public int compareTo(KeyCount other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetKey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCount()).compareTo(other.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, other.count);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("KeyCount(");
boolean first = true;
sb.append("key:");
if (this.key == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.key, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("count:");
sb.append(this.count);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (key == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'key' was not present! Struct: " + toString());
}
// alas, we cannot check 'count' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class KeyCountStandardSchemeFactory implements SchemeFactory {
public KeyCountStandardScheme getScheme() {
return new KeyCountStandardScheme();
}
}
private static class KeyCountStandardScheme extends StandardScheme<KeyCount> {
public void read(org.apache.thrift.protocol.TProtocol iprot, KeyCount struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // KEY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.key = iprot.readBinary();
struct.setKeyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.count = iprot.readI32();
struct.setCountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetCount()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, KeyCount struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.key != null) {
oprot.writeFieldBegin(KEY_FIELD_DESC);
oprot.writeBinary(struct.key);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI32(struct.count);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class KeyCountTupleSchemeFactory implements SchemeFactory {
public KeyCountTupleScheme getScheme() {
return new KeyCountTupleScheme();
}
}
private static class KeyCountTupleScheme extends TupleScheme<KeyCount> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, KeyCount struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.key);
oprot.writeI32(struct.count);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, KeyCount struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.key = iprot.readBinary();
struct.setKeyIsSet(true);
struct.count = iprot.readI32();
struct.setCountIsSet(true);
}
}
}

View File

@ -1,583 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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.
*/
public class KeySlice implements org.apache.thrift.TBase<KeySlice, KeySlice._Fields>, java.io.Serializable, Cloneable, Comparable<KeySlice> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("KeySlice");
private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new KeySliceStandardSchemeFactory());
schemes.put(TupleScheme.class, new KeySliceTupleSchemeFactory());
}
public ByteBuffer key; // required
public List<ColumnOrSuperColumn> columns; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
KEY((short)1, "key"),
COLUMNS((short)2, "columns");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // KEY
return KEY;
case 2: // COLUMNS
return COLUMNS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnOrSuperColumn.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(KeySlice.class, metaDataMap);
}
public KeySlice() {
}
public KeySlice(
ByteBuffer key,
List<ColumnOrSuperColumn> columns)
{
this();
this.key = key;
this.columns = columns;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public KeySlice(KeySlice other) {
if (other.isSetKey()) {
this.key = org.apache.thrift.TBaseHelper.copyBinary(other.key);
;
}
if (other.isSetColumns()) {
List<ColumnOrSuperColumn> __this__columns = new ArrayList<ColumnOrSuperColumn>(other.columns.size());
for (ColumnOrSuperColumn other_element : other.columns) {
__this__columns.add(new ColumnOrSuperColumn(other_element));
}
this.columns = __this__columns;
}
}
public KeySlice deepCopy() {
return new KeySlice(this);
}
@Override
public void clear() {
this.key = null;
this.columns = null;
}
public byte[] getKey() {
setKey(org.apache.thrift.TBaseHelper.rightSize(key));
return key == null ? null : key.array();
}
public ByteBuffer bufferForKey() {
return key;
}
public KeySlice setKey(byte[] key) {
setKey(key == null ? (ByteBuffer)null : ByteBuffer.wrap(key));
return this;
}
public KeySlice setKey(ByteBuffer key) {
this.key = key;
return this;
}
public void unsetKey() {
this.key = null;
}
/** Returns true if field key is set (has been assigned a value) and false otherwise */
public boolean isSetKey() {
return this.key != null;
}
public void setKeyIsSet(boolean value) {
if (!value) {
this.key = null;
}
}
public int getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
public java.util.Iterator<ColumnOrSuperColumn> getColumnsIterator() {
return (this.columns == null) ? null : this.columns.iterator();
}
public void addToColumns(ColumnOrSuperColumn elem) {
if (this.columns == null) {
this.columns = new ArrayList<ColumnOrSuperColumn>();
}
this.columns.add(elem);
}
public List<ColumnOrSuperColumn> getColumns() {
return this.columns;
}
public KeySlice setColumns(List<ColumnOrSuperColumn> columns) {
this.columns = columns;
return this;
}
public void unsetColumns() {
this.columns = null;
}
/** Returns true if field columns is set (has been assigned a value) and false otherwise */
public boolean isSetColumns() {
return this.columns != null;
}
public void setColumnsIsSet(boolean value) {
if (!value) {
this.columns = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case KEY:
if (value == null) {
unsetKey();
} else {
setKey((ByteBuffer)value);
}
break;
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((List<ColumnOrSuperColumn>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case KEY:
return getKey();
case COLUMNS:
return getColumns();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case KEY:
return isSetKey();
case COLUMNS:
return isSetColumns();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof KeySlice)
return this.equals((KeySlice)that);
return false;
}
public boolean equals(KeySlice that) {
if (that == null)
return false;
boolean this_present_key = true && this.isSetKey();
boolean that_present_key = true && that.isSetKey();
if (this_present_key || that_present_key) {
if (!(this_present_key && that_present_key))
return false;
if (!this.key.equals(that.key))
return false;
}
boolean this_present_columns = true && this.isSetColumns();
boolean that_present_columns = true && that.isSetColumns();
if (this_present_columns || that_present_columns) {
if (!(this_present_columns && that_present_columns))
return false;
if (!this.columns.equals(that.columns))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_key = true && (isSetKey());
builder.append(present_key);
if (present_key)
builder.append(key);
boolean present_columns = true && (isSetColumns());
builder.append(present_columns);
if (present_columns)
builder.append(columns);
return builder.toHashCode();
}
@Override
public int compareTo(KeySlice other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetKey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("KeySlice(");
boolean first = true;
sb.append("key:");
if (this.key == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.key, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("columns:");
if (this.columns == null) {
sb.append("null");
} else {
sb.append(this.columns);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (key == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'key' was not present! Struct: " + toString());
}
if (columns == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class KeySliceStandardSchemeFactory implements SchemeFactory {
public KeySliceStandardScheme getScheme() {
return new KeySliceStandardScheme();
}
}
private static class KeySliceStandardScheme extends StandardScheme<KeySlice> {
public void read(org.apache.thrift.protocol.TProtocol iprot, KeySlice struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // KEY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.key = iprot.readBinary();
struct.setKeyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COLUMNS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list40 = iprot.readListBegin();
struct.columns = new ArrayList<ColumnOrSuperColumn>(_list40.size);
for (int _i41 = 0; _i41 < _list40.size; ++_i41)
{
ColumnOrSuperColumn _elem42;
_elem42 = new ColumnOrSuperColumn();
_elem42.read(iprot);
struct.columns.add(_elem42);
}
iprot.readListEnd();
}
struct.setColumnsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, KeySlice struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.key != null) {
oprot.writeFieldBegin(KEY_FIELD_DESC);
oprot.writeBinary(struct.key);
oprot.writeFieldEnd();
}
if (struct.columns != null) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
for (ColumnOrSuperColumn _iter43 : struct.columns)
{
_iter43.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class KeySliceTupleSchemeFactory implements SchemeFactory {
public KeySliceTupleScheme getScheme() {
return new KeySliceTupleScheme();
}
}
private static class KeySliceTupleScheme extends TupleScheme<KeySlice> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, KeySlice struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.key);
{
oprot.writeI32(struct.columns.size());
for (ColumnOrSuperColumn _iter44 : struct.columns)
{
_iter44.write(oprot);
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, KeySlice struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.key = iprot.readBinary();
struct.setKeyIsSet(true);
{
org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.columns = new ArrayList<ColumnOrSuperColumn>(_list45.size);
for (int _i46 = 0; _i46 < _list45.size; ++_i46)
{
ColumnOrSuperColumn _elem47;
_elem47 = new ColumnOrSuperColumn();
_elem47.read(iprot);
struct.columns.add(_elem47);
}
}
struct.setColumnsIsSet(true);
}
}
}

View File

@ -1,537 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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 (possibly counter column or supercolumn)
* @param deletion. A deletion of a column or supercolumn
*/
public class Mutation implements org.apache.thrift.TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable, Comparable<Mutation> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Mutation");
private static final org.apache.thrift.protocol.TField COLUMN_OR_SUPERCOLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column_or_supercolumn", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField DELETION_FIELD_DESC = new org.apache.thrift.protocol.TField("deletion", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new MutationStandardSchemeFactory());
schemes.put(TupleScheme.class, new MutationTupleSchemeFactory());
}
public ColumnOrSuperColumn column_or_supercolumn; // optional
public Deletion deletion; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN_OR_SUPERCOLUMN((short)1, "column_or_supercolumn"),
DELETION((short)2, "deletion");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COLUMN_OR_SUPERCOLUMN
return COLUMN_OR_SUPERCOLUMN;
case 2: // DELETION
return DELETION;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.COLUMN_OR_SUPERCOLUMN,_Fields.DELETION};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN_OR_SUPERCOLUMN, new org.apache.thrift.meta_data.FieldMetaData("column_or_supercolumn", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnOrSuperColumn.class)));
tmpMap.put(_Fields.DELETION, new org.apache.thrift.meta_data.FieldMetaData("deletion", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Deletion.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
}
public Mutation() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public Mutation(Mutation other) {
if (other.isSetColumn_or_supercolumn()) {
this.column_or_supercolumn = new ColumnOrSuperColumn(other.column_or_supercolumn);
}
if (other.isSetDeletion()) {
this.deletion = new Deletion(other.deletion);
}
}
public Mutation deepCopy() {
return new Mutation(this);
}
@Override
public void clear() {
this.column_or_supercolumn = null;
this.deletion = null;
}
public ColumnOrSuperColumn getColumn_or_supercolumn() {
return this.column_or_supercolumn;
}
public Mutation setColumn_or_supercolumn(ColumnOrSuperColumn column_or_supercolumn) {
this.column_or_supercolumn = column_or_supercolumn;
return this;
}
public void unsetColumn_or_supercolumn() {
this.column_or_supercolumn = null;
}
/** Returns true if field column_or_supercolumn is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_or_supercolumn() {
return this.column_or_supercolumn != null;
}
public void setColumn_or_supercolumnIsSet(boolean value) {
if (!value) {
this.column_or_supercolumn = null;
}
}
public Deletion getDeletion() {
return this.deletion;
}
public Mutation setDeletion(Deletion deletion) {
this.deletion = deletion;
return this;
}
public void unsetDeletion() {
this.deletion = null;
}
/** Returns true if field deletion is set (has been assigned a value) and false otherwise */
public boolean isSetDeletion() {
return this.deletion != null;
}
public void setDeletionIsSet(boolean value) {
if (!value) {
this.deletion = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN_OR_SUPERCOLUMN:
if (value == null) {
unsetColumn_or_supercolumn();
} else {
setColumn_or_supercolumn((ColumnOrSuperColumn)value);
}
break;
case DELETION:
if (value == null) {
unsetDeletion();
} else {
setDeletion((Deletion)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_OR_SUPERCOLUMN:
return getColumn_or_supercolumn();
case DELETION:
return getDeletion();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_OR_SUPERCOLUMN:
return isSetColumn_or_supercolumn();
case DELETION:
return isSetDeletion();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Mutation)
return this.equals((Mutation)that);
return false;
}
public boolean equals(Mutation that) {
if (that == null)
return false;
boolean this_present_column_or_supercolumn = true && this.isSetColumn_or_supercolumn();
boolean that_present_column_or_supercolumn = true && that.isSetColumn_or_supercolumn();
if (this_present_column_or_supercolumn || that_present_column_or_supercolumn) {
if (!(this_present_column_or_supercolumn && that_present_column_or_supercolumn))
return false;
if (!this.column_or_supercolumn.equals(that.column_or_supercolumn))
return false;
}
boolean this_present_deletion = true && this.isSetDeletion();
boolean that_present_deletion = true && that.isSetDeletion();
if (this_present_deletion || that_present_deletion) {
if (!(this_present_deletion && that_present_deletion))
return false;
if (!this.deletion.equals(that.deletion))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_column_or_supercolumn = true && (isSetColumn_or_supercolumn());
builder.append(present_column_or_supercolumn);
if (present_column_or_supercolumn)
builder.append(column_or_supercolumn);
boolean present_deletion = true && (isSetDeletion());
builder.append(present_deletion);
if (present_deletion)
builder.append(deletion);
return builder.toHashCode();
}
@Override
public int compareTo(Mutation other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetColumn_or_supercolumn()).compareTo(other.isSetColumn_or_supercolumn());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn_or_supercolumn()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_or_supercolumn, other.column_or_supercolumn);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDeletion()).compareTo(other.isSetDeletion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDeletion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deletion, other.deletion);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Mutation(");
boolean first = true;
if (isSetColumn_or_supercolumn()) {
sb.append("column_or_supercolumn:");
if (this.column_or_supercolumn == null) {
sb.append("null");
} else {
sb.append(this.column_or_supercolumn);
}
first = false;
}
if (isSetDeletion()) {
if (!first) sb.append(", ");
sb.append("deletion:");
if (this.deletion == null) {
sb.append("null");
} else {
sb.append(this.deletion);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (column_or_supercolumn != null) {
column_or_supercolumn.validate();
}
if (deletion != null) {
deletion.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class MutationStandardSchemeFactory implements SchemeFactory {
public MutationStandardScheme getScheme() {
return new MutationStandardScheme();
}
}
private static class MutationStandardScheme extends StandardScheme<Mutation> {
public void read(org.apache.thrift.protocol.TProtocol iprot, Mutation struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // COLUMN_OR_SUPERCOLUMN
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.column_or_supercolumn = new ColumnOrSuperColumn();
struct.column_or_supercolumn.read(iprot);
struct.setColumn_or_supercolumnIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // DELETION
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.deletion = new Deletion();
struct.deletion.read(iprot);
struct.setDeletionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, Mutation struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.column_or_supercolumn != null) {
if (struct.isSetColumn_or_supercolumn()) {
oprot.writeFieldBegin(COLUMN_OR_SUPERCOLUMN_FIELD_DESC);
struct.column_or_supercolumn.write(oprot);
oprot.writeFieldEnd();
}
}
if (struct.deletion != null) {
if (struct.isSetDeletion()) {
oprot.writeFieldBegin(DELETION_FIELD_DESC);
struct.deletion.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class MutationTupleSchemeFactory implements SchemeFactory {
public MutationTupleScheme getScheme() {
return new MutationTupleScheme();
}
}
private static class MutationTupleScheme extends TupleScheme<Mutation> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, Mutation struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetColumn_or_supercolumn()) {
optionals.set(0);
}
if (struct.isSetDeletion()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetColumn_or_supercolumn()) {
struct.column_or_supercolumn.write(oprot);
}
if (struct.isSetDeletion()) {
struct.deletion.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, Mutation struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.column_or_supercolumn = new ColumnOrSuperColumn();
struct.column_or_supercolumn.read(iprot);
struct.setColumn_or_supercolumnIsSet(true);
}
if (incoming.get(1)) {
struct.deletion = new Deletion();
struct.deletion.read(iprot);
struct.setDeletionIsSet(true);
}
}
}
}

View File

@ -1,307 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A specific column was requested that does not exist.
*/
public class NotFoundException extends TException implements org.apache.thrift.TBase<NotFoundException, NotFoundException._Fields>, java.io.Serializable, Cloneable, Comparable<NotFoundException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("NotFoundException");
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new NotFoundExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new NotFoundExceptionTupleSchemeFactory());
}
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NotFoundException.class, metaDataMap);
}
public NotFoundException() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public NotFoundException(NotFoundException other) {
}
public NotFoundException deepCopy() {
return new NotFoundException(this);
}
@Override
public void clear() {
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof NotFoundException)
return this.equals((NotFoundException)that);
return false;
}
public boolean equals(NotFoundException that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
return builder.toHashCode();
}
@Override
public int compareTo(NotFoundException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("NotFoundException(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class NotFoundExceptionStandardSchemeFactory implements SchemeFactory {
public NotFoundExceptionStandardScheme getScheme() {
return new NotFoundExceptionStandardScheme();
}
}
private static class NotFoundExceptionStandardScheme extends StandardScheme<NotFoundException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, NotFoundException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, NotFoundException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class NotFoundExceptionTupleSchemeFactory implements SchemeFactory {
public NotFoundExceptionTupleScheme getScheme() {
return new NotFoundExceptionTupleScheme();
}
}
private static class NotFoundExceptionTupleScheme extends TupleScheme<NotFoundException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, NotFoundException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, NotFoundException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
}
}
}

View File

@ -1,310 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* NOTE: This up outdated exception left for backward compatibility reasons,
* no actual schema agreement validation is done starting from Cassandra 1.2
*
* schemas are not in agreement across all nodes
*/
public class SchemaDisagreementException extends TException implements org.apache.thrift.TBase<SchemaDisagreementException, SchemaDisagreementException._Fields>, java.io.Serializable, Cloneable, Comparable<SchemaDisagreementException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SchemaDisagreementException");
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new SchemaDisagreementExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new SchemaDisagreementExceptionTupleSchemeFactory());
}
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SchemaDisagreementException.class, metaDataMap);
}
public SchemaDisagreementException() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public SchemaDisagreementException(SchemaDisagreementException other) {
}
public SchemaDisagreementException deepCopy() {
return new SchemaDisagreementException(this);
}
@Override
public void clear() {
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof SchemaDisagreementException)
return this.equals((SchemaDisagreementException)that);
return false;
}
public boolean equals(SchemaDisagreementException that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
return builder.toHashCode();
}
@Override
public int compareTo(SchemaDisagreementException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("SchemaDisagreementException(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class SchemaDisagreementExceptionStandardSchemeFactory implements SchemeFactory {
public SchemaDisagreementExceptionStandardScheme getScheme() {
return new SchemaDisagreementExceptionStandardScheme();
}
}
private static class SchemaDisagreementExceptionStandardScheme extends StandardScheme<SchemaDisagreementException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, SchemaDisagreementException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, SchemaDisagreementException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class SchemaDisagreementExceptionTupleSchemeFactory implements SchemeFactory {
public SchemaDisagreementExceptionTupleScheme getScheme() {
return new SchemaDisagreementExceptionTupleScheme();
}
}
private static class SchemaDisagreementExceptionTupleScheme extends TupleScheme<SchemaDisagreementException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, SchemaDisagreementException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, SchemaDisagreementException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
}
}
}

View File

@ -1,588 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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.
*/
public class SlicePredicate implements org.apache.thrift.TBase<SlicePredicate, SlicePredicate._Fields>, java.io.Serializable, Cloneable, Comparable<SlicePredicate> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SlicePredicate");
private static final org.apache.thrift.protocol.TField COLUMN_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("column_names", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final org.apache.thrift.protocol.TField SLICE_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("slice_range", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new SlicePredicateStandardSchemeFactory());
schemes.put(TupleScheme.class, new SlicePredicateTupleSchemeFactory());
}
public List<ByteBuffer> column_names; // optional
public SliceRange slice_range; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN_NAMES((short)1, "column_names"),
SLICE_RANGE((short)2, "slice_range");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COLUMN_NAMES
return COLUMN_NAMES;
case 2: // SLICE_RANGE
return SLICE_RANGE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.COLUMN_NAMES,_Fields.SLICE_RANGE};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN_NAMES, new org.apache.thrift.meta_data.FieldMetaData("column_names", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
tmpMap.put(_Fields.SLICE_RANGE, new org.apache.thrift.meta_data.FieldMetaData("slice_range", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SliceRange.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SlicePredicate.class, metaDataMap);
}
public SlicePredicate() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public SlicePredicate(SlicePredicate other) {
if (other.isSetColumn_names()) {
List<ByteBuffer> __this__column_names = new ArrayList<ByteBuffer>(other.column_names);
this.column_names = __this__column_names;
}
if (other.isSetSlice_range()) {
this.slice_range = new SliceRange(other.slice_range);
}
}
public SlicePredicate deepCopy() {
return new SlicePredicate(this);
}
@Override
public void clear() {
this.column_names = null;
this.slice_range = null;
}
public int getColumn_namesSize() {
return (this.column_names == null) ? 0 : this.column_names.size();
}
public java.util.Iterator<ByteBuffer> getColumn_namesIterator() {
return (this.column_names == null) ? null : this.column_names.iterator();
}
public void addToColumn_names(ByteBuffer elem) {
if (this.column_names == null) {
this.column_names = new ArrayList<ByteBuffer>();
}
this.column_names.add(elem);
}
public List<ByteBuffer> getColumn_names() {
return this.column_names;
}
public SlicePredicate setColumn_names(List<ByteBuffer> column_names) {
this.column_names = column_names;
return this;
}
public void unsetColumn_names() {
this.column_names = null;
}
/** Returns true if field column_names is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_names() {
return this.column_names != null;
}
public void setColumn_namesIsSet(boolean value) {
if (!value) {
this.column_names = null;
}
}
public SliceRange getSlice_range() {
return this.slice_range;
}
public SlicePredicate setSlice_range(SliceRange slice_range) {
this.slice_range = slice_range;
return this;
}
public void unsetSlice_range() {
this.slice_range = null;
}
/** Returns true if field slice_range is set (has been assigned a value) and false otherwise */
public boolean isSetSlice_range() {
return this.slice_range != null;
}
public void setSlice_rangeIsSet(boolean value) {
if (!value) {
this.slice_range = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN_NAMES:
if (value == null) {
unsetColumn_names();
} else {
setColumn_names((List<ByteBuffer>)value);
}
break;
case SLICE_RANGE:
if (value == null) {
unsetSlice_range();
} else {
setSlice_range((SliceRange)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_NAMES:
return getColumn_names();
case SLICE_RANGE:
return getSlice_range();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_NAMES:
return isSetColumn_names();
case SLICE_RANGE:
return isSetSlice_range();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof SlicePredicate)
return this.equals((SlicePredicate)that);
return false;
}
public boolean equals(SlicePredicate that) {
if (that == null)
return false;
boolean this_present_column_names = true && this.isSetColumn_names();
boolean that_present_column_names = true && that.isSetColumn_names();
if (this_present_column_names || that_present_column_names) {
if (!(this_present_column_names && that_present_column_names))
return false;
if (!this.column_names.equals(that.column_names))
return false;
}
boolean this_present_slice_range = true && this.isSetSlice_range();
boolean that_present_slice_range = true && that.isSetSlice_range();
if (this_present_slice_range || that_present_slice_range) {
if (!(this_present_slice_range && that_present_slice_range))
return false;
if (!this.slice_range.equals(that.slice_range))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_column_names = true && (isSetColumn_names());
builder.append(present_column_names);
if (present_column_names)
builder.append(column_names);
boolean present_slice_range = true && (isSetSlice_range());
builder.append(present_slice_range);
if (present_slice_range)
builder.append(slice_range);
return builder.toHashCode();
}
@Override
public int compareTo(SlicePredicate other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetColumn_names()).compareTo(other.isSetColumn_names());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn_names()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_names, other.column_names);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSlice_range()).compareTo(other.isSetSlice_range());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSlice_range()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.slice_range, other.slice_range);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("SlicePredicate(");
boolean first = true;
if (isSetColumn_names()) {
sb.append("column_names:");
if (this.column_names == null) {
sb.append("null");
} else {
sb.append(this.column_names);
}
first = false;
}
if (isSetSlice_range()) {
if (!first) sb.append(", ");
sb.append("slice_range:");
if (this.slice_range == null) {
sb.append("null");
} else {
sb.append(this.slice_range);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (slice_range != null) {
slice_range.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class SlicePredicateStandardSchemeFactory implements SchemeFactory {
public SlicePredicateStandardScheme getScheme() {
return new SlicePredicateStandardScheme();
}
}
private static class SlicePredicateStandardScheme extends StandardScheme<SlicePredicate> {
public void read(org.apache.thrift.protocol.TProtocol iprot, SlicePredicate struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // COLUMN_NAMES
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
struct.column_names = new ArrayList<ByteBuffer>(_list16.size);
for (int _i17 = 0; _i17 < _list16.size; ++_i17)
{
ByteBuffer _elem18;
_elem18 = iprot.readBinary();
struct.column_names.add(_elem18);
}
iprot.readListEnd();
}
struct.setColumn_namesIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // SLICE_RANGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.slice_range = new SliceRange();
struct.slice_range.read(iprot);
struct.setSlice_rangeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, SlicePredicate struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.column_names != null) {
if (struct.isSetColumn_names()) {
oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.column_names.size()));
for (ByteBuffer _iter19 : struct.column_names)
{
oprot.writeBinary(_iter19);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.slice_range != null) {
if (struct.isSetSlice_range()) {
oprot.writeFieldBegin(SLICE_RANGE_FIELD_DESC);
struct.slice_range.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class SlicePredicateTupleSchemeFactory implements SchemeFactory {
public SlicePredicateTupleScheme getScheme() {
return new SlicePredicateTupleScheme();
}
}
private static class SlicePredicateTupleScheme extends TupleScheme<SlicePredicate> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, SlicePredicate struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetColumn_names()) {
optionals.set(0);
}
if (struct.isSetSlice_range()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetColumn_names()) {
{
oprot.writeI32(struct.column_names.size());
for (ByteBuffer _iter20 : struct.column_names)
{
oprot.writeBinary(_iter20);
}
}
}
if (struct.isSetSlice_range()) {
struct.slice_range.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, SlicePredicate struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.column_names = new ArrayList<ByteBuffer>(_list21.size);
for (int _i22 = 0; _i22 < _list21.size; ++_i22)
{
ByteBuffer _elem23;
_elem23 = iprot.readBinary();
struct.column_names.add(_elem23);
}
}
struct.setColumn_namesIsSet(true);
}
if (incoming.get(1)) {
struct.slice_range = new SliceRange();
struct.slice_range.read(iprot);
struct.setSlice_rangeIsSet(true);
}
}
}
}

View File

@ -1,749 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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 valid 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 columns to return. Similar to LIMIT 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.
*/
public class SliceRange implements org.apache.thrift.TBase<SliceRange, SliceRange._Fields>, java.io.Serializable, Cloneable, Comparable<SliceRange> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SliceRange");
private static final org.apache.thrift.protocol.TField START_FIELD_DESC = new org.apache.thrift.protocol.TField("start", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField FINISH_FIELD_DESC = new org.apache.thrift.protocol.TField("finish", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField REVERSED_FIELD_DESC = new org.apache.thrift.protocol.TField("reversed", org.apache.thrift.protocol.TType.BOOL, (short)3);
private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I32, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new SliceRangeStandardSchemeFactory());
schemes.put(TupleScheme.class, new SliceRangeTupleSchemeFactory());
}
public ByteBuffer start; // required
public ByteBuffer finish; // required
public boolean reversed; // required
public int count; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
START((short)1, "start"),
FINISH((short)2, "finish"),
REVERSED((short)3, "reversed"),
COUNT((short)4, "count");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // START
return START;
case 2: // FINISH
return FINISH;
case 3: // REVERSED
return REVERSED;
case 4: // COUNT
return COUNT;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __REVERSED_ISSET_ID = 0;
private static final int __COUNT_ISSET_ID = 1;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.START, new org.apache.thrift.meta_data.FieldMetaData("start", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.FINISH, new org.apache.thrift.meta_data.FieldMetaData("finish", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.REVERSED, new org.apache.thrift.meta_data.FieldMetaData("reversed", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SliceRange.class, metaDataMap);
}
public SliceRange() {
this.reversed = false;
this.count = 100;
}
public SliceRange(
ByteBuffer start,
ByteBuffer finish,
boolean reversed,
int count)
{
this();
this.start = start;
this.finish = finish;
this.reversed = reversed;
setReversedIsSet(true);
this.count = count;
setCountIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public SliceRange(SliceRange other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetStart()) {
this.start = org.apache.thrift.TBaseHelper.copyBinary(other.start);
;
}
if (other.isSetFinish()) {
this.finish = org.apache.thrift.TBaseHelper.copyBinary(other.finish);
;
}
this.reversed = other.reversed;
this.count = other.count;
}
public SliceRange deepCopy() {
return new SliceRange(this);
}
@Override
public void clear() {
this.start = null;
this.finish = null;
this.reversed = false;
this.count = 100;
}
public byte[] getStart() {
setStart(org.apache.thrift.TBaseHelper.rightSize(start));
return start == null ? null : start.array();
}
public ByteBuffer bufferForStart() {
return start;
}
public SliceRange setStart(byte[] start) {
setStart(start == null ? (ByteBuffer)null : ByteBuffer.wrap(start));
return this;
}
public SliceRange setStart(ByteBuffer start) {
this.start = start;
return this;
}
public void unsetStart() {
this.start = null;
}
/** Returns true if field start is set (has been assigned a value) and false otherwise */
public boolean isSetStart() {
return this.start != null;
}
public void setStartIsSet(boolean value) {
if (!value) {
this.start = null;
}
}
public byte[] getFinish() {
setFinish(org.apache.thrift.TBaseHelper.rightSize(finish));
return finish == null ? null : finish.array();
}
public ByteBuffer bufferForFinish() {
return finish;
}
public SliceRange setFinish(byte[] finish) {
setFinish(finish == null ? (ByteBuffer)null : ByteBuffer.wrap(finish));
return this;
}
public SliceRange setFinish(ByteBuffer finish) {
this.finish = finish;
return this;
}
public void unsetFinish() {
this.finish = null;
}
/** Returns true if field finish is set (has been assigned a value) and false otherwise */
public boolean isSetFinish() {
return this.finish != null;
}
public void setFinishIsSet(boolean value) {
if (!value) {
this.finish = null;
}
}
public boolean isReversed() {
return this.reversed;
}
public SliceRange setReversed(boolean reversed) {
this.reversed = reversed;
setReversedIsSet(true);
return this;
}
public void unsetReversed() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __REVERSED_ISSET_ID);
}
/** Returns true if field reversed is set (has been assigned a value) and false otherwise */
public boolean isSetReversed() {
return EncodingUtils.testBit(__isset_bitfield, __REVERSED_ISSET_ID);
}
public void setReversedIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __REVERSED_ISSET_ID, value);
}
public int getCount() {
return this.count;
}
public SliceRange setCount(int count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case START:
if (value == null) {
unsetStart();
} else {
setStart((ByteBuffer)value);
}
break;
case FINISH:
if (value == null) {
unsetFinish();
} else {
setFinish((ByteBuffer)value);
}
break;
case REVERSED:
if (value == null) {
unsetReversed();
} else {
setReversed((Boolean)value);
}
break;
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case START:
return getStart();
case FINISH:
return getFinish();
case REVERSED:
return Boolean.valueOf(isReversed());
case COUNT:
return Integer.valueOf(getCount());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case START:
return isSetStart();
case FINISH:
return isSetFinish();
case REVERSED:
return isSetReversed();
case COUNT:
return isSetCount();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof SliceRange)
return this.equals((SliceRange)that);
return false;
}
public boolean equals(SliceRange that) {
if (that == null)
return false;
boolean this_present_start = true && this.isSetStart();
boolean that_present_start = true && that.isSetStart();
if (this_present_start || that_present_start) {
if (!(this_present_start && that_present_start))
return false;
if (!this.start.equals(that.start))
return false;
}
boolean this_present_finish = true && this.isSetFinish();
boolean that_present_finish = true && that.isSetFinish();
if (this_present_finish || that_present_finish) {
if (!(this_present_finish && that_present_finish))
return false;
if (!this.finish.equals(that.finish))
return false;
}
boolean this_present_reversed = true;
boolean that_present_reversed = true;
if (this_present_reversed || that_present_reversed) {
if (!(this_present_reversed && that_present_reversed))
return false;
if (this.reversed != that.reversed)
return false;
}
boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_start = true && (isSetStart());
builder.append(present_start);
if (present_start)
builder.append(start);
boolean present_finish = true && (isSetFinish());
builder.append(present_finish);
if (present_finish)
builder.append(finish);
boolean present_reversed = true;
builder.append(present_reversed);
if (present_reversed)
builder.append(reversed);
boolean present_count = true;
builder.append(present_count);
if (present_count)
builder.append(count);
return builder.toHashCode();
}
@Override
public int compareTo(SliceRange other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetStart()).compareTo(other.isSetStart());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStart()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start, other.start);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFinish()).compareTo(other.isSetFinish());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFinish()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.finish, other.finish);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetReversed()).compareTo(other.isSetReversed());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetReversed()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reversed, other.reversed);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCount()).compareTo(other.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, other.count);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("SliceRange(");
boolean first = true;
sb.append("start:");
if (this.start == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.start, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("finish:");
if (this.finish == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.finish, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("reversed:");
sb.append(this.reversed);
first = false;
if (!first) sb.append(", ");
sb.append("count:");
sb.append(this.count);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (start == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'start' was not present! Struct: " + toString());
}
if (finish == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'finish' was not present! Struct: " + toString());
}
// alas, we cannot check 'reversed' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'count' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class SliceRangeStandardSchemeFactory implements SchemeFactory {
public SliceRangeStandardScheme getScheme() {
return new SliceRangeStandardScheme();
}
}
private static class SliceRangeStandardScheme extends StandardScheme<SliceRange> {
public void read(org.apache.thrift.protocol.TProtocol iprot, SliceRange struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // START
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.start = iprot.readBinary();
struct.setStartIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // FINISH
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.finish = iprot.readBinary();
struct.setFinishIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // REVERSED
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.reversed = iprot.readBool();
struct.setReversedIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.count = iprot.readI32();
struct.setCountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetReversed()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'reversed' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetCount()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, SliceRange struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.start != null) {
oprot.writeFieldBegin(START_FIELD_DESC);
oprot.writeBinary(struct.start);
oprot.writeFieldEnd();
}
if (struct.finish != null) {
oprot.writeFieldBegin(FINISH_FIELD_DESC);
oprot.writeBinary(struct.finish);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(REVERSED_FIELD_DESC);
oprot.writeBool(struct.reversed);
oprot.writeFieldEnd();
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI32(struct.count);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class SliceRangeTupleSchemeFactory implements SchemeFactory {
public SliceRangeTupleScheme getScheme() {
return new SliceRangeTupleScheme();
}
}
private static class SliceRangeTupleScheme extends TupleScheme<SliceRange> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, SliceRange struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.start);
oprot.writeBinary(struct.finish);
oprot.writeBool(struct.reversed);
oprot.writeI32(struct.count);
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, SliceRange struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.start = iprot.readBinary();
struct.setStartIsSet(true);
struct.finish = iprot.readBinary();
struct.setFinishIsSet(true);
struct.reversed = iprot.readBool();
struct.setReversedIsSet(true);
struct.count = iprot.readI32();
struct.setCountIsSet(true);
}
}
}

View File

@ -1,582 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 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).
*/
public class SuperColumn implements org.apache.thrift.TBase<SuperColumn, SuperColumn._Fields>, java.io.Serializable, Cloneable, Comparable<SuperColumn> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SuperColumn");
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new SuperColumnStandardSchemeFactory());
schemes.put(TupleScheme.class, new SuperColumnTupleSchemeFactory());
}
public ByteBuffer name; // required
public List<Column> columns; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME((short)1, "name"),
COLUMNS((short)2, "columns");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // COLUMNS
return COLUMNS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Column.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SuperColumn.class, metaDataMap);
}
public SuperColumn() {
}
public SuperColumn(
ByteBuffer name,
List<Column> columns)
{
this();
this.name = name;
this.columns = columns;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public SuperColumn(SuperColumn other) {
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
}
if (other.isSetColumns()) {
List<Column> __this__columns = new ArrayList<Column>(other.columns.size());
for (Column other_element : other.columns) {
__this__columns.add(new Column(other_element));
}
this.columns = __this__columns;
}
}
public SuperColumn deepCopy() {
return new SuperColumn(this);
}
@Override
public void clear() {
this.name = null;
this.columns = null;
}
public byte[] getName() {
setName(org.apache.thrift.TBaseHelper.rightSize(name));
return name == null ? null : name.array();
}
public ByteBuffer bufferForName() {
return name;
}
public SuperColumn setName(byte[] name) {
setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
return this;
}
public SuperColumn setName(ByteBuffer name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public int getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
public java.util.Iterator<Column> getColumnsIterator() {
return (this.columns == null) ? null : this.columns.iterator();
}
public void addToColumns(Column elem) {
if (this.columns == null) {
this.columns = new ArrayList<Column>();
}
this.columns.add(elem);
}
public List<Column> getColumns() {
return this.columns;
}
public SuperColumn setColumns(List<Column> columns) {
this.columns = columns;
return this;
}
public void unsetColumns() {
this.columns = null;
}
/** Returns true if field columns is set (has been assigned a value) and false otherwise */
public boolean isSetColumns() {
return this.columns != null;
}
public void setColumnsIsSet(boolean value) {
if (!value) {
this.columns = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((ByteBuffer)value);
}
break;
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((List<Column>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case COLUMNS:
return getColumns();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case COLUMNS:
return isSetColumns();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof SuperColumn)
return this.equals((SuperColumn)that);
return false;
}
public boolean equals(SuperColumn that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_columns = true && this.isSetColumns();
boolean that_present_columns = true && that.isSetColumns();
if (this_present_columns || that_present_columns) {
if (!(this_present_columns && that_present_columns))
return false;
if (!this.columns.equals(that.columns))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name = true && (isSetName());
builder.append(present_name);
if (present_name)
builder.append(name);
boolean present_columns = true && (isSetColumns());
builder.append(present_columns);
if (present_columns)
builder.append(columns);
return builder.toHashCode();
}
@Override
public int compareTo(SuperColumn other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("SuperColumn(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.name, sb);
}
first = false;
if (!first) sb.append(", ");
sb.append("columns:");
if (this.columns == null) {
sb.append("null");
} else {
sb.append(this.columns);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
if (columns == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class SuperColumnStandardSchemeFactory implements SchemeFactory {
public SuperColumnStandardScheme getScheme() {
return new SuperColumnStandardScheme();
}
}
private static class SuperColumnStandardScheme extends StandardScheme<SuperColumn> {
public void read(org.apache.thrift.protocol.TProtocol iprot, SuperColumn struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COLUMNS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
struct.columns = new ArrayList<Column>(_list0.size);
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
{
Column _elem2;
_elem2 = new Column();
_elem2.read(iprot);
struct.columns.add(_elem2);
}
iprot.readListEnd();
}
struct.setColumnsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, SuperColumn struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeBinary(struct.name);
oprot.writeFieldEnd();
}
if (struct.columns != null) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
for (Column _iter3 : struct.columns)
{
_iter3.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class SuperColumnTupleSchemeFactory implements SchemeFactory {
public SuperColumnTupleScheme getScheme() {
return new SuperColumnTupleScheme();
}
}
private static class SuperColumnTupleScheme extends TupleScheme<SuperColumn> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, SuperColumn struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeBinary(struct.name);
{
oprot.writeI32(struct.columns.size());
for (Column _iter4 : struct.columns)
{
_iter4.write(oprot);
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, SuperColumn struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readBinary();
struct.setNameIsSet(true);
{
org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.columns = new ArrayList<Column>(_list5.size);
for (int _i6 = 0; _i6 < _list5.size; ++_i6)
{
Column _elem7;
_elem7 = new Column();
_elem7.read(iprot);
struct.columns.add(_elem7);
}
}
struct.setColumnsIsSet(true);
}
}
}

View File

@ -1,671 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* RPC timeout was exceeded. either a node failed mid-operation, or load was too high, or the requested op was too large.
*/
public class TimedOutException extends TException implements org.apache.thrift.TBase<TimedOutException, TimedOutException._Fields>, java.io.Serializable, Cloneable, Comparable<TimedOutException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TimedOutException");
private static final org.apache.thrift.protocol.TField ACKNOWLEDGED_BY_FIELD_DESC = new org.apache.thrift.protocol.TField("acknowledged_by", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField ACKNOWLEDGED_BY_BATCHLOG_FIELD_DESC = new org.apache.thrift.protocol.TField("acknowledged_by_batchlog", org.apache.thrift.protocol.TType.BOOL, (short)2);
private static final org.apache.thrift.protocol.TField PAXOS_IN_PROGRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("paxos_in_progress", org.apache.thrift.protocol.TType.BOOL, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TimedOutExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new TimedOutExceptionTupleSchemeFactory());
}
/**
* if a write operation was acknowledged by some replicas but not by enough to
* satisfy the required ConsistencyLevel, the number of successful
* replies will be given here. In case of atomic_batch_mutate method this field
* will be set to -1 if the batch was written to the batchlog and to 0 if it wasn't.
*/
public int acknowledged_by; // optional
/**
* in case of atomic_batch_mutate method this field tells if the batch
* was written to the batchlog.
*/
public boolean acknowledged_by_batchlog; // optional
/**
* for the CAS method, this field tells if we timed out during the paxos
* protocol, as opposed to during the commit of our update
*/
public boolean paxos_in_progress; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
/**
* if a write operation was acknowledged by some replicas but not by enough to
* satisfy the required ConsistencyLevel, the number of successful
* replies will be given here. In case of atomic_batch_mutate method this field
* will be set to -1 if the batch was written to the batchlog and to 0 if it wasn't.
*/
ACKNOWLEDGED_BY((short)1, "acknowledged_by"),
/**
* in case of atomic_batch_mutate method this field tells if the batch
* was written to the batchlog.
*/
ACKNOWLEDGED_BY_BATCHLOG((short)2, "acknowledged_by_batchlog"),
/**
* for the CAS method, this field tells if we timed out during the paxos
* protocol, as opposed to during the commit of our update
*/
PAXOS_IN_PROGRESS((short)3, "paxos_in_progress");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // ACKNOWLEDGED_BY
return ACKNOWLEDGED_BY;
case 2: // ACKNOWLEDGED_BY_BATCHLOG
return ACKNOWLEDGED_BY_BATCHLOG;
case 3: // PAXOS_IN_PROGRESS
return PAXOS_IN_PROGRESS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __ACKNOWLEDGED_BY_ISSET_ID = 0;
private static final int __ACKNOWLEDGED_BY_BATCHLOG_ISSET_ID = 1;
private static final int __PAXOS_IN_PROGRESS_ISSET_ID = 2;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.ACKNOWLEDGED_BY,_Fields.ACKNOWLEDGED_BY_BATCHLOG,_Fields.PAXOS_IN_PROGRESS};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.ACKNOWLEDGED_BY, new org.apache.thrift.meta_data.FieldMetaData("acknowledged_by", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.ACKNOWLEDGED_BY_BATCHLOG, new org.apache.thrift.meta_data.FieldMetaData("acknowledged_by_batchlog", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.PAXOS_IN_PROGRESS, new org.apache.thrift.meta_data.FieldMetaData("paxos_in_progress", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TimedOutException.class, metaDataMap);
}
public TimedOutException() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TimedOutException(TimedOutException other) {
__isset_bitfield = other.__isset_bitfield;
this.acknowledged_by = other.acknowledged_by;
this.acknowledged_by_batchlog = other.acknowledged_by_batchlog;
this.paxos_in_progress = other.paxos_in_progress;
}
public TimedOutException deepCopy() {
return new TimedOutException(this);
}
@Override
public void clear() {
setAcknowledged_byIsSet(false);
this.acknowledged_by = 0;
setAcknowledged_by_batchlogIsSet(false);
this.acknowledged_by_batchlog = false;
setPaxos_in_progressIsSet(false);
this.paxos_in_progress = false;
}
/**
* if a write operation was acknowledged by some replicas but not by enough to
* satisfy the required ConsistencyLevel, the number of successful
* replies will be given here. In case of atomic_batch_mutate method this field
* will be set to -1 if the batch was written to the batchlog and to 0 if it wasn't.
*/
public int getAcknowledged_by() {
return this.acknowledged_by;
}
/**
* if a write operation was acknowledged by some replicas but not by enough to
* satisfy the required ConsistencyLevel, the number of successful
* replies will be given here. In case of atomic_batch_mutate method this field
* will be set to -1 if the batch was written to the batchlog and to 0 if it wasn't.
*/
public TimedOutException setAcknowledged_by(int acknowledged_by) {
this.acknowledged_by = acknowledged_by;
setAcknowledged_byIsSet(true);
return this;
}
public void unsetAcknowledged_by() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACKNOWLEDGED_BY_ISSET_ID);
}
/** Returns true if field acknowledged_by is set (has been assigned a value) and false otherwise */
public boolean isSetAcknowledged_by() {
return EncodingUtils.testBit(__isset_bitfield, __ACKNOWLEDGED_BY_ISSET_ID);
}
public void setAcknowledged_byIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACKNOWLEDGED_BY_ISSET_ID, value);
}
/**
* in case of atomic_batch_mutate method this field tells if the batch
* was written to the batchlog.
*/
public boolean isAcknowledged_by_batchlog() {
return this.acknowledged_by_batchlog;
}
/**
* in case of atomic_batch_mutate method this field tells if the batch
* was written to the batchlog.
*/
public TimedOutException setAcknowledged_by_batchlog(boolean acknowledged_by_batchlog) {
this.acknowledged_by_batchlog = acknowledged_by_batchlog;
setAcknowledged_by_batchlogIsSet(true);
return this;
}
public void unsetAcknowledged_by_batchlog() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACKNOWLEDGED_BY_BATCHLOG_ISSET_ID);
}
/** Returns true if field acknowledged_by_batchlog is set (has been assigned a value) and false otherwise */
public boolean isSetAcknowledged_by_batchlog() {
return EncodingUtils.testBit(__isset_bitfield, __ACKNOWLEDGED_BY_BATCHLOG_ISSET_ID);
}
public void setAcknowledged_by_batchlogIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACKNOWLEDGED_BY_BATCHLOG_ISSET_ID, value);
}
/**
* for the CAS method, this field tells if we timed out during the paxos
* protocol, as opposed to during the commit of our update
*/
public boolean isPaxos_in_progress() {
return this.paxos_in_progress;
}
/**
* for the CAS method, this field tells if we timed out during the paxos
* protocol, as opposed to during the commit of our update
*/
public TimedOutException setPaxos_in_progress(boolean paxos_in_progress) {
this.paxos_in_progress = paxos_in_progress;
setPaxos_in_progressIsSet(true);
return this;
}
public void unsetPaxos_in_progress() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PAXOS_IN_PROGRESS_ISSET_ID);
}
/** Returns true if field paxos_in_progress is set (has been assigned a value) and false otherwise */
public boolean isSetPaxos_in_progress() {
return EncodingUtils.testBit(__isset_bitfield, __PAXOS_IN_PROGRESS_ISSET_ID);
}
public void setPaxos_in_progressIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PAXOS_IN_PROGRESS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ACKNOWLEDGED_BY:
if (value == null) {
unsetAcknowledged_by();
} else {
setAcknowledged_by((Integer)value);
}
break;
case ACKNOWLEDGED_BY_BATCHLOG:
if (value == null) {
unsetAcknowledged_by_batchlog();
} else {
setAcknowledged_by_batchlog((Boolean)value);
}
break;
case PAXOS_IN_PROGRESS:
if (value == null) {
unsetPaxos_in_progress();
} else {
setPaxos_in_progress((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ACKNOWLEDGED_BY:
return Integer.valueOf(getAcknowledged_by());
case ACKNOWLEDGED_BY_BATCHLOG:
return Boolean.valueOf(isAcknowledged_by_batchlog());
case PAXOS_IN_PROGRESS:
return Boolean.valueOf(isPaxos_in_progress());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case ACKNOWLEDGED_BY:
return isSetAcknowledged_by();
case ACKNOWLEDGED_BY_BATCHLOG:
return isSetAcknowledged_by_batchlog();
case PAXOS_IN_PROGRESS:
return isSetPaxos_in_progress();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TimedOutException)
return this.equals((TimedOutException)that);
return false;
}
public boolean equals(TimedOutException that) {
if (that == null)
return false;
boolean this_present_acknowledged_by = true && this.isSetAcknowledged_by();
boolean that_present_acknowledged_by = true && that.isSetAcknowledged_by();
if (this_present_acknowledged_by || that_present_acknowledged_by) {
if (!(this_present_acknowledged_by && that_present_acknowledged_by))
return false;
if (this.acknowledged_by != that.acknowledged_by)
return false;
}
boolean this_present_acknowledged_by_batchlog = true && this.isSetAcknowledged_by_batchlog();
boolean that_present_acknowledged_by_batchlog = true && that.isSetAcknowledged_by_batchlog();
if (this_present_acknowledged_by_batchlog || that_present_acknowledged_by_batchlog) {
if (!(this_present_acknowledged_by_batchlog && that_present_acknowledged_by_batchlog))
return false;
if (this.acknowledged_by_batchlog != that.acknowledged_by_batchlog)
return false;
}
boolean this_present_paxos_in_progress = true && this.isSetPaxos_in_progress();
boolean that_present_paxos_in_progress = true && that.isSetPaxos_in_progress();
if (this_present_paxos_in_progress || that_present_paxos_in_progress) {
if (!(this_present_paxos_in_progress && that_present_paxos_in_progress))
return false;
if (this.paxos_in_progress != that.paxos_in_progress)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_acknowledged_by = true && (isSetAcknowledged_by());
builder.append(present_acknowledged_by);
if (present_acknowledged_by)
builder.append(acknowledged_by);
boolean present_acknowledged_by_batchlog = true && (isSetAcknowledged_by_batchlog());
builder.append(present_acknowledged_by_batchlog);
if (present_acknowledged_by_batchlog)
builder.append(acknowledged_by_batchlog);
boolean present_paxos_in_progress = true && (isSetPaxos_in_progress());
builder.append(present_paxos_in_progress);
if (present_paxos_in_progress)
builder.append(paxos_in_progress);
return builder.toHashCode();
}
@Override
public int compareTo(TimedOutException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetAcknowledged_by()).compareTo(other.isSetAcknowledged_by());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAcknowledged_by()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.acknowledged_by, other.acknowledged_by);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAcknowledged_by_batchlog()).compareTo(other.isSetAcknowledged_by_batchlog());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAcknowledged_by_batchlog()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.acknowledged_by_batchlog, other.acknowledged_by_batchlog);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPaxos_in_progress()).compareTo(other.isSetPaxos_in_progress());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPaxos_in_progress()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paxos_in_progress, other.paxos_in_progress);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TimedOutException(");
boolean first = true;
if (isSetAcknowledged_by()) {
sb.append("acknowledged_by:");
sb.append(this.acknowledged_by);
first = false;
}
if (isSetAcknowledged_by_batchlog()) {
if (!first) sb.append(", ");
sb.append("acknowledged_by_batchlog:");
sb.append(this.acknowledged_by_batchlog);
first = false;
}
if (isSetPaxos_in_progress()) {
if (!first) sb.append(", ");
sb.append("paxos_in_progress:");
sb.append(this.paxos_in_progress);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class TimedOutExceptionStandardSchemeFactory implements SchemeFactory {
public TimedOutExceptionStandardScheme getScheme() {
return new TimedOutExceptionStandardScheme();
}
}
private static class TimedOutExceptionStandardScheme extends StandardScheme<TimedOutException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TimedOutException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // ACKNOWLEDGED_BY
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.acknowledged_by = iprot.readI32();
struct.setAcknowledged_byIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // ACKNOWLEDGED_BY_BATCHLOG
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.acknowledged_by_batchlog = iprot.readBool();
struct.setAcknowledged_by_batchlogIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // PAXOS_IN_PROGRESS
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.paxos_in_progress = iprot.readBool();
struct.setPaxos_in_progressIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TimedOutException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.isSetAcknowledged_by()) {
oprot.writeFieldBegin(ACKNOWLEDGED_BY_FIELD_DESC);
oprot.writeI32(struct.acknowledged_by);
oprot.writeFieldEnd();
}
if (struct.isSetAcknowledged_by_batchlog()) {
oprot.writeFieldBegin(ACKNOWLEDGED_BY_BATCHLOG_FIELD_DESC);
oprot.writeBool(struct.acknowledged_by_batchlog);
oprot.writeFieldEnd();
}
if (struct.isSetPaxos_in_progress()) {
oprot.writeFieldBegin(PAXOS_IN_PROGRESS_FIELD_DESC);
oprot.writeBool(struct.paxos_in_progress);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TimedOutExceptionTupleSchemeFactory implements SchemeFactory {
public TimedOutExceptionTupleScheme getScheme() {
return new TimedOutExceptionTupleScheme();
}
}
private static class TimedOutExceptionTupleScheme extends TupleScheme<TimedOutException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TimedOutException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetAcknowledged_by()) {
optionals.set(0);
}
if (struct.isSetAcknowledged_by_batchlog()) {
optionals.set(1);
}
if (struct.isSetPaxos_in_progress()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetAcknowledged_by()) {
oprot.writeI32(struct.acknowledged_by);
}
if (struct.isSetAcknowledged_by_batchlog()) {
oprot.writeBool(struct.acknowledged_by_batchlog);
}
if (struct.isSetPaxos_in_progress()) {
oprot.writeBool(struct.paxos_in_progress);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TimedOutException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.acknowledged_by = iprot.readI32();
struct.setAcknowledged_byIsSet(true);
}
if (incoming.get(1)) {
struct.acknowledged_by_batchlog = iprot.readBool();
struct.setAcknowledged_by_batchlogIsSet(true);
}
if (incoming.get(2)) {
struct.paxos_in_progress = iprot.readBool();
struct.setPaxos_in_progressIsSet(true);
}
}
}
}

View File

@ -1,990 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A TokenRange describes part of the Cassandra ring, it is a mapping from a range to
* endpoints responsible for that range.
* @param start_token The first token in the range
* @param end_token The last token in the range
* @param endpoints The endpoints responsible for the range (listed by their configured listen_address)
* @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address)
*/
public class TokenRange implements org.apache.thrift.TBase<TokenRange, TokenRange._Fields>, java.io.Serializable, Cloneable, Comparable<TokenRange> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TokenRange");
private static final org.apache.thrift.protocol.TField START_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("start_token", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField END_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("end_token", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField ENDPOINTS_FIELD_DESC = new org.apache.thrift.protocol.TField("endpoints", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.protocol.TField RPC_ENDPOINTS_FIELD_DESC = new org.apache.thrift.protocol.TField("rpc_endpoints", org.apache.thrift.protocol.TType.LIST, (short)4);
private static final org.apache.thrift.protocol.TField ENDPOINT_DETAILS_FIELD_DESC = new org.apache.thrift.protocol.TField("endpoint_details", org.apache.thrift.protocol.TType.LIST, (short)5);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TokenRangeStandardSchemeFactory());
schemes.put(TupleScheme.class, new TokenRangeTupleSchemeFactory());
}
public String start_token; // required
public String end_token; // required
public List<String> endpoints; // required
public List<String> rpc_endpoints; // optional
public List<EndpointDetails> endpoint_details; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
START_TOKEN((short)1, "start_token"),
END_TOKEN((short)2, "end_token"),
ENDPOINTS((short)3, "endpoints"),
RPC_ENDPOINTS((short)4, "rpc_endpoints"),
ENDPOINT_DETAILS((short)5, "endpoint_details");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // START_TOKEN
return START_TOKEN;
case 2: // END_TOKEN
return END_TOKEN;
case 3: // ENDPOINTS
return ENDPOINTS;
case 4: // RPC_ENDPOINTS
return RPC_ENDPOINTS;
case 5: // ENDPOINT_DETAILS
return ENDPOINT_DETAILS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.RPC_ENDPOINTS,_Fields.ENDPOINT_DETAILS};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.START_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("start_token", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.END_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("end_token", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ENDPOINTS, new org.apache.thrift.meta_data.FieldMetaData("endpoints", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.RPC_ENDPOINTS, new org.apache.thrift.meta_data.FieldMetaData("rpc_endpoints", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.ENDPOINT_DETAILS, new org.apache.thrift.meta_data.FieldMetaData("endpoint_details", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, EndpointDetails.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TokenRange.class, metaDataMap);
}
public TokenRange() {
}
public TokenRange(
String start_token,
String end_token,
List<String> endpoints)
{
this();
this.start_token = start_token;
this.end_token = end_token;
this.endpoints = endpoints;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TokenRange(TokenRange other) {
if (other.isSetStart_token()) {
this.start_token = other.start_token;
}
if (other.isSetEnd_token()) {
this.end_token = other.end_token;
}
if (other.isSetEndpoints()) {
List<String> __this__endpoints = new ArrayList<String>(other.endpoints);
this.endpoints = __this__endpoints;
}
if (other.isSetRpc_endpoints()) {
List<String> __this__rpc_endpoints = new ArrayList<String>(other.rpc_endpoints);
this.rpc_endpoints = __this__rpc_endpoints;
}
if (other.isSetEndpoint_details()) {
List<EndpointDetails> __this__endpoint_details = new ArrayList<EndpointDetails>(other.endpoint_details.size());
for (EndpointDetails other_element : other.endpoint_details) {
__this__endpoint_details.add(new EndpointDetails(other_element));
}
this.endpoint_details = __this__endpoint_details;
}
}
public TokenRange deepCopy() {
return new TokenRange(this);
}
@Override
public void clear() {
this.start_token = null;
this.end_token = null;
this.endpoints = null;
this.rpc_endpoints = null;
this.endpoint_details = null;
}
public String getStart_token() {
return this.start_token;
}
public TokenRange setStart_token(String start_token) {
this.start_token = start_token;
return this;
}
public void unsetStart_token() {
this.start_token = null;
}
/** Returns true if field start_token is set (has been assigned a value) and false otherwise */
public boolean isSetStart_token() {
return this.start_token != null;
}
public void setStart_tokenIsSet(boolean value) {
if (!value) {
this.start_token = null;
}
}
public String getEnd_token() {
return this.end_token;
}
public TokenRange setEnd_token(String end_token) {
this.end_token = end_token;
return this;
}
public void unsetEnd_token() {
this.end_token = null;
}
/** Returns true if field end_token is set (has been assigned a value) and false otherwise */
public boolean isSetEnd_token() {
return this.end_token != null;
}
public void setEnd_tokenIsSet(boolean value) {
if (!value) {
this.end_token = null;
}
}
public int getEndpointsSize() {
return (this.endpoints == null) ? 0 : this.endpoints.size();
}
public java.util.Iterator<String> getEndpointsIterator() {
return (this.endpoints == null) ? null : this.endpoints.iterator();
}
public void addToEndpoints(String elem) {
if (this.endpoints == null) {
this.endpoints = new ArrayList<String>();
}
this.endpoints.add(elem);
}
public List<String> getEndpoints() {
return this.endpoints;
}
public TokenRange setEndpoints(List<String> endpoints) {
this.endpoints = endpoints;
return this;
}
public void unsetEndpoints() {
this.endpoints = null;
}
/** Returns true if field endpoints is set (has been assigned a value) and false otherwise */
public boolean isSetEndpoints() {
return this.endpoints != null;
}
public void setEndpointsIsSet(boolean value) {
if (!value) {
this.endpoints = null;
}
}
public int getRpc_endpointsSize() {
return (this.rpc_endpoints == null) ? 0 : this.rpc_endpoints.size();
}
public java.util.Iterator<String> getRpc_endpointsIterator() {
return (this.rpc_endpoints == null) ? null : this.rpc_endpoints.iterator();
}
public void addToRpc_endpoints(String elem) {
if (this.rpc_endpoints == null) {
this.rpc_endpoints = new ArrayList<String>();
}
this.rpc_endpoints.add(elem);
}
public List<String> getRpc_endpoints() {
return this.rpc_endpoints;
}
public TokenRange setRpc_endpoints(List<String> rpc_endpoints) {
this.rpc_endpoints = rpc_endpoints;
return this;
}
public void unsetRpc_endpoints() {
this.rpc_endpoints = null;
}
/** Returns true if field rpc_endpoints is set (has been assigned a value) and false otherwise */
public boolean isSetRpc_endpoints() {
return this.rpc_endpoints != null;
}
public void setRpc_endpointsIsSet(boolean value) {
if (!value) {
this.rpc_endpoints = null;
}
}
public int getEndpoint_detailsSize() {
return (this.endpoint_details == null) ? 0 : this.endpoint_details.size();
}
public java.util.Iterator<EndpointDetails> getEndpoint_detailsIterator() {
return (this.endpoint_details == null) ? null : this.endpoint_details.iterator();
}
public void addToEndpoint_details(EndpointDetails elem) {
if (this.endpoint_details == null) {
this.endpoint_details = new ArrayList<EndpointDetails>();
}
this.endpoint_details.add(elem);
}
public List<EndpointDetails> getEndpoint_details() {
return this.endpoint_details;
}
public TokenRange setEndpoint_details(List<EndpointDetails> endpoint_details) {
this.endpoint_details = endpoint_details;
return this;
}
public void unsetEndpoint_details() {
this.endpoint_details = null;
}
/** Returns true if field endpoint_details is set (has been assigned a value) and false otherwise */
public boolean isSetEndpoint_details() {
return this.endpoint_details != null;
}
public void setEndpoint_detailsIsSet(boolean value) {
if (!value) {
this.endpoint_details = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case START_TOKEN:
if (value == null) {
unsetStart_token();
} else {
setStart_token((String)value);
}
break;
case END_TOKEN:
if (value == null) {
unsetEnd_token();
} else {
setEnd_token((String)value);
}
break;
case ENDPOINTS:
if (value == null) {
unsetEndpoints();
} else {
setEndpoints((List<String>)value);
}
break;
case RPC_ENDPOINTS:
if (value == null) {
unsetRpc_endpoints();
} else {
setRpc_endpoints((List<String>)value);
}
break;
case ENDPOINT_DETAILS:
if (value == null) {
unsetEndpoint_details();
} else {
setEndpoint_details((List<EndpointDetails>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case START_TOKEN:
return getStart_token();
case END_TOKEN:
return getEnd_token();
case ENDPOINTS:
return getEndpoints();
case RPC_ENDPOINTS:
return getRpc_endpoints();
case ENDPOINT_DETAILS:
return getEndpoint_details();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case START_TOKEN:
return isSetStart_token();
case END_TOKEN:
return isSetEnd_token();
case ENDPOINTS:
return isSetEndpoints();
case RPC_ENDPOINTS:
return isSetRpc_endpoints();
case ENDPOINT_DETAILS:
return isSetEndpoint_details();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TokenRange)
return this.equals((TokenRange)that);
return false;
}
public boolean equals(TokenRange that) {
if (that == null)
return false;
boolean this_present_start_token = true && this.isSetStart_token();
boolean that_present_start_token = true && that.isSetStart_token();
if (this_present_start_token || that_present_start_token) {
if (!(this_present_start_token && that_present_start_token))
return false;
if (!this.start_token.equals(that.start_token))
return false;
}
boolean this_present_end_token = true && this.isSetEnd_token();
boolean that_present_end_token = true && that.isSetEnd_token();
if (this_present_end_token || that_present_end_token) {
if (!(this_present_end_token && that_present_end_token))
return false;
if (!this.end_token.equals(that.end_token))
return false;
}
boolean this_present_endpoints = true && this.isSetEndpoints();
boolean that_present_endpoints = true && that.isSetEndpoints();
if (this_present_endpoints || that_present_endpoints) {
if (!(this_present_endpoints && that_present_endpoints))
return false;
if (!this.endpoints.equals(that.endpoints))
return false;
}
boolean this_present_rpc_endpoints = true && this.isSetRpc_endpoints();
boolean that_present_rpc_endpoints = true && that.isSetRpc_endpoints();
if (this_present_rpc_endpoints || that_present_rpc_endpoints) {
if (!(this_present_rpc_endpoints && that_present_rpc_endpoints))
return false;
if (!this.rpc_endpoints.equals(that.rpc_endpoints))
return false;
}
boolean this_present_endpoint_details = true && this.isSetEndpoint_details();
boolean that_present_endpoint_details = true && that.isSetEndpoint_details();
if (this_present_endpoint_details || that_present_endpoint_details) {
if (!(this_present_endpoint_details && that_present_endpoint_details))
return false;
if (!this.endpoint_details.equals(that.endpoint_details))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_start_token = true && (isSetStart_token());
builder.append(present_start_token);
if (present_start_token)
builder.append(start_token);
boolean present_end_token = true && (isSetEnd_token());
builder.append(present_end_token);
if (present_end_token)
builder.append(end_token);
boolean present_endpoints = true && (isSetEndpoints());
builder.append(present_endpoints);
if (present_endpoints)
builder.append(endpoints);
boolean present_rpc_endpoints = true && (isSetRpc_endpoints());
builder.append(present_rpc_endpoints);
if (present_rpc_endpoints)
builder.append(rpc_endpoints);
boolean present_endpoint_details = true && (isSetEndpoint_details());
builder.append(present_endpoint_details);
if (present_endpoint_details)
builder.append(endpoint_details);
return builder.toHashCode();
}
@Override
public int compareTo(TokenRange other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetStart_token()).compareTo(other.isSetStart_token());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStart_token()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start_token, other.start_token);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEnd_token()).compareTo(other.isSetEnd_token());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEnd_token()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.end_token, other.end_token);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEndpoints()).compareTo(other.isSetEndpoints());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEndpoints()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endpoints, other.endpoints);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRpc_endpoints()).compareTo(other.isSetRpc_endpoints());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRpc_endpoints()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rpc_endpoints, other.rpc_endpoints);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEndpoint_details()).compareTo(other.isSetEndpoint_details());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEndpoint_details()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endpoint_details, other.endpoint_details);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TokenRange(");
boolean first = true;
sb.append("start_token:");
if (this.start_token == null) {
sb.append("null");
} else {
sb.append(this.start_token);
}
first = false;
if (!first) sb.append(", ");
sb.append("end_token:");
if (this.end_token == null) {
sb.append("null");
} else {
sb.append(this.end_token);
}
first = false;
if (!first) sb.append(", ");
sb.append("endpoints:");
if (this.endpoints == null) {
sb.append("null");
} else {
sb.append(this.endpoints);
}
first = false;
if (isSetRpc_endpoints()) {
if (!first) sb.append(", ");
sb.append("rpc_endpoints:");
if (this.rpc_endpoints == null) {
sb.append("null");
} else {
sb.append(this.rpc_endpoints);
}
first = false;
}
if (isSetEndpoint_details()) {
if (!first) sb.append(", ");
sb.append("endpoint_details:");
if (this.endpoint_details == null) {
sb.append("null");
} else {
sb.append(this.endpoint_details);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (start_token == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'start_token' was not present! Struct: " + toString());
}
if (end_token == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'end_token' was not present! Struct: " + toString());
}
if (endpoints == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'endpoints' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class TokenRangeStandardSchemeFactory implements SchemeFactory {
public TokenRangeStandardScheme getScheme() {
return new TokenRangeStandardScheme();
}
}
private static class TokenRangeStandardScheme extends StandardScheme<TokenRange> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TokenRange struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // START_TOKEN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.start_token = iprot.readString();
struct.setStart_tokenIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // END_TOKEN
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.end_token = iprot.readString();
struct.setEnd_tokenIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // ENDPOINTS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list56 = iprot.readListBegin();
struct.endpoints = new ArrayList<String>(_list56.size);
for (int _i57 = 0; _i57 < _list56.size; ++_i57)
{
String _elem58;
_elem58 = iprot.readString();
struct.endpoints.add(_elem58);
}
iprot.readListEnd();
}
struct.setEndpointsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // RPC_ENDPOINTS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list59 = iprot.readListBegin();
struct.rpc_endpoints = new ArrayList<String>(_list59.size);
for (int _i60 = 0; _i60 < _list59.size; ++_i60)
{
String _elem61;
_elem61 = iprot.readString();
struct.rpc_endpoints.add(_elem61);
}
iprot.readListEnd();
}
struct.setRpc_endpointsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // ENDPOINT_DETAILS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
struct.endpoint_details = new ArrayList<EndpointDetails>(_list62.size);
for (int _i63 = 0; _i63 < _list62.size; ++_i63)
{
EndpointDetails _elem64;
_elem64 = new EndpointDetails();
_elem64.read(iprot);
struct.endpoint_details.add(_elem64);
}
iprot.readListEnd();
}
struct.setEndpoint_detailsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TokenRange struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.start_token != null) {
oprot.writeFieldBegin(START_TOKEN_FIELD_DESC);
oprot.writeString(struct.start_token);
oprot.writeFieldEnd();
}
if (struct.end_token != null) {
oprot.writeFieldBegin(END_TOKEN_FIELD_DESC);
oprot.writeString(struct.end_token);
oprot.writeFieldEnd();
}
if (struct.endpoints != null) {
oprot.writeFieldBegin(ENDPOINTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.endpoints.size()));
for (String _iter65 : struct.endpoints)
{
oprot.writeString(_iter65);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (struct.rpc_endpoints != null) {
if (struct.isSetRpc_endpoints()) {
oprot.writeFieldBegin(RPC_ENDPOINTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.rpc_endpoints.size()));
for (String _iter66 : struct.rpc_endpoints)
{
oprot.writeString(_iter66);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.endpoint_details != null) {
if (struct.isSetEndpoint_details()) {
oprot.writeFieldBegin(ENDPOINT_DETAILS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.endpoint_details.size()));
for (EndpointDetails _iter67 : struct.endpoint_details)
{
_iter67.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TokenRangeTupleSchemeFactory implements SchemeFactory {
public TokenRangeTupleScheme getScheme() {
return new TokenRangeTupleScheme();
}
}
private static class TokenRangeTupleScheme extends TupleScheme<TokenRange> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TokenRange struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.start_token);
oprot.writeString(struct.end_token);
{
oprot.writeI32(struct.endpoints.size());
for (String _iter68 : struct.endpoints)
{
oprot.writeString(_iter68);
}
}
BitSet optionals = new BitSet();
if (struct.isSetRpc_endpoints()) {
optionals.set(0);
}
if (struct.isSetEndpoint_details()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetRpc_endpoints()) {
{
oprot.writeI32(struct.rpc_endpoints.size());
for (String _iter69 : struct.rpc_endpoints)
{
oprot.writeString(_iter69);
}
}
}
if (struct.isSetEndpoint_details()) {
{
oprot.writeI32(struct.endpoint_details.size());
for (EndpointDetails _iter70 : struct.endpoint_details)
{
_iter70.write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TokenRange struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.start_token = iprot.readString();
struct.setStart_tokenIsSet(true);
struct.end_token = iprot.readString();
struct.setEnd_tokenIsSet(true);
{
org.apache.thrift.protocol.TList _list71 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.endpoints = new ArrayList<String>(_list71.size);
for (int _i72 = 0; _i72 < _list71.size; ++_i72)
{
String _elem73;
_elem73 = iprot.readString();
struct.endpoints.add(_elem73);
}
}
struct.setEndpointsIsSet(true);
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list74 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.rpc_endpoints = new ArrayList<String>(_list74.size);
for (int _i75 = 0; _i75 < _list74.size; ++_i75)
{
String _elem76;
_elem76 = iprot.readString();
struct.rpc_endpoints.add(_elem76);
}
}
struct.setRpc_endpointsIsSet(true);
}
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TList _list77 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.endpoint_details = new ArrayList<EndpointDetails>(_list77.size);
for (int _i78 = 0; _i78 < _list77.size; ++_i78)
{
EndpointDetails _elem79;
_elem79 = new EndpointDetails();
_elem79.read(iprot);
struct.endpoint_details.add(_elem79);
}
}
struct.setEndpoint_detailsIsSet(true);
}
}
}
}

View File

@ -1,568 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Describes a trigger.
* `options` should include at least 'class' param.
* Other options are not supported yet.
*/
public class TriggerDef implements org.apache.thrift.TBase<TriggerDef, TriggerDef._Fields>, java.io.Serializable, Cloneable, Comparable<TriggerDef> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TriggerDef");
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("options", org.apache.thrift.protocol.TType.MAP, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TriggerDefStandardSchemeFactory());
schemes.put(TupleScheme.class, new TriggerDefTupleSchemeFactory());
}
public String name; // required
public Map<String,String> options; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NAME((short)1, "name"),
OPTIONS((short)2, "options");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NAME
return NAME;
case 2: // OPTIONS
return OPTIONS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("options", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TriggerDef.class, metaDataMap);
}
public TriggerDef() {
}
public TriggerDef(
String name,
Map<String,String> options)
{
this();
this.name = name;
this.options = options;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TriggerDef(TriggerDef other) {
if (other.isSetName()) {
this.name = other.name;
}
if (other.isSetOptions()) {
Map<String,String> __this__options = new HashMap<String,String>(other.options);
this.options = __this__options;
}
}
public TriggerDef deepCopy() {
return new TriggerDef(this);
}
@Override
public void clear() {
this.name = null;
this.options = null;
}
public String getName() {
return this.name;
}
public TriggerDef setName(String name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public int getOptionsSize() {
return (this.options == null) ? 0 : this.options.size();
}
public void putToOptions(String key, String val) {
if (this.options == null) {
this.options = new HashMap<String,String>();
}
this.options.put(key, val);
}
public Map<String,String> getOptions() {
return this.options;
}
public TriggerDef setOptions(Map<String,String> options) {
this.options = options;
return this;
}
public void unsetOptions() {
this.options = null;
}
/** Returns true if field options is set (has been assigned a value) and false otherwise */
public boolean isSetOptions() {
return this.options != null;
}
public void setOptionsIsSet(boolean value) {
if (!value) {
this.options = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((String)value);
}
break;
case OPTIONS:
if (value == null) {
unsetOptions();
} else {
setOptions((Map<String,String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case OPTIONS:
return getOptions();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME:
return isSetName();
case OPTIONS:
return isSetOptions();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TriggerDef)
return this.equals((TriggerDef)that);
return false;
}
public boolean equals(TriggerDef that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_options = true && this.isSetOptions();
boolean that_present_options = true && that.isSetOptions();
if (this_present_options || that_present_options) {
if (!(this_present_options && that_present_options))
return false;
if (!this.options.equals(that.options))
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_name = true && (isSetName());
builder.append(present_name);
if (present_name)
builder.append(name);
boolean present_options = true && (isSetOptions());
builder.append(present_options);
if (present_options)
builder.append(options);
return builder.toHashCode();
}
@Override
public int compareTo(TriggerDef other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetOptions()).compareTo(other.isSetOptions());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetOptions()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.options, other.options);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TriggerDef(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
sb.append(this.name);
}
first = false;
if (!first) sb.append(", ");
sb.append("options:");
if (this.options == null) {
sb.append("null");
} else {
sb.append(this.options);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (name == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
if (options == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'options' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class TriggerDefStandardSchemeFactory implements SchemeFactory {
public TriggerDefStandardScheme getScheme() {
return new TriggerDefStandardScheme();
}
}
private static class TriggerDefStandardScheme extends StandardScheme<TriggerDef> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TriggerDef struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // OPTIONS
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map100 = iprot.readMapBegin();
struct.options = new HashMap<String,String>(2*_map100.size);
for (int _i101 = 0; _i101 < _map100.size; ++_i101)
{
String _key102;
String _val103;
_key102 = iprot.readString();
_val103 = iprot.readString();
struct.options.put(_key102, _val103);
}
iprot.readMapEnd();
}
struct.setOptionsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, TriggerDef struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
if (struct.options != null) {
oprot.writeFieldBegin(OPTIONS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.options.size()));
for (Map.Entry<String, String> _iter104 : struct.options.entrySet())
{
oprot.writeString(_iter104.getKey());
oprot.writeString(_iter104.getValue());
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TriggerDefTupleSchemeFactory implements SchemeFactory {
public TriggerDefTupleScheme getScheme() {
return new TriggerDefTupleScheme();
}
}
private static class TriggerDefTupleScheme extends TupleScheme<TriggerDef> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TriggerDef struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.name);
{
oprot.writeI32(struct.options.size());
for (Map.Entry<String, String> _iter105 : struct.options.entrySet())
{
oprot.writeString(_iter105.getKey());
oprot.writeString(_iter105.getValue());
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TriggerDef struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.name = iprot.readString();
struct.setNameIsSet(true);
{
org.apache.thrift.protocol.TMap _map106 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.options = new HashMap<String,String>(2*_map106.size);
for (int _i107 = 0; _i107 < _map106.size; ++_i107)
{
String _key108;
String _val109;
_key108 = iprot.readString();
_val109 = iprot.readString();
struct.options.put(_key108, _val109);
}
}
struct.setOptionsIsSet(true);
}
}
}

View File

@ -1,307 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Not all the replicas required could be created and/or read.
*/
public class UnavailableException extends TException implements org.apache.thrift.TBase<UnavailableException, UnavailableException._Fields>, java.io.Serializable, Cloneable, Comparable<UnavailableException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UnavailableException");
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new UnavailableExceptionStandardSchemeFactory());
schemes.put(TupleScheme.class, new UnavailableExceptionTupleSchemeFactory());
}
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UnavailableException.class, metaDataMap);
}
public UnavailableException() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public UnavailableException(UnavailableException other) {
}
public UnavailableException deepCopy() {
return new UnavailableException(this);
}
@Override
public void clear() {
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof UnavailableException)
return this.equals((UnavailableException)that);
return false;
}
public boolean equals(UnavailableException that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
return builder.toHashCode();
}
@Override
public int compareTo(UnavailableException other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("UnavailableException(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class UnavailableExceptionStandardSchemeFactory implements SchemeFactory {
public UnavailableExceptionStandardScheme getScheme() {
return new UnavailableExceptionStandardScheme();
}
}
private static class UnavailableExceptionStandardScheme extends StandardScheme<UnavailableException> {
public void read(org.apache.thrift.protocol.TProtocol iprot, UnavailableException struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, UnavailableException struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class UnavailableExceptionTupleSchemeFactory implements SchemeFactory {
public UnavailableExceptionTupleScheme getScheme() {
return new UnavailableExceptionTupleScheme();
}
}
private static class UnavailableExceptionTupleScheme extends TupleScheme<UnavailableException> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, UnavailableException struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, UnavailableException struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
}
}
}

View File

@ -1,61 +0,0 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
/*
*
* 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.
*
*/
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class cassandraConstants {
public static final String VERSION = "20.1.0";
}

Binary file not shown.

Binary file not shown.

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

Binary file not shown.

View File

@ -15,7 +15,7 @@
# limitations under the License.
# to configure behavior, define $CQL_TEST_HOST to the destination address
# for Thrift connections, and $CQL_TEST_PORT to the associated port.
# and $CQL_TEST_PORT to the associated port.
from unittest import TestCase
from operator import itemgetter

View File

@ -15,7 +15,7 @@
# limitations under the License.
# to configure behavior, define $CQL_TEST_HOST to the destination address
# for Thrift connections, and $CQL_TEST_PORT to the associated port.
# and $CQL_TEST_PORT to the associated port.
from .basecase import BaseTestCase, cqlsh

View File

@ -15,7 +15,7 @@
# limitations under the License.
# to configure behavior, define $CQL_TEST_HOST to the destination address
# for Thrift connections, and $CQL_TEST_PORT to the associated port.
# and $CQL_TEST_PORT to the associated port.
from __future__ import with_statement

View File

@ -15,7 +15,7 @@
# limitations under the License.
# to configure behavior, define $CQL_TEST_HOST to the destination address
# for Thrift connections, and $CQL_TEST_PORT to the associated port.
# and $CQL_TEST_PORT to the associated port.
from .basecase import BaseTestCase

View File

@ -15,7 +15,7 @@
# limitations under the License.
# to configure behavior, define $CQL_TEST_HOST to the destination address
# for Thrift connections, and $CQL_TEST_PORT to the associated port.
# and $CQL_TEST_PORT to the associated port.
from __future__ import with_statement

View File

@ -15,7 +15,7 @@
# limitations under the License.
# to configure behavior, define $CQL_TEST_HOST to the destination address
# for Thrift connections, and $CQL_TEST_PORT to the associated port.
# and $CQL_TEST_PORT to the associated port.
from unittest import TestCase

View File

@ -65,12 +65,10 @@ public interface IAuthenticator
SaslNegotiator newSaslNegotiator(InetAddress clientAddress);
/**
* For implementations which support the Thrift login method that accepts arbitrary
* key/value pairs containing credentials data.
* Also used by CQL native protocol v1, in which username and password are sent from
* client to server in a {@link org.apache.cassandra.transport.messages.CredentialsMessage}
* Implementations where support for Thrift and CQL protocol v1 is not required should make
* this an unsupported operation.
* A legacy method that is still used by JMX authentication.
*
* You should implement this for having JMX authentication through your
* authenticator.
*
* Should never return null - always throw AuthenticationException instead.
* Returning AuthenticatedUser.ANONYMOUS_USER is an option as well if authentication is not required.

View File

@ -17,27 +17,42 @@
*/
package org.apache.cassandra.cache;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.ColumnDefinition;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.ClusteringIndexFilter;
import org.apache.cassandra.db.filter.ClusteringIndexNamesFilter;
import org.apache.cassandra.db.filter.ColumnFilter;
import org.apache.cassandra.db.rows.CellPath;
import org.apache.cassandra.db.marshal.CompositeType;
import org.apache.cassandra.db.rows.RowIterator;
import org.apache.cassandra.db.rows.UnfilteredRowIterators;
import org.apache.cassandra.io.util.DataInputPlus;
import org.apache.cassandra.io.util.DataOutputPlus;
import org.apache.cassandra.utils.*;
public final class CounterCacheKey extends CacheKey
{
private static final long EMPTY_SIZE = ObjectSizes.measure(new CounterCacheKey(null, ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBuffer.allocate(1)));
public final byte[] partitionKey;
public final byte[] cellName;
private final byte[] partitionKey;
private final byte[] cellName;
private CounterCacheKey(Pair<String, String> ksAndCFName, byte[] partitionKey, byte[] cellName)
{
super(ksAndCFName);
this.partitionKey = partitionKey;
this.cellName = cellName;
}
private CounterCacheKey(Pair<String, String> ksAndCFName, ByteBuffer partitionKey, ByteBuffer cellName)
{
super(ksAndCFName);
this.partitionKey = ByteBufferUtil.getArray(partitionKey);
this.cellName = ByteBufferUtil.getArray(cellName);
this(ksAndCFName, ByteBufferUtil.getArray(partitionKey), ByteBufferUtil.getArray(cellName));
}
public static CounterCacheKey create(Pair<String, String> ksAndCFName, ByteBuffer partitionKey, Clustering clustering, ColumnDefinition c, CellPath path)
@ -58,6 +73,75 @@ public final class CounterCacheKey extends CacheKey
return CompositeType.build(values);
}
public ByteBuffer partitionKey()
{
return ByteBuffer.wrap(partitionKey);
}
/**
* Reads the value of the counter represented by this key.
*
* @param cfs the store for the table this is a key of.
* @return the value for the counter represented by this key, or {@code null} if there
* is not such counter.
*/
public ByteBuffer readCounterValue(ColumnFamilyStore cfs)
{
CFMetaData metadata = cfs.metadata;
assert metadata.ksAndCFName.equals(ksAndCFName);
DecoratedKey key = cfs.decorateKey(partitionKey());
int clusteringSize = metadata.comparator.size();
List<ByteBuffer> buffers = CompositeType.splitName(ByteBuffer.wrap(cellName));
assert buffers.size() >= clusteringSize + 1; // See makeCellName above
Clustering clustering = Clustering.make(buffers.subList(0, clusteringSize).toArray(new ByteBuffer[clusteringSize]));
ColumnDefinition column = metadata.getColumnDefinition(buffers.get(clusteringSize));
// This can theoretically happen if a column is dropped after the cache is saved and we
// try to load it. Not point if failing in any case, just skip the value.
if (column == null)
return null;
CellPath path = column.isComplex() ? CellPath.create(buffers.get(buffers.size() - 1)) : null;
int nowInSec = FBUtilities.nowInSeconds();
ColumnFilter.Builder builder = ColumnFilter.selectionBuilder();
if (path == null)
builder.add(column);
else
builder.select(column, path);
ClusteringIndexFilter filter = new ClusteringIndexNamesFilter(FBUtilities.singleton(clustering, metadata.comparator), false);
SinglePartitionReadCommand cmd = SinglePartitionReadCommand.create(metadata, nowInSec, key, builder.build(), filter);
try (ReadExecutionController controller = cmd.executionController();
RowIterator iter = UnfilteredRowIterators.filter(cmd.queryMemtableAndDisk(cfs, controller), nowInSec))
{
ByteBuffer value = null;
if (column.isStatic())
value = iter.staticRow().getCell(column).value();
else if (iter.hasNext())
value = iter.next().getCell(column).value();
return value;
}
}
public void write(DataOutputPlus out)
throws IOException
{
ByteBufferUtil.writeWithLength(partitionKey, out);
ByteBufferUtil.writeWithLength(cellName, out);
}
public static CounterCacheKey read(Pair<String, String> ksAndCFName, DataInputPlus in)
throws IOException
{
return new CounterCacheKey(ksAndCFName,
ByteBufferUtil.readBytesWithLength(in),
ByteBufferUtil.readBytesWithLength(in));
}
public long unsharedHeapSize()
{
return EMPTY_SIZE

View File

@ -1,121 +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.cassandra.client;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.List;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.hadoop.ConfigHelper;
import org.apache.cassandra.thrift.Cassandra;
import org.apache.cassandra.thrift.TokenRange;
import org.apache.hadoop.conf.Configuration;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
/**
* A class for caching the ring map at the client. For usage example, see
* test/unit/org.apache.cassandra.client.TestRingCache.java.
* TODO: doing a naive linear search of the token map
*/
public class RingCache
{
final private static Logger logger = LoggerFactory.getLogger(RingCache.class);
private final IPartitioner partitioner;
private final Configuration conf;
private Multimap<Range<Token>, InetAddress> rangeMap;
public RingCache(Configuration conf)
{
this.conf = conf;
this.partitioner = ConfigHelper.getOutputPartitioner(conf);
refreshEndpointMap();
}
public void refreshEndpointMap()
{
try
{
Cassandra.Client client = ConfigHelper.getClientFromOutputAddressList(conf);
String keyspace = ConfigHelper.getOutputKeyspace(conf);
List<TokenRange> ring = ConfigHelper.getOutputLocalDCOnly(conf)
? client.describe_local_ring(keyspace)
: client.describe_ring(keyspace);
rangeMap = ArrayListMultimap.create();
for (TokenRange range : ring)
{
Token left = partitioner.getTokenFactory().fromString(range.start_token);
Token right = partitioner.getTokenFactory().fromString(range.end_token);
Range<Token> r = new Range<Token>(left, right);
for (String host : range.endpoints)
{
try
{
rangeMap.put(r, InetAddress.getByName(host));
} catch (UnknownHostException e)
{
throw new AssertionError(e); // host strings are IPs
}
}
}
}
catch (IOException e)
{
throw new RuntimeException(e);
}
catch (TException e)
{
logger.trace("Error contacting seed list {} {}", ConfigHelper.getOutputInitialAddress(conf), e.getMessage());
}
}
/** ListMultimap promises to return a List for get(K) */
public List<InetAddress> getEndpoint(Range<Token> range)
{
return (List<InetAddress>) rangeMap.get(range);
}
public List<InetAddress> getEndpoint(ByteBuffer key)
{
return getEndpoint(getRange(key));
}
public Range<Token> getRange(ByteBuffer key)
{
// TODO: naive linear search of the token map
Token t = partitioner.getToken(key);
for (Range<Token> range : rangeMap.keySet())
if (range.contains(t))
return range;
throw new RuntimeException("Invalid token information returned by describe_ring: " + rangeMap);
}
}

View File

@ -121,9 +121,6 @@ public final class CFMetaData
public final DataResource resource;
//For hot path serialization it's often easier to store this info here
private volatile ColumnFilter allColumnFilter;
/*
* All of these methods will go away once CFMetaData becomes completely immutable.
*/
@ -327,8 +324,6 @@ public final class CFMetaData
if (isCompactTable())
this.compactValueColumn = CompactTables.getCompactValueColumn(partitionColumns, isSuper());
this.allColumnFilter = ColumnFilter.all(this);
}
public Indexes getIndexes()
@ -336,11 +331,6 @@ public final class CFMetaData
return indexes;
}
public ColumnFilter getAllColumnFilter()
{
return allColumnFilter;
}
public static CFMetaData create(String ksName,
String name,
UUID cfId,
@ -565,15 +555,6 @@ public final class CFMetaData
return columnMetadata;
}
/**
*
* @return The name of the parent cf if this is a seconday index
*/
public String getParentColumnFamilyName()
{
return isIndex ? cfName.substring(0, cfName.indexOf('.')) : null;
}
public ReadRepairDecision newReadRepairDecision()
{
double chance = ThreadLocalRandom.current().nextDouble();
@ -589,7 +570,7 @@ public final class CFMetaData
public AbstractType<?> getColumnDefinitionNameComparator(ColumnDefinition.Kind kind)
{
return (isSuper() && kind == ColumnDefinition.Kind.REGULAR) || (isStaticCompactTable() && kind == ColumnDefinition.Kind.STATIC)
? thriftColumnNameType()
? staticCompactOrSuperTableColumnNameType()
: UTF8Type.instance;
}
@ -605,7 +586,7 @@ public final class CFMetaData
// An iterator over all column definitions but that respect the order of a SELECT *.
// This also "hide" the clustering/regular columns for a non-CQL3 non-dense table for backward compatibility
// sake (those are accessible through thrift but not through CQL currently).
// sake.
public Iterator<ColumnDefinition> allColumnsInSelectOrder()
{
final boolean isStaticCompactTable = isStaticCompactTable();
@ -779,9 +760,6 @@ public final class CFMetaData
rebuild();
// compaction thresholds are checked by ThriftValidation. We shouldn't be doing
// validation on the apply path; it's too late for that.
params = cfm.params;
keyValidator = cfm.keyValidator;
@ -919,10 +897,17 @@ public final class CFMetaData
return this;
}
// The comparator to validate the definition name with thrift.
public AbstractType<?> thriftColumnNameType()
/**
* The type to use to compare column names in "static compact"
* tables or superColum ones.
* <p>
* This exists because for historical reasons, "static compact" tables as
* well as super column ones can have non-UTF8 column names.
* <p>
* This method should only be called for superColumn tables and "static
* compact" ones. For any other table, all column names are UTF8.
*/
public AbstractType<?> staticCompactOrSuperTableColumnNameType()
{
if (isSuper())
{
@ -1003,10 +988,8 @@ public final class CFMetaData
if (getColumnDefinition(to) != null)
throw new InvalidRequestException(String.format("Cannot rename column %s to %s in keyspace %s; another column of that name already exist", from, to, cfName));
if (def.isPartOfCellName(isCQLTable(), isSuper()))
{
if (!def.isPrimaryKeyColumn())
throw new InvalidRequestException(String.format("Cannot rename non PRIMARY KEY part %s", from));
}
if (!getIndexes().isEmpty())
{
@ -1032,6 +1015,19 @@ public final class CFMetaData
removeColumnDefinition(def);
}
/**
* Records a deprecated column for a system table.
*/
public CFMetaData recordDeprecatedSystemColumn(String name, AbstractType<?> type)
{
// As we play fast and loose with the removal timestamp, make sure this is misued for a non system table.
assert SchemaConstants.isSystemKeyspace(ksName);
ByteBuffer bb = ByteBufferUtil.bytes(name);
recordColumnDrop(ColumnDefinition.regularDef(this, bb, type), Long.MAX_VALUE);
return this;
}
public boolean isCQLTable()
{
return !isSuper() && !isDense() && isCompound();
@ -1047,43 +1043,11 @@ public final class CFMetaData
return !isSuper() && !isDense() && !isCompound();
}
/**
* Returns whether this CFMetaData can be returned to thrift.
*/
public boolean isThriftCompatible()
{
return isCompactTable();
}
public boolean hasStaticColumns()
{
return !partitionColumns.statics.isEmpty();
}
public boolean hasCollectionColumns()
{
for (ColumnDefinition def : partitionColumns())
if (def.type instanceof CollectionType && def.type.isMultiCell())
return true;
return false;
}
public boolean hasComplexColumns()
{
for (ColumnDefinition def : partitionColumns())
if (def.isComplex())
return true;
return false;
}
public boolean hasDroppedCollectionColumns()
{
for (DroppedColumn def : getDroppedColumns().values())
if (def.type instanceof CollectionType && def.type.isMultiCell())
return true;
return false;
}
public boolean isSuper()
{
return isSuper;
@ -1112,13 +1076,6 @@ public final class CFMetaData
return isView;
}
public AbstractType<?> makeLegacyDefaultValidator()
{
return isCounter()
? CounterColumnType.instance
: (isCompactTable() ? compactValueColumn().type : BytesType.instance);
}
public static Set<Flag> flagsFromStrings(Set<String> strings)
{
return strings.stream()

View File

@ -54,9 +54,6 @@ public class ColumnDefinition extends ColumnSpecification implements Selectable,
* those parts of the clustering columns and amongst the others, regular and
* static ones.
*
* Note that thrift only knows about definitions of type REGULAR (and
* the ones whose position == NO_POSITION (-1)).
*
* IMPORTANT: this enum is serialized as toString() and deserialized by calling
* Kind.valueOf(), so do not override toString() or rename existing values.
*/
@ -310,23 +307,6 @@ public class ColumnDefinition extends ColumnSpecification implements Selectable,
return kind.isPrimaryKeyKind();
}
/**
* Whether the name of this definition is serialized in the cell nane, i.e. whether
* it's not just a non-stored CQL metadata.
*/
public boolean isPartOfCellName(boolean isCQL3Table, boolean isSuper)
{
// When converting CQL3 tables to thrift, any regular or static column ends up in the cell name.
// When it's a compact table however, the REGULAR definition is the name for the cell value of "dynamic"
// column (so it's not part of the cell name) and it's static columns that ends up in the cell name.
if (isCQL3Table)
return kind == Kind.REGULAR || kind == Kind.STATIC;
else if (isSuper)
return kind == Kind.REGULAR;
else
return kind == Kind.STATIC;
}
/**
* Converts the specified column definitions into column identifiers.
*
@ -463,7 +443,7 @@ public class ColumnDefinition extends ColumnSpecification implements Selectable,
}
/**
* Because Thrift-created tables may have a non-text comparator, we cannot determine the proper 'key' until
* Because legacy-created tables may have a non-text comparator, we cannot determine the proper 'key' until
* we know the comparator. ColumnDefinition.Raw is a placeholder that can be converted to a real ColumnIdentifier
* once the comparator is known with prepare(). This should only be used with identifiers that are actual
* column names. See CASSANDRA-8178 for more background.
@ -543,19 +523,19 @@ public class ColumnDefinition extends ColumnSpecification implements Selectable,
if (!cfm.isStaticCompactTable())
return ColumnIdentifier.getInterned(text, true);
AbstractType<?> thriftColumnNameType = cfm.thriftColumnNameType();
if (thriftColumnNameType instanceof UTF8Type)
AbstractType<?> columnNameType = cfm.staticCompactOrSuperTableColumnNameType();
if (columnNameType instanceof UTF8Type)
return ColumnIdentifier.getInterned(text, true);
// We have a Thrift-created table with a non-text comparator. Check if we have a match column, otherwise assume we should use
// thriftColumnNameType
// We have a legacy-created table with a non-text comparator. Check if we have a matching column, otherwise assume we should use
// columnNameType
ByteBuffer bufferName = ByteBufferUtil.bytes(text);
for (ColumnDefinition def : cfm.allColumns())
{
if (def.name.bytes.equals(bufferName))
return def.name;
}
return ColumnIdentifier.getInterned(thriftColumnNameType, thriftColumnNameType.fromString(text), text);
return ColumnIdentifier.getInterned(columnNameType, columnNameType.fromString(text), text);
}
public ColumnDefinition prepare(CFMetaData cfm)
@ -563,19 +543,19 @@ public class ColumnDefinition extends ColumnSpecification implements Selectable,
if (!cfm.isStaticCompactTable())
return find(cfm);
AbstractType<?> thriftColumnNameType = cfm.thriftColumnNameType();
if (thriftColumnNameType instanceof UTF8Type)
AbstractType<?> columnNameType = cfm.staticCompactOrSuperTableColumnNameType();
if (columnNameType instanceof UTF8Type)
return find(cfm);
// We have a Thrift-created table with a non-text comparator. Check if we have a match column, otherwise assume we should use
// thriftColumnNameType
// We have a legacy-created table with a non-text comparator. Check if we have a match column, otherwise assume we should use
// columnNameType
ByteBuffer bufferName = ByteBufferUtil.bytes(text);
for (ColumnDefinition def : cfm.allColumns())
{
if (def.name.bytes.equals(bufferName))
return def;
}
return find(thriftColumnNameType.fromString(text), cfm);
return find(columnNameType.fromString(text), cfm);
}
private ColumnDefinition find(CFMetaData cfm)

View File

@ -131,21 +131,11 @@ public class Config
public boolean listen_on_broadcast_address = false;
public String internode_authenticator;
/* intentionally left set to true, despite being set to false in stock 2.2 cassandra.yaml
we don't want to surprise Thrift users who have the setting blank in the yaml during 2.1->2.2 upgrade */
public boolean start_rpc = true;
public String rpc_address;
public String rpc_interface;
public boolean rpc_interface_prefer_ipv6 = false;
public String broadcast_rpc_address;
public int rpc_port = 9160;
public int rpc_listen_backlog = 50;
public String rpc_server_type = "sync";
public boolean rpc_keepalive = true;
public int rpc_min_threads = 16;
public int rpc_max_threads = Integer.MAX_VALUE;
public Integer rpc_send_buff_size_in_bytes;
public Integer rpc_recv_buff_size_in_bytes;
public int internode_send_buff_size_in_bytes = 0;
public int internode_recv_buff_size_in_bytes = 0;
@ -157,8 +147,6 @@ public class Config
public volatile long native_transport_max_concurrent_connections = -1L;
public volatile long native_transport_max_concurrent_connections_per_ip = -1L;
@Deprecated
public int thrift_max_message_length_in_mb = 16;
/**
* Max size of values in SSTables, in MegaBytes.
* Default is the same as the native protocol frame limit: 256Mb.
@ -166,7 +154,6 @@ public class Config
*/
public int max_value_size_in_mb = 256;
public int thrift_framed_transport_size_in_mb = 15;
public boolean snapshot_before_compaction = false;
public boolean auto_snapshot = true;
@ -222,10 +209,6 @@ public class Config
public int dynamic_snitch_reset_interval_in_ms = 600000;
public double dynamic_snitch_badness_threshold = 0.1;
public String request_scheduler;
public RequestSchedulerId request_scheduler_id;
public RequestSchedulerOptions request_scheduler_options;
public EncryptionOptions.ServerEncryptionOptions server_encryption_options = new EncryptionOptions.ServerEncryptionOptions();
public EncryptionOptions.ClientEncryptionOptions client_encryption_options = new EncryptionOptions.ClientEncryptionOptions();
// this encOptions is for backward compatibility (a warning is logged by DatabaseDescriptor)
@ -313,11 +296,6 @@ public class Config
* Defaults to 1/256th of the heap size or 10MB, whichever is greater.
*/
public Long prepared_statements_cache_size_mb = null;
/**
* Size of the Thrift prepared statements cache in MB.
* Defaults to 1/256th of the heap size or 10MB, whichever is greater.
*/
public Long thrift_prepared_statements_cache_size_mb = null;
public boolean enable_user_defined_functions = false;
public boolean enable_scripted_user_defined_functions = false;
@ -426,11 +404,6 @@ public class Config
die_immediate
}
public enum RequestSchedulerId
{
keyspace
}
public enum DiskOptimizationStrategy
{
ssd,

View File

@ -42,7 +42,6 @@ import org.apache.cassandra.auth.IAuthorizer;
import org.apache.cassandra.auth.IInternodeAuthenticator;
import org.apache.cassandra.auth.IRoleManager;
import org.apache.cassandra.config.Config.CommitLogSync;
import org.apache.cassandra.config.Config.RequestSchedulerId;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.io.FSWriteError;
@ -56,11 +55,8 @@ import org.apache.cassandra.locator.IEndpointSnitch;
import org.apache.cassandra.locator.SeedProvider;
import org.apache.cassandra.net.BackPressureStrategy;
import org.apache.cassandra.net.RateBasedBackPressure;
import org.apache.cassandra.scheduler.IRequestScheduler;
import org.apache.cassandra.scheduler.NoScheduler;
import org.apache.cassandra.security.EncryptionContext;
import org.apache.cassandra.service.CacheService.CacheType;
import org.apache.cassandra.thrift.ThriftServer.ThriftServerType;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.commons.lang3.StringUtils;
@ -97,12 +93,7 @@ public class DatabaseDescriptor
// depend on the configured IAuthenticator, so defer creating it until that's been set.
private static IRoleManager roleManager;
private static IRequestScheduler requestScheduler;
private static RequestSchedulerId requestSchedulerId;
private static RequestSchedulerOptions requestSchedulerOptions;
private static long preparedStatementsCacheSizeInMB;
private static long thriftPreparedStatementsCacheSizeInMB;
private static long keyCacheSizeInMB;
private static long counterCacheSizeInMB;
@ -312,12 +303,8 @@ public class DatabaseDescriptor
applyAddressConfig();
applyThriftHSHA();
applySnitch();
applyRequestScheduler();
applyInitialTokens();
applySeedProvider();
@ -423,9 +410,6 @@ public class DatabaseDescriptor
else
logger.info("Global memtable off-heap threshold is enabled at {}MB", conf.memtable_offheap_space_in_mb);
if (conf.thrift_framed_transport_size_in_mb <= 0)
throw new ConfigurationException("thrift_framed_transport_size_in_mb must be positive, but was " + conf.thrift_framed_transport_size_in_mb, false);
if (conf.native_transport_max_frame_size_in_mb <= 0)
throw new ConfigurationException("native_transport_max_frame_size_in_mb must be positive, but was " + conf.native_transport_max_frame_size_in_mb, false);
@ -597,22 +581,6 @@ public class DatabaseDescriptor
+ conf.prepared_statements_cache_size_mb + "', supported values are <integer> >= 0.", false);
}
try
{
// if thrift_prepared_statements_cache_size_mb option was set to "auto" then size of the cache should be "max(1/256 of Heap (in MB), 10MB)"
thriftPreparedStatementsCacheSizeInMB = (conf.thrift_prepared_statements_cache_size_mb == null)
? Math.max(10, (int) (Runtime.getRuntime().maxMemory() / 1024 / 1024 / 256))
: conf.thrift_prepared_statements_cache_size_mb;
if (thriftPreparedStatementsCacheSizeInMB <= 0)
throw new NumberFormatException(); // to escape duplicating error message
}
catch (NumberFormatException e)
{
throw new ConfigurationException("thrift_prepared_statements_cache_size_mb option was set incorrectly to '"
+ conf.thrift_prepared_statements_cache_size_mb + "', supported values are <integer> >= 0.", false);
}
try
{
// if key_cache_size_in_mb option was set to "auto" then size of the cache should be "min(5% of Heap (in MB), 100MB)
@ -833,18 +801,6 @@ public class DatabaseDescriptor
}
}
public static void applyThriftHSHA()
{
// fail early instead of OOMing (see CASSANDRA-8116)
if (ThriftServerType.HSHA.equals(conf.rpc_server_type) && conf.rpc_max_threads == Integer.MAX_VALUE)
throw new ConfigurationException("The hsha rpc_server_type is not compatible with an rpc_max_threads " +
"setting of 'unlimited'. Please see the comments in cassandra.yaml " +
"for rpc_server_type and rpc_max_threads.",
false);
if (ThriftServerType.HSHA.equals(conf.rpc_server_type) && conf.rpc_max_threads > (FBUtilities.getAvailableProcessors() * 2 + 1024))
logger.warn("rpc_max_threads setting of {} may be too high for the hsha server and cause unnecessary thread contention, reducing performance", conf.rpc_max_threads);
}
public static void applyEncryptionContext()
{
// always attempt to load the cipher factory, as we could be in the situation where the user has disabled encryption,
@ -886,47 +842,6 @@ public class DatabaseDescriptor
}
}
// Maybe safe for clients + tools
public static void applyRequestScheduler()
{
/* Request Scheduler setup */
requestSchedulerOptions = conf.request_scheduler_options;
if (conf.request_scheduler != null)
{
try
{
if (requestSchedulerOptions == null)
{
requestSchedulerOptions = new RequestSchedulerOptions();
}
Class<?> cls = Class.forName(conf.request_scheduler);
requestScheduler = (IRequestScheduler) cls.getConstructor(RequestSchedulerOptions.class).newInstance(requestSchedulerOptions);
}
catch (ClassNotFoundException e)
{
throw new ConfigurationException("Invalid Request Scheduler class " + conf.request_scheduler, false);
}
catch (Exception e)
{
throw new ConfigurationException("Unable to instantiate request scheduler", e);
}
}
else
{
requestScheduler = new NoScheduler();
}
if (conf.request_scheduler_id == RequestSchedulerId.keyspace)
{
requestSchedulerId = conf.request_scheduler_id;
}
else
{
// Default to Keyspace
requestSchedulerId = RequestSchedulerId.keyspace;
}
}
// definitely not safe for tools + clients - implicitly instantiates StorageService
public static void applySnitch()
{
@ -1127,11 +1042,6 @@ public class DatabaseDescriptor
return conf.credentials_cache_max_entries = maxEntries;
}
public static int getThriftFramedTransportSize()
{
return conf.thrift_framed_transport_size_in_mb * 1024 * 1024;
}
public static int getMaxValueSize()
{
return conf.max_value_size_in_mb * 1024 * 1024;
@ -1211,21 +1121,6 @@ public class DatabaseDescriptor
snitch = eps;
}
public static IRequestScheduler getRequestScheduler()
{
return requestScheduler;
}
public static RequestSchedulerOptions getRequestSchedulerOptions()
{
return requestSchedulerOptions;
}
public static RequestSchedulerId getRequestSchedulerId()
{
return requestSchedulerId;
}
public static int getColumnIndexSize()
{
return conf.column_index_size_in_kb * 1024;
@ -1349,16 +1244,6 @@ public class DatabaseDescriptor
return Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "ssl_storage_port", Integer.toString(conf.ssl_storage_port)));
}
public static int getRpcPort()
{
return Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "rpc_port", Integer.toString(conf.rpc_port)));
}
public static int getRpcListenBacklog()
{
return conf.rpc_listen_backlog;
}
public static long getRpcTimeout()
{
return conf.request_timeout_in_ms;
@ -1658,11 +1543,6 @@ public class DatabaseDescriptor
broadcastAddress = broadcastAdd;
}
public static boolean startRpc()
{
return conf.start_rpc;
}
public static InetAddress getRpcAddress()
{
return rpcAddress;
@ -1681,36 +1561,11 @@ public class DatabaseDescriptor
return broadcastRpcAddress;
}
public static String getRpcServerType()
{
return conf.rpc_server_type;
}
public static boolean getRpcKeepAlive()
{
return conf.rpc_keepalive;
}
public static Integer getRpcMinThreads()
{
return conf.rpc_min_threads;
}
public static Integer getRpcMaxThreads()
{
return conf.rpc_max_threads;
}
public static Integer getRpcSendBufferSize()
{
return conf.rpc_send_buff_size_in_bytes;
}
public static Integer getRpcRecvBufferSize()
{
return conf.rpc_recv_buff_size_in_bytes;
}
public static int getInternodeSendBufferSize()
{
return conf.internode_send_buff_size_in_bytes;
@ -2266,11 +2121,6 @@ public class DatabaseDescriptor
return preparedStatementsCacheSizeInMB;
}
public static long getThriftPreparedStatementsCacheSizeMB()
{
return thriftPreparedStatementsCacheSizeInMB;
}
public static boolean enableUserDefinedFunctions()
{
return conf.enable_user_defined_functions;

View File

@ -1,33 +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.cassandra.config;
import java.util.Map;
/**
*
*/
public class RequestSchedulerOptions
{
public static final Integer DEFAULT_THROTTLE_LIMIT = 80;
public static final Integer DEFAULT_WEIGHT = 1;
public Integer throttle_limit = DEFAULT_THROTTLE_LIMIT;
public Integer default_weight = DEFAULT_WEIGHT;
public Map<String, Integer> weights;
}

Some files were not shown because too many files have changed in this diff Show More