HBASE-6793 Make hbase-examples module

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1406339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-11-06 21:22:27 +00:00
parent 1ed61755ad
commit 60caa2cedf
52 changed files with 129299 additions and 122 deletions

View File

@ -1,11 +0,0 @@
Example code.
* src/examples/thrift
Examples for interacting with HBase via Thrift from C++, PHP, Python and Ruby.
* org.apache.hadoop.hbase.mapreduce.SampleUploader
Demonstrates uploading data from text files (presumably stored in HDFS) to HBase.
* org.apache.hadoop.hbase.mapreduce.IndexBuilder
Demonstrates map/reduce with a table as the source and other tables as the sink.
As of 0.20 there is no ant target for building the examples. You can easily build
the Java examples by copying them to the right location in the main source hierarchy.

View File

@ -1,16 +0,0 @@
Hbase Thrift Client Examples
============================
Included in this directory are sample clients of the HBase ThriftServer. They
all perform the same actions but are implemented in C++, Java, Ruby, PHP, and
Python respectively.
To run/compile this clients, you will first need to install the thrift package
(from http://developers.facebook.com/thrift/) and then run thrift to generate
the language files:
thrift --gen cpp --gen java --gen rb --gen py -php \
../../../src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift
See the individual DemoClient test files for more specific instructions on
running each test.

59
hbase-examples/README.txt Normal file
View File

@ -0,0 +1,59 @@
Example code.
* org.apache.hadoop.hbase.mapreduce.SampleUploader
Demonstrates uploading data from text files (presumably stored in HDFS) to HBase.
* org.apache.hadoop.hbase.mapreduce.IndexBuilder
Demonstrates map/reduce with a table as the source and other tables as the sink.
You can generate sample data for this MR job via hbase-examples/src/main/ruby/index-builder-setup.rb.
* Thrift examples
Sample clients of the HBase ThriftServer. They perform the same actions, implemented in
C++, Java, Ruby, PHP, Perl, and Python. Pre-generated Thrift code for HBase is included
to be able to compile/run the examples without Thrift installed.
If desired, the code can be re-generated as follows:
thrift --gen cpp --gen java --gen rb --gen py --gen php --gen perl \
${HBASE_ROOT}/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
and re-placed at the corresponding paths.
Before you run any Thrift examples, find a running HBase Thrift server.
If you start one locally (bin/hbase thrift start), the default port is 9090.
* Java: org.apache.hadoop.hbase.thrift.DemoClient (jar under lib/).
1. Set up the classpath with all the necessary jars, for example:
for f in `find . -name "libthrift-*.jar" -or -name "slf4j-*.jar" -or -name "log4j-*.jar"`; do
HBASE_EXAMPLE_CLASSPATH=${HBASE_EXAMPLE_CLASSPATH}:$f;
done
2. Execute:
{java -cp hbase-examples-[VERSION].jar:${HBASE_EXAMPLE_CLASSPATH} org.apache.hadoop.hbase.thrift.DemoClient <host> <port>}
* Ruby: hbase-examples/src/main/ruby/DemoClient.rb
1. Modify the import path in the file to point to {$THRIFT_HOME}/lib/rb/lib.
2. Execute {ruby DemoClient.rb} (or {ruby DemoClient.rb <host> <port>}).
* Python: hbase-examples/src/main/python/DemoClient.py
1. Modify the added system path in the file to point to {$THRIFT_HOME}/lib/py/build/lib.[YOUR SYSTEM]
2. Execute {python DemoClient.py <host> <port>}.
* PHP: hbase-examples/src/main/php/DemoClient.php
1. Modify the THRIFT_HOME path in the file to point to actual {$THRIFT_HOME}.
2. Execute {php DemoClient.php}.
3. Starting from Thrift 0.9.0, if Thrift.php complains about some files it cannot include, go to thrift root,
and copy the contents of php/lib/Thrift under lib/php/src. Thrift.php appears to include, from under the same root,
both TStringUtils.php, only present in src/, and other files only present under lib/; this will bring them under
the same root (src/).
If you know better about PHP and Thrift, please feel free to fix this.
* Perl: hbase-examples/src/main/perl/DemoClient.pl
1. Modify the "use lib" path in the file to point to {$THRIFT_HOME}/lib/perl/lib.
2. Use CPAN to get Bit::Vector and Class::Accessor modules if not present (see thrift perl README if more modules are missing).
3. Execute {perl DemoClient.pl}.
* CPP: hbase-examples/src/main/cpp/DemoClient.cpp
1. Make sure you have boost and Thrift C++ libraries; modify Makefile if necessary.
The recent (0.9.0 as of this writing) version of Thrift can be downloaded from http://thrift.apache.org/download/.
Boost can be found at http://www.boost.org/users/download/.
2. Execute {make}.
3. Execute {./DemoClient}.

82
hbase-examples/pom.xml Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!--
/**
* 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.
*/
-->
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>hbase</artifactId>
<groupId>org.apache.hbase</groupId>
<version>0.95-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>hbase-examples</artifactId>
<name>HBase - Examples</name>
<description>Examples of HBase usage</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- Currently, there are no examples with tests ported.
Disable secondPartTestsExecution to prevent surefire
from failing the build. -->
<executions>
<execution>
<id>secondPartTestsExecution</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<!-- don't build the test jar - no tests as yet -->
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -18,14 +18,6 @@
* limitations under the License.
*/
/*
* Instructions:
* 1. Run Thrift to generate the cpp module HBase
* thrift --gen cpp ../../../src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
* 2. Execute {make}.
* 3. Execute {./DemoClient}.
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>

View File

@ -16,15 +16,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Makefile for C++ Hbase Thrift DemoClient
# NOTE: run 'thrift -cpp Hbase.thrift' first
THRIFT_DIR = /usr/local/include/thrift
LIB_DIR = /usr/local/lib
GEN_SRC = ./gen-cpp/Hbase.cpp \
./gen-cpp/Hbase_types.cpp \
./gen-cpp/Hbase_constants.cpp
./gen-cpp/Hbase_types.cpp \
./gen-cpp/Hbase_constants.cpp
.PHONY: clean help
default: DemoClient
@ -33,3 +32,9 @@ DemoClient: DemoClient.cpp
clean:
rm -rf DemoClient
help:
$(warning "Makefile for C++ Hbase Thrift DemoClient. Modify THRIFT_DIR and LIB_DIR in the \
file to point to correct locations. See $${HBASE_ROOT}/hbase-examples/README.txt for \
details.")
@:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "Hbase_constants.h"
namespace apache { namespace hadoop { namespace hbase { namespace thrift {
const HbaseConstants g_Hbase_constants;
HbaseConstants::HbaseConstants() {
}
}}}} // namespace

View File

@ -0,0 +1,24 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef Hbase_CONSTANTS_H
#define Hbase_CONSTANTS_H
#include "Hbase_types.h"
namespace apache { namespace hadoop { namespace hbase { namespace thrift {
class HbaseConstants {
public:
HbaseConstants();
};
extern const HbaseConstants g_Hbase_constants;
}}}} // namespace
#endif

View File

@ -0,0 +1,254 @@
// This autogenerated skeleton file illustrates how to build a server.
// You should copy it to another filename to avoid overwriting it.
#include "Hbase.h"
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
using namespace ::apache::hadoop::hbase::thrift;
class HbaseHandler : virtual public HbaseIf {
public:
HbaseHandler() {
// Your initialization goes here
}
void enableTable(const Bytes& tableName) {
// Your implementation goes here
printf("enableTable\n");
}
void disableTable(const Bytes& tableName) {
// Your implementation goes here
printf("disableTable\n");
}
bool isTableEnabled(const Bytes& tableName) {
// Your implementation goes here
printf("isTableEnabled\n");
}
void compact(const Bytes& tableNameOrRegionName) {
// Your implementation goes here
printf("compact\n");
}
void majorCompact(const Bytes& tableNameOrRegionName) {
// Your implementation goes here
printf("majorCompact\n");
}
void getTableNames(std::vector<Text> & _return) {
// Your implementation goes here
printf("getTableNames\n");
}
void getColumnDescriptors(std::map<Text, ColumnDescriptor> & _return, const Text& tableName) {
// Your implementation goes here
printf("getColumnDescriptors\n");
}
void getTableRegions(std::vector<TRegionInfo> & _return, const Text& tableName) {
// Your implementation goes here
printf("getTableRegions\n");
}
void createTable(const Text& tableName, const std::vector<ColumnDescriptor> & columnFamilies) {
// Your implementation goes here
printf("createTable\n");
}
void deleteTable(const Text& tableName) {
// Your implementation goes here
printf("deleteTable\n");
}
void get(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& column, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("get\n");
}
void getVer(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& column, const int32_t numVersions, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getVer\n");
}
void getVerTs(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const int32_t numVersions, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getVerTs\n");
}
void getRow(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRow\n");
}
void getRowWithColumns(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const std::vector<Text> & columns, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRowWithColumns\n");
}
void getRowTs(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRowTs\n");
}
void getRowWithColumnsTs(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const std::vector<Text> & columns, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRowWithColumnsTs\n");
}
void getRows(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRows\n");
}
void getRowsWithColumns(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const std::vector<Text> & columns, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRowsWithColumns\n");
}
void getRowsTs(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRowsTs\n");
}
void getRowsWithColumnsTs(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const std::vector<Text> & columns, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("getRowsWithColumnsTs\n");
}
void mutateRow(const Text& tableName, const Text& row, const std::vector<Mutation> & mutations, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("mutateRow\n");
}
void mutateRowTs(const Text& tableName, const Text& row, const std::vector<Mutation> & mutations, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("mutateRowTs\n");
}
void mutateRows(const Text& tableName, const std::vector<BatchMutation> & rowBatches, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("mutateRows\n");
}
void mutateRowsTs(const Text& tableName, const std::vector<BatchMutation> & rowBatches, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("mutateRowsTs\n");
}
int64_t atomicIncrement(const Text& tableName, const Text& row, const Text& column, const int64_t value) {
// Your implementation goes here
printf("atomicIncrement\n");
}
void deleteAll(const Text& tableName, const Text& row, const Text& column, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("deleteAll\n");
}
void deleteAllTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("deleteAllTs\n");
}
void deleteAllRow(const Text& tableName, const Text& row, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("deleteAllRow\n");
}
void increment(const TIncrement& increment) {
// Your implementation goes here
printf("increment\n");
}
void incrementRows(const std::vector<TIncrement> & increments) {
// Your implementation goes here
printf("incrementRows\n");
}
void deleteAllRowTs(const Text& tableName, const Text& row, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("deleteAllRowTs\n");
}
ScannerID scannerOpenWithScan(const Text& tableName, const TScan& scan, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("scannerOpenWithScan\n");
}
ScannerID scannerOpen(const Text& tableName, const Text& startRow, const std::vector<Text> & columns, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("scannerOpen\n");
}
ScannerID scannerOpenWithStop(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector<Text> & columns, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("scannerOpenWithStop\n");
}
ScannerID scannerOpenWithPrefix(const Text& tableName, const Text& startAndPrefix, const std::vector<Text> & columns, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("scannerOpenWithPrefix\n");
}
ScannerID scannerOpenTs(const Text& tableName, const Text& startRow, const std::vector<Text> & columns, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("scannerOpenTs\n");
}
ScannerID scannerOpenWithStopTs(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector<Text> & columns, const int64_t timestamp, const std::map<Text, Text> & attributes) {
// Your implementation goes here
printf("scannerOpenWithStopTs\n");
}
void scannerGet(std::vector<TRowResult> & _return, const ScannerID id) {
// Your implementation goes here
printf("scannerGet\n");
}
void scannerGetList(std::vector<TRowResult> & _return, const ScannerID id, const int32_t nbRows) {
// Your implementation goes here
printf("scannerGetList\n");
}
void scannerClose(const ScannerID id) {
// Your implementation goes here
printf("scannerClose\n");
}
void getRowOrBefore(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& family) {
// Your implementation goes here
printf("getRowOrBefore\n");
}
void getRegionInfo(TRegionInfo& _return, const Text& row) {
// Your implementation goes here
printf("getRegionInfo\n");
}
};
int main(int argc, char **argv) {
int port = 9090;
shared_ptr<HbaseHandler> handler(new HbaseHandler());
shared_ptr<TProcessor> processor(new HbaseProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
server.serve();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,742 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef Hbase_TYPES_H
#define Hbase_TYPES_H
#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>
namespace apache { namespace hadoop { namespace hbase { namespace thrift {
typedef std::string Text;
typedef std::string Bytes;
typedef int32_t ScannerID;
typedef struct _TCell__isset {
_TCell__isset() : value(false), timestamp(false) {}
bool value;
bool timestamp;
} _TCell__isset;
class TCell {
public:
static const char* ascii_fingerprint; // = "1CCCF6FC31CFD1D61BBBB1BAF3590620";
static const uint8_t binary_fingerprint[16]; // = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20};
TCell() : value(), timestamp(0) {
}
virtual ~TCell() throw() {}
Bytes value;
int64_t timestamp;
_TCell__isset __isset;
void __set_value(const Bytes& val) {
value = val;
}
void __set_timestamp(const int64_t val) {
timestamp = val;
}
bool operator == (const TCell & rhs) const
{
if (!(value == rhs.value))
return false;
if (!(timestamp == rhs.timestamp))
return false;
return true;
}
bool operator != (const TCell &rhs) const {
return !(*this == rhs);
}
bool operator < (const TCell & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(TCell &a, TCell &b);
typedef struct _ColumnDescriptor__isset {
_ColumnDescriptor__isset() : name(false), maxVersions(true), compression(true), inMemory(true), bloomFilterType(true), bloomFilterVectorSize(true), bloomFilterNbHashes(true), blockCacheEnabled(true), timeToLive(true) {}
bool name;
bool maxVersions;
bool compression;
bool inMemory;
bool bloomFilterType;
bool bloomFilterVectorSize;
bool bloomFilterNbHashes;
bool blockCacheEnabled;
bool timeToLive;
} _ColumnDescriptor__isset;
class ColumnDescriptor {
public:
static const char* ascii_fingerprint; // = "3B18638852FDF9DD911BC1174265F92E";
static const uint8_t binary_fingerprint[16]; // = {0x3B,0x18,0x63,0x88,0x52,0xFD,0xF9,0xDD,0x91,0x1B,0xC1,0x17,0x42,0x65,0xF9,0x2E};
ColumnDescriptor() : name(), maxVersions(3), compression("NONE"), inMemory(false), bloomFilterType("NONE"), bloomFilterVectorSize(0), bloomFilterNbHashes(0), blockCacheEnabled(false), timeToLive(-1) {
}
virtual ~ColumnDescriptor() throw() {}
Text name;
int32_t maxVersions;
std::string compression;
bool inMemory;
std::string bloomFilterType;
int32_t bloomFilterVectorSize;
int32_t bloomFilterNbHashes;
bool blockCacheEnabled;
int32_t timeToLive;
_ColumnDescriptor__isset __isset;
void __set_name(const Text& val) {
name = val;
}
void __set_maxVersions(const int32_t val) {
maxVersions = val;
}
void __set_compression(const std::string& val) {
compression = val;
}
void __set_inMemory(const bool val) {
inMemory = val;
}
void __set_bloomFilterType(const std::string& val) {
bloomFilterType = val;
}
void __set_bloomFilterVectorSize(const int32_t val) {
bloomFilterVectorSize = val;
}
void __set_bloomFilterNbHashes(const int32_t val) {
bloomFilterNbHashes = val;
}
void __set_blockCacheEnabled(const bool val) {
blockCacheEnabled = val;
}
void __set_timeToLive(const int32_t val) {
timeToLive = val;
}
bool operator == (const ColumnDescriptor & rhs) const
{
if (!(name == rhs.name))
return false;
if (!(maxVersions == rhs.maxVersions))
return false;
if (!(compression == rhs.compression))
return false;
if (!(inMemory == rhs.inMemory))
return false;
if (!(bloomFilterType == rhs.bloomFilterType))
return false;
if (!(bloomFilterVectorSize == rhs.bloomFilterVectorSize))
return false;
if (!(bloomFilterNbHashes == rhs.bloomFilterNbHashes))
return false;
if (!(blockCacheEnabled == rhs.blockCacheEnabled))
return false;
if (!(timeToLive == rhs.timeToLive))
return false;
return true;
}
bool operator != (const ColumnDescriptor &rhs) const {
return !(*this == rhs);
}
bool operator < (const ColumnDescriptor & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(ColumnDescriptor &a, ColumnDescriptor &b);
typedef struct _TRegionInfo__isset {
_TRegionInfo__isset() : startKey(false), endKey(false), id(false), name(false), version(false), serverName(false), port(false) {}
bool startKey;
bool endKey;
bool id;
bool name;
bool version;
bool serverName;
bool port;
} _TRegionInfo__isset;
class TRegionInfo {
public:
static const char* ascii_fingerprint; // = "B58AB7A239831F8614F7B6709C89DC7B";
static const uint8_t binary_fingerprint[16]; // = {0xB5,0x8A,0xB7,0xA2,0x39,0x83,0x1F,0x86,0x14,0xF7,0xB6,0x70,0x9C,0x89,0xDC,0x7B};
TRegionInfo() : startKey(), endKey(), id(0), name(), version(0), serverName(), port(0) {
}
virtual ~TRegionInfo() throw() {}
Text startKey;
Text endKey;
int64_t id;
Text name;
int8_t version;
Text serverName;
int32_t port;
_TRegionInfo__isset __isset;
void __set_startKey(const Text& val) {
startKey = val;
}
void __set_endKey(const Text& val) {
endKey = val;
}
void __set_id(const int64_t val) {
id = val;
}
void __set_name(const Text& val) {
name = val;
}
void __set_version(const int8_t val) {
version = val;
}
void __set_serverName(const Text& val) {
serverName = val;
}
void __set_port(const int32_t val) {
port = val;
}
bool operator == (const TRegionInfo & rhs) const
{
if (!(startKey == rhs.startKey))
return false;
if (!(endKey == rhs.endKey))
return false;
if (!(id == rhs.id))
return false;
if (!(name == rhs.name))
return false;
if (!(version == rhs.version))
return false;
if (!(serverName == rhs.serverName))
return false;
if (!(port == rhs.port))
return false;
return true;
}
bool operator != (const TRegionInfo &rhs) const {
return !(*this == rhs);
}
bool operator < (const TRegionInfo & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(TRegionInfo &a, TRegionInfo &b);
typedef struct _Mutation__isset {
_Mutation__isset() : isDelete(true), column(false), value(false), writeToWAL(true) {}
bool isDelete;
bool column;
bool value;
bool writeToWAL;
} _Mutation__isset;
class Mutation {
public:
static const char* ascii_fingerprint; // = "CD9E9D4A6406AD402C90440434AE18A0";
static const uint8_t binary_fingerprint[16]; // = {0xCD,0x9E,0x9D,0x4A,0x64,0x06,0xAD,0x40,0x2C,0x90,0x44,0x04,0x34,0xAE,0x18,0xA0};
Mutation() : isDelete(false), column(), value(), writeToWAL(true) {
}
virtual ~Mutation() throw() {}
bool isDelete;
Text column;
Text value;
bool writeToWAL;
_Mutation__isset __isset;
void __set_isDelete(const bool val) {
isDelete = val;
}
void __set_column(const Text& val) {
column = val;
}
void __set_value(const Text& val) {
value = val;
}
void __set_writeToWAL(const bool val) {
writeToWAL = val;
}
bool operator == (const Mutation & rhs) const
{
if (!(isDelete == rhs.isDelete))
return false;
if (!(column == rhs.column))
return false;
if (!(value == rhs.value))
return false;
if (!(writeToWAL == rhs.writeToWAL))
return false;
return true;
}
bool operator != (const Mutation &rhs) const {
return !(*this == rhs);
}
bool operator < (const Mutation & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(Mutation &a, Mutation &b);
typedef struct _BatchMutation__isset {
_BatchMutation__isset() : row(false), mutations(false) {}
bool row;
bool mutations;
} _BatchMutation__isset;
class BatchMutation {
public:
static const char* ascii_fingerprint; // = "4B8A4A9E051CAFF532E1C0D54F6AD2AB";
static const uint8_t binary_fingerprint[16]; // = {0x4B,0x8A,0x4A,0x9E,0x05,0x1C,0xAF,0xF5,0x32,0xE1,0xC0,0xD5,0x4F,0x6A,0xD2,0xAB};
BatchMutation() : row() {
}
virtual ~BatchMutation() throw() {}
Text row;
std::vector<Mutation> mutations;
_BatchMutation__isset __isset;
void __set_row(const Text& val) {
row = val;
}
void __set_mutations(const std::vector<Mutation> & val) {
mutations = val;
}
bool operator == (const BatchMutation & rhs) const
{
if (!(row == rhs.row))
return false;
if (!(mutations == rhs.mutations))
return false;
return true;
}
bool operator != (const BatchMutation &rhs) const {
return !(*this == rhs);
}
bool operator < (const BatchMutation & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(BatchMutation &a, BatchMutation &b);
typedef struct _TIncrement__isset {
_TIncrement__isset() : table(false), row(false), column(false), ammount(false) {}
bool table;
bool row;
bool column;
bool ammount;
} _TIncrement__isset;
class TIncrement {
public:
static const char* ascii_fingerprint; // = "5F9965D46A4F3845985AC0F9B81C3C69";
static const uint8_t binary_fingerprint[16]; // = {0x5F,0x99,0x65,0xD4,0x6A,0x4F,0x38,0x45,0x98,0x5A,0xC0,0xF9,0xB8,0x1C,0x3C,0x69};
TIncrement() : table(), row(), column(), ammount(0) {
}
virtual ~TIncrement() throw() {}
Text table;
Text row;
Text column;
int64_t ammount;
_TIncrement__isset __isset;
void __set_table(const Text& val) {
table = val;
}
void __set_row(const Text& val) {
row = val;
}
void __set_column(const Text& val) {
column = val;
}
void __set_ammount(const int64_t val) {
ammount = val;
}
bool operator == (const TIncrement & rhs) const
{
if (!(table == rhs.table))
return false;
if (!(row == rhs.row))
return false;
if (!(column == rhs.column))
return false;
if (!(ammount == rhs.ammount))
return false;
return true;
}
bool operator != (const TIncrement &rhs) const {
return !(*this == rhs);
}
bool operator < (const TIncrement & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(TIncrement &a, TIncrement &b);
typedef struct _TRowResult__isset {
_TRowResult__isset() : row(false), columns(false) {}
bool row;
bool columns;
} _TRowResult__isset;
class TRowResult {
public:
static const char* ascii_fingerprint; // = "AE98EA4F344566FAFE04FA5E5823D1ED";
static const uint8_t binary_fingerprint[16]; // = {0xAE,0x98,0xEA,0x4F,0x34,0x45,0x66,0xFA,0xFE,0x04,0xFA,0x5E,0x58,0x23,0xD1,0xED};
TRowResult() : row() {
}
virtual ~TRowResult() throw() {}
Text row;
std::map<Text, TCell> columns;
_TRowResult__isset __isset;
void __set_row(const Text& val) {
row = val;
}
void __set_columns(const std::map<Text, TCell> & val) {
columns = val;
}
bool operator == (const TRowResult & rhs) const
{
if (!(row == rhs.row))
return false;
if (!(columns == rhs.columns))
return false;
return true;
}
bool operator != (const TRowResult &rhs) const {
return !(*this == rhs);
}
bool operator < (const TRowResult & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(TRowResult &a, TRowResult &b);
typedef struct _TScan__isset {
_TScan__isset() : startRow(false), stopRow(false), timestamp(false), columns(false), caching(false), filterString(false) {}
bool startRow;
bool stopRow;
bool timestamp;
bool columns;
bool caching;
bool filterString;
} _TScan__isset;
class TScan {
public:
static const char* ascii_fingerprint; // = "2C111FDF8CD162886ECCCBB9C9051083";
static const uint8_t binary_fingerprint[16]; // = {0x2C,0x11,0x1F,0xDF,0x8C,0xD1,0x62,0x88,0x6E,0xCC,0xCB,0xB9,0xC9,0x05,0x10,0x83};
TScan() : startRow(), stopRow(), timestamp(0), caching(0), filterString() {
}
virtual ~TScan() throw() {}
Text startRow;
Text stopRow;
int64_t timestamp;
std::vector<Text> columns;
int32_t caching;
Text filterString;
_TScan__isset __isset;
void __set_startRow(const Text& val) {
startRow = val;
__isset.startRow = true;
}
void __set_stopRow(const Text& val) {
stopRow = val;
__isset.stopRow = true;
}
void __set_timestamp(const int64_t val) {
timestamp = val;
__isset.timestamp = true;
}
void __set_columns(const std::vector<Text> & val) {
columns = val;
__isset.columns = true;
}
void __set_caching(const int32_t val) {
caching = val;
__isset.caching = true;
}
void __set_filterString(const Text& val) {
filterString = val;
__isset.filterString = true;
}
bool operator == (const TScan & rhs) const
{
if (__isset.startRow != rhs.__isset.startRow)
return false;
else if (__isset.startRow && !(startRow == rhs.startRow))
return false;
if (__isset.stopRow != rhs.__isset.stopRow)
return false;
else if (__isset.stopRow && !(stopRow == rhs.stopRow))
return false;
if (__isset.timestamp != rhs.__isset.timestamp)
return false;
else if (__isset.timestamp && !(timestamp == rhs.timestamp))
return false;
if (__isset.columns != rhs.__isset.columns)
return false;
else if (__isset.columns && !(columns == rhs.columns))
return false;
if (__isset.caching != rhs.__isset.caching)
return false;
else if (__isset.caching && !(caching == rhs.caching))
return false;
if (__isset.filterString != rhs.__isset.filterString)
return false;
else if (__isset.filterString && !(filterString == rhs.filterString))
return false;
return true;
}
bool operator != (const TScan &rhs) const {
return !(*this == rhs);
}
bool operator < (const TScan & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(TScan &a, TScan &b);
typedef struct _IOError__isset {
_IOError__isset() : message(false) {}
bool message;
} _IOError__isset;
class IOError : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
IOError() : message() {
}
virtual ~IOError() throw() {}
std::string message;
_IOError__isset __isset;
void __set_message(const std::string& val) {
message = val;
}
bool operator == (const IOError & rhs) const
{
if (!(message == rhs.message))
return false;
return true;
}
bool operator != (const IOError &rhs) const {
return !(*this == rhs);
}
bool operator < (const IOError & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(IOError &a, IOError &b);
typedef struct _IllegalArgument__isset {
_IllegalArgument__isset() : message(false) {}
bool message;
} _IllegalArgument__isset;
class IllegalArgument : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
IllegalArgument() : message() {
}
virtual ~IllegalArgument() throw() {}
std::string message;
_IllegalArgument__isset __isset;
void __set_message(const std::string& val) {
message = val;
}
bool operator == (const IllegalArgument & rhs) const
{
if (!(message == rhs.message))
return false;
return true;
}
bool operator != (const IllegalArgument &rhs) const {
return !(*this == rhs);
}
bool operator < (const IllegalArgument & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(IllegalArgument &a, IllegalArgument &b);
typedef struct _AlreadyExists__isset {
_AlreadyExists__isset() : message(false) {}
bool message;
} _AlreadyExists__isset;
class AlreadyExists : public ::apache::thrift::TException {
public:
static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
AlreadyExists() : message() {
}
virtual ~AlreadyExists() throw() {}
std::string message;
_AlreadyExists__isset __isset;
void __set_message(const std::string& val) {
message = val;
}
bool operator == (const AlreadyExists & rhs) const
{
if (!(message == rhs.message))
return false;
return true;
}
bool operator != (const AlreadyExists &rhs) const {
return !(*this == rhs);
}
bool operator < (const AlreadyExists & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
void swap(AlreadyExists &a, AlreadyExists &b);
}}}} // namespace
#endif

View File

@ -44,21 +44,21 @@ import org.apache.hadoop.util.GenericOptionsParser;
* map/reduce job.</li>
* <li>A real use case of building a secondary index over a table.</li>
* </ul>
*
*
* <h3>Usage</h3>
*
*
* <p>
* Modify ${HADOOP_HOME}/conf/hadoop-env.sh to include the hbase jar, the
* zookeeper jar, the examples output directory, and the hbase conf directory in
* HADOOP_CLASSPATH, and then run
* zookeeper jar (can be found in lib/ directory under HBase root, the examples output directory,
* and the hbase conf directory in HADOOP_CLASSPATH, and then run
* <tt><strong>bin/hadoop org.apache.hadoop.hbase.mapreduce.IndexBuilder TABLE_NAME COLUMN_FAMILY ATTR [ATTR ...]</strong></tt>
* </p>
*
*
* <p>
* To run with the sample data provided in index-builder-setup.rb, use the
* arguments <strong><tt>people attributes name email phone</tt></strong>.
* </p>
*
*
* <p>
* This code was written against HBase 0.21 trunk.
* </p>

View File

@ -40,14 +40,14 @@ import org.apache.hadoop.util.GenericOptionsParser;
* <p>
* This is EXAMPLE code. You will need to change it to work for your context.
* <p>
* Uses {@link TableReducer} to put the data into HBase. Change the InputFormat
* Uses {@link TableReducer} to put the data into HBase. Change the InputFormat
* to suit your data. In this example, we are importing a CSV file.
* <p>
* <pre>row,family,qualifier,value</pre>
* <p>
* The table and columnfamily we're to insert into must preexist.
* <p>
* There is no reducer in this example as it is not necessary and adds
* There is no reducer in this example as it is not necessary and adds
* significant overhead. If you need to do any massaging of data before
* inserting into HBase, you can do this in the map as well.
* <p>Do the following to start the MR job:
@ -60,54 +60,54 @@ import org.apache.hadoop.util.GenericOptionsParser;
public class SampleUploader {
private static final String NAME = "SampleUploader";
static class Uploader
static class Uploader
extends Mapper<LongWritable, Text, ImmutableBytesWritable, Put> {
private long checkpoint = 100;
private long count = 0;
@Override
public void map(LongWritable key, Text line, Context context)
throws IOException {
// Input is a CSV file
// Each map() is a single line, where the key is the line number
// Each line is comma-delimited; row,family,qualifier,value
// Split CSV line
String [] values = line.toString().split(",");
if(values.length != 4) {
return;
}
// Extract each value
byte [] row = Bytes.toBytes(values[0]);
byte [] family = Bytes.toBytes(values[1]);
byte [] qualifier = Bytes.toBytes(values[2]);
byte [] value = Bytes.toBytes(values[3]);
// Create Put
Put put = new Put(row);
put.add(family, qualifier, value);
// Uncomment below to disable WAL. This will improve performance but means
// you will experience data loss in the case of a RegionServer crash.
// put.setWriteToWAL(false);
try {
context.write(new ImmutableBytesWritable(row), put);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Set status every checkpoint lines
if(++count % checkpoint == 0) {
context.setStatus("Emitting Put " + count);
}
}
}
/**
* Job configuration.
*/
@ -129,7 +129,7 @@ public class SampleUploader {
/**
* Main entry point.
*
*
* @param args The command line parameters.
* @throws Exception When running the job fails.
*/

View File

@ -46,21 +46,7 @@ import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
/*
* Instructions:
* 1. Run Thrift to generate the java module HBase
* thrift --gen java ../../../src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
* 2. Acquire a jar of compiled Thrift java classes. As of this writing, HBase ships
* with this jar (libthrift-[VERSION].jar). If this jar is not present, or it is
* out-of-date with your current version of thrift, you can compile the jar
* yourself by executing {ant} in {$THRIFT_HOME}/lib/java.
* 3. Compile and execute this file with both the libthrift jar and the gen-java/
* directory in the classpath. This can be done on the command-line with the
* following lines: (from the directory containing this file and gen-java/)
*
* javac -cp /path/to/libthrift/jar.jar:gen-java/ DemoClient.java
* mv DemoClient.class gen-java/org/apache/hadoop/hbase/thrift/
* java -cp /path/to/libthrift/jar.jar:gen-java/ org.apache.hadoop.hbase.thrift.DemoClient
*
* See the instructions under hbase-examples/README.txt
*/
public class DemoClient {
@ -72,7 +58,7 @@ public class DemoClient {
throws IOError, TException, UnsupportedEncodingException, IllegalArgument, AlreadyExists {
if (args.length != 2) {
System.out.println("Invalid arguments!");
System.out.println("Usage: DemoClient host port");
@ -169,19 +155,27 @@ public class DemoClient {
//
// Test UTF-8 handling
//
byte[] invalid = {(byte) 'f', (byte) 'o', (byte) 'o', (byte) '-', (byte) 0xfc, (byte) 0xa1, (byte) 0xa1, (byte) 0xa1, (byte) 0xa1};
byte[] valid = {(byte) 'f', (byte) 'o', (byte) 'o', (byte) '-', (byte) 0xE7, (byte) 0x94, (byte) 0x9F, (byte) 0xE3, (byte) 0x83, (byte) 0x93, (byte) 0xE3, (byte) 0x83, (byte) 0xBC, (byte) 0xE3, (byte) 0x83, (byte) 0xAB};
byte[] invalid = {(byte) 'f', (byte) 'o', (byte) 'o', (byte) '-',
(byte) 0xfc, (byte) 0xa1, (byte) 0xa1, (byte) 0xa1, (byte) 0xa1};
byte[] valid = {(byte) 'f', (byte) 'o', (byte) 'o', (byte) '-',
(byte) 0xE7, (byte) 0x94, (byte) 0x9F, (byte) 0xE3, (byte) 0x83,
(byte) 0x93, (byte) 0xE3, (byte) 0x83, (byte) 0xBC, (byte) 0xE3,
(byte) 0x83, (byte) 0xAB};
ArrayList<Mutation> mutations;
// non-utf8 is fine for data
mutations = new ArrayList<Mutation>();
mutations.add(new Mutation(false, ByteBuffer.wrap(bytes("entry:foo")), ByteBuffer.wrap(invalid), writeToWal));
client.mutateRow(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("foo")), mutations, dummyAttributes);
mutations.add(new Mutation(false, ByteBuffer.wrap(bytes("entry:foo")),
ByteBuffer.wrap(invalid), writeToWal));
client.mutateRow(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("foo")),
mutations, dummyAttributes);
// try empty strings
mutations = new ArrayList<Mutation>();
mutations.add(new Mutation(false, ByteBuffer.wrap(bytes("entry:")), ByteBuffer.wrap(bytes("")), writeToWal));
client.mutateRow(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("")), mutations, dummyAttributes);
mutations.add(new Mutation(false, ByteBuffer.wrap(bytes("entry:")),
ByteBuffer.wrap(bytes("")), writeToWal));
client.mutateRow(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("")),
mutations, dummyAttributes);
// this row name is valid utf8
mutations = new ArrayList<Mutation>();
@ -202,7 +196,7 @@ public class DemoClient {
System.out.println("Starting scanner...");
int scanner = client.scannerOpen(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("")), columnNames, dummyAttributes);
while (true) {
List<TRowResult> entry = client.scannerGet(scanner);
if (entry.isEmpty()) {
@ -277,7 +271,6 @@ public class DemoClient {
System.exit(-1);
}
List<TCell> result = client.get(ByteBuffer.wrap(t), ByteBuffer.wrap(row), ByteBuffer.wrap(bytes("entry:foo")), dummyAttributes);
if (result.isEmpty() == false) {
System.out.println("FATAL: shouldn't get here");

View File

@ -0,0 +1,390 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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;
/**
* An AlreadyExists exceptions signals that a table with the specified
* name already exists
*/
public class AlreadyExists extends TException implements org.apache.thrift.TBase<AlreadyExists, AlreadyExists._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AlreadyExists");
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", 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 AlreadyExistsStandardSchemeFactory());
schemes.put(TupleScheme.class, new AlreadyExistsTupleSchemeFactory());
}
public String message; // 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 {
MESSAGE((short)1, "message");
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: // MESSAGE
return MESSAGE;
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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AlreadyExists.class, metaDataMap);
}
public AlreadyExists() {
}
public AlreadyExists(
String message)
{
this();
this.message = message;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public AlreadyExists(AlreadyExists other) {
if (other.isSetMessage()) {
this.message = other.message;
}
}
public AlreadyExists deepCopy() {
return new AlreadyExists(this);
}
@Override
public void clear() {
this.message = null;
}
public String getMessage() {
return this.message;
}
public AlreadyExists setMessage(String message) {
this.message = message;
return this;
}
public void unsetMessage() {
this.message = null;
}
/** Returns true if field message is set (has been assigned a value) and false otherwise */
public boolean isSetMessage() {
return this.message != null;
}
public void setMessageIsSet(boolean value) {
if (!value) {
this.message = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MESSAGE:
if (value == null) {
unsetMessage();
} else {
setMessage((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MESSAGE:
return getMessage();
}
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 MESSAGE:
return isSetMessage();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof AlreadyExists)
return this.equals((AlreadyExists)that);
return false;
}
public boolean equals(AlreadyExists that) {
if (that == null)
return false;
boolean this_present_message = true && this.isSetMessage();
boolean that_present_message = true && that.isSetMessage();
if (this_present_message || that_present_message) {
if (!(this_present_message && that_present_message))
return false;
if (!this.message.equals(that.message))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(AlreadyExists other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
AlreadyExists typedOther = (AlreadyExists)other;
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMessage()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
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("AlreadyExists(");
boolean first = true;
sb.append("message:");
if (this.message == null) {
sb.append("null");
} else {
sb.append(this.message);
}
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 AlreadyExistsStandardSchemeFactory implements SchemeFactory {
public AlreadyExistsStandardScheme getScheme() {
return new AlreadyExistsStandardScheme();
}
}
private static class AlreadyExistsStandardScheme extends StandardScheme<AlreadyExists> {
public void read(org.apache.thrift.protocol.TProtocol iprot, AlreadyExists 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: // MESSAGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.message = iprot.readString();
struct.setMessageIsSet(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, AlreadyExists struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.message != null) {
oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeString(struct.message);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class AlreadyExistsTupleSchemeFactory implements SchemeFactory {
public AlreadyExistsTupleScheme getScheme() {
return new AlreadyExistsTupleScheme();
}
}
private static class AlreadyExistsTupleScheme extends TupleScheme<AlreadyExists> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, AlreadyExists struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetMessage()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetMessage()) {
oprot.writeString(struct.message);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, AlreadyExists struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.message = iprot.readString();
struct.setMessageIsSet(true);
}
}
}
}

View File

@ -0,0 +1,553 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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 BatchMutation object is used to apply a number of Mutations to a single row.
*/
public class BatchMutation implements org.apache.thrift.TBase<BatchMutation, BatchMutation._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BatchMutation");
private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField MUTATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("mutations", 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 BatchMutationStandardSchemeFactory());
schemes.put(TupleScheme.class, new BatchMutationTupleSchemeFactory());
}
public ByteBuffer row; // required
public List<Mutation> mutations; // 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 {
ROW((short)1, "row"),
MUTATIONS((short)2, "mutations");
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: // ROW
return ROW;
case 2: // MUTATIONS
return MUTATIONS;
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.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.MUTATIONS, new org.apache.thrift.meta_data.FieldMetaData("mutations", org.apache.thrift.TFieldRequirementType.DEFAULT,
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, Mutation.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BatchMutation.class, metaDataMap);
}
public BatchMutation() {
}
public BatchMutation(
ByteBuffer row,
List<Mutation> mutations)
{
this();
this.row = row;
this.mutations = mutations;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public BatchMutation(BatchMutation other) {
if (other.isSetRow()) {
this.row = other.row;
}
if (other.isSetMutations()) {
List<Mutation> __this__mutations = new ArrayList<Mutation>();
for (Mutation other_element : other.mutations) {
__this__mutations.add(new Mutation(other_element));
}
this.mutations = __this__mutations;
}
}
public BatchMutation deepCopy() {
return new BatchMutation(this);
}
@Override
public void clear() {
this.row = null;
this.mutations = null;
}
public byte[] getRow() {
setRow(org.apache.thrift.TBaseHelper.rightSize(row));
return row == null ? null : row.array();
}
public ByteBuffer bufferForRow() {
return row;
}
public BatchMutation setRow(byte[] row) {
setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
return this;
}
public BatchMutation setRow(ByteBuffer row) {
this.row = row;
return this;
}
public void unsetRow() {
this.row = null;
}
/** Returns true if field row is set (has been assigned a value) and false otherwise */
public boolean isSetRow() {
return this.row != null;
}
public void setRowIsSet(boolean value) {
if (!value) {
this.row = null;
}
}
public int getMutationsSize() {
return (this.mutations == null) ? 0 : this.mutations.size();
}
public java.util.Iterator<Mutation> getMutationsIterator() {
return (this.mutations == null) ? null : this.mutations.iterator();
}
public void addToMutations(Mutation elem) {
if (this.mutations == null) {
this.mutations = new ArrayList<Mutation>();
}
this.mutations.add(elem);
}
public List<Mutation> getMutations() {
return this.mutations;
}
public BatchMutation setMutations(List<Mutation> mutations) {
this.mutations = mutations;
return this;
}
public void unsetMutations() {
this.mutations = null;
}
/** Returns true if field mutations is set (has been assigned a value) and false otherwise */
public boolean isSetMutations() {
return this.mutations != null;
}
public void setMutationsIsSet(boolean value) {
if (!value) {
this.mutations = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ROW:
if (value == null) {
unsetRow();
} else {
setRow((ByteBuffer)value);
}
break;
case MUTATIONS:
if (value == null) {
unsetMutations();
} else {
setMutations((List<Mutation>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ROW:
return getRow();
case MUTATIONS:
return getMutations();
}
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 ROW:
return isSetRow();
case MUTATIONS:
return isSetMutations();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof BatchMutation)
return this.equals((BatchMutation)that);
return false;
}
public boolean equals(BatchMutation that) {
if (that == null)
return false;
boolean this_present_row = true && this.isSetRow();
boolean that_present_row = true && that.isSetRow();
if (this_present_row || that_present_row) {
if (!(this_present_row && that_present_row))
return false;
if (!this.row.equals(that.row))
return false;
}
boolean this_present_mutations = true && this.isSetMutations();
boolean that_present_mutations = true && that.isSetMutations();
if (this_present_mutations || that_present_mutations) {
if (!(this_present_mutations && that_present_mutations))
return false;
if (!this.mutations.equals(that.mutations))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(BatchMutation other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
BatchMutation typedOther = (BatchMutation)other;
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRow()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMutations()).compareTo(typedOther.isSetMutations());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMutations()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mutations, typedOther.mutations);
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("BatchMutation(");
boolean first = true;
sb.append("row:");
if (this.row == null) {
sb.append("null");
} else {
sb.append(this.row);
}
first = false;
if (!first) sb.append(", ");
sb.append("mutations:");
if (this.mutations == null) {
sb.append("null");
} else {
sb.append(this.mutations);
}
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 BatchMutationStandardSchemeFactory implements SchemeFactory {
public BatchMutationStandardScheme getScheme() {
return new BatchMutationStandardScheme();
}
}
private static class BatchMutationStandardScheme extends StandardScheme<BatchMutation> {
public void read(org.apache.thrift.protocol.TProtocol iprot, BatchMutation 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: // ROW
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.row = iprot.readBinary();
struct.setRowIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // MUTATIONS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
struct.mutations = new ArrayList<Mutation>(_list0.size);
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
{
Mutation _elem2; // required
_elem2 = new Mutation();
_elem2.read(iprot);
struct.mutations.add(_elem2);
}
iprot.readListEnd();
}
struct.setMutationsIsSet(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, BatchMutation struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.row != null) {
oprot.writeFieldBegin(ROW_FIELD_DESC);
oprot.writeBinary(struct.row);
oprot.writeFieldEnd();
}
if (struct.mutations != null) {
oprot.writeFieldBegin(MUTATIONS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.mutations.size()));
for (Mutation _iter3 : struct.mutations)
{
_iter3.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class BatchMutationTupleSchemeFactory implements SchemeFactory {
public BatchMutationTupleScheme getScheme() {
return new BatchMutationTupleScheme();
}
}
private static class BatchMutationTupleScheme extends TupleScheme<BatchMutation> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, BatchMutation struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetRow()) {
optionals.set(0);
}
if (struct.isSetMutations()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetRow()) {
oprot.writeBinary(struct.row);
}
if (struct.isSetMutations()) {
{
oprot.writeI32(struct.mutations.size());
for (Mutation _iter4 : struct.mutations)
{
_iter4.write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, BatchMutation struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.row = iprot.readBinary();
struct.setRowIsSet(true);
}
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.mutations = new ArrayList<Mutation>(_list5.size);
for (int _i6 = 0; _i6 < _list5.size; ++_i6)
{
Mutation _elem7; // required
_elem7 = new Mutation();
_elem7.read(iprot);
struct.mutations.add(_elem7);
}
}
struct.setMutationsIsSet(true);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,391 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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;
/**
* An IOError exception signals that an error occurred communicating
* to the Hbase master or an Hbase region server. Also used to return
* more general Hbase error conditions.
*/
public class IOError extends TException implements org.apache.thrift.TBase<IOError, IOError._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IOError");
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", 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 IOErrorStandardSchemeFactory());
schemes.put(TupleScheme.class, new IOErrorTupleSchemeFactory());
}
public String message; // 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 {
MESSAGE((short)1, "message");
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: // MESSAGE
return MESSAGE;
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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
}
public IOError() {
}
public IOError(
String message)
{
this();
this.message = message;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public IOError(IOError other) {
if (other.isSetMessage()) {
this.message = other.message;
}
}
public IOError deepCopy() {
return new IOError(this);
}
@Override
public void clear() {
this.message = null;
}
public String getMessage() {
return this.message;
}
public IOError setMessage(String message) {
this.message = message;
return this;
}
public void unsetMessage() {
this.message = null;
}
/** Returns true if field message is set (has been assigned a value) and false otherwise */
public boolean isSetMessage() {
return this.message != null;
}
public void setMessageIsSet(boolean value) {
if (!value) {
this.message = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MESSAGE:
if (value == null) {
unsetMessage();
} else {
setMessage((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MESSAGE:
return getMessage();
}
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 MESSAGE:
return isSetMessage();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof IOError)
return this.equals((IOError)that);
return false;
}
public boolean equals(IOError that) {
if (that == null)
return false;
boolean this_present_message = true && this.isSetMessage();
boolean that_present_message = true && that.isSetMessage();
if (this_present_message || that_present_message) {
if (!(this_present_message && that_present_message))
return false;
if (!this.message.equals(that.message))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(IOError other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
IOError typedOther = (IOError)other;
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMessage()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
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("IOError(");
boolean first = true;
sb.append("message:");
if (this.message == null) {
sb.append("null");
} else {
sb.append(this.message);
}
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 IOErrorStandardSchemeFactory implements SchemeFactory {
public IOErrorStandardScheme getScheme() {
return new IOErrorStandardScheme();
}
}
private static class IOErrorStandardScheme extends StandardScheme<IOError> {
public void read(org.apache.thrift.protocol.TProtocol iprot, IOError 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: // MESSAGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.message = iprot.readString();
struct.setMessageIsSet(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, IOError struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.message != null) {
oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeString(struct.message);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class IOErrorTupleSchemeFactory implements SchemeFactory {
public IOErrorTupleScheme getScheme() {
return new IOErrorTupleScheme();
}
}
private static class IOErrorTupleScheme extends TupleScheme<IOError> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, IOError struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetMessage()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetMessage()) {
oprot.writeString(struct.message);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, IOError struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.message = iprot.readString();
struct.setMessageIsSet(true);
}
}
}
}

View File

@ -0,0 +1,390 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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;
/**
* An IllegalArgument exception indicates an illegal or invalid
* argument was passed into a procedure.
*/
public class IllegalArgument extends TException implements org.apache.thrift.TBase<IllegalArgument, IllegalArgument._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IllegalArgument");
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", 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 IllegalArgumentStandardSchemeFactory());
schemes.put(TupleScheme.class, new IllegalArgumentTupleSchemeFactory());
}
public String message; // 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 {
MESSAGE((short)1, "message");
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: // MESSAGE
return MESSAGE;
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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IllegalArgument.class, metaDataMap);
}
public IllegalArgument() {
}
public IllegalArgument(
String message)
{
this();
this.message = message;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public IllegalArgument(IllegalArgument other) {
if (other.isSetMessage()) {
this.message = other.message;
}
}
public IllegalArgument deepCopy() {
return new IllegalArgument(this);
}
@Override
public void clear() {
this.message = null;
}
public String getMessage() {
return this.message;
}
public IllegalArgument setMessage(String message) {
this.message = message;
return this;
}
public void unsetMessage() {
this.message = null;
}
/** Returns true if field message is set (has been assigned a value) and false otherwise */
public boolean isSetMessage() {
return this.message != null;
}
public void setMessageIsSet(boolean value) {
if (!value) {
this.message = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MESSAGE:
if (value == null) {
unsetMessage();
} else {
setMessage((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MESSAGE:
return getMessage();
}
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 MESSAGE:
return isSetMessage();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof IllegalArgument)
return this.equals((IllegalArgument)that);
return false;
}
public boolean equals(IllegalArgument that) {
if (that == null)
return false;
boolean this_present_message = true && this.isSetMessage();
boolean that_present_message = true && that.isSetMessage();
if (this_present_message || that_present_message) {
if (!(this_present_message && that_present_message))
return false;
if (!this.message.equals(that.message))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(IllegalArgument other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
IllegalArgument typedOther = (IllegalArgument)other;
lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMessage()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
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("IllegalArgument(");
boolean first = true;
sb.append("message:");
if (this.message == null) {
sb.append("null");
} else {
sb.append(this.message);
}
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 IllegalArgumentStandardSchemeFactory implements SchemeFactory {
public IllegalArgumentStandardScheme getScheme() {
return new IllegalArgumentStandardScheme();
}
}
private static class IllegalArgumentStandardScheme extends StandardScheme<IllegalArgument> {
public void read(org.apache.thrift.protocol.TProtocol iprot, IllegalArgument 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: // MESSAGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.message = iprot.readString();
struct.setMessageIsSet(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, IllegalArgument struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.message != null) {
oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
oprot.writeString(struct.message);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class IllegalArgumentTupleSchemeFactory implements SchemeFactory {
public IllegalArgumentTupleScheme getScheme() {
return new IllegalArgumentTupleScheme();
}
}
private static class IllegalArgumentTupleScheme extends TupleScheme<IllegalArgument> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, IllegalArgument struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetMessage()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetMessage()) {
oprot.writeString(struct.message);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, IllegalArgument struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.message = iprot.readString();
struct.setMessageIsSet(true);
}
}
}
}

View File

@ -0,0 +1,705 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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 object is used to either update or delete a column-value.
*/
public class Mutation implements org.apache.thrift.TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable {
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 IS_DELETE_FIELD_DESC = new org.apache.thrift.protocol.TField("isDelete", org.apache.thrift.protocol.TType.BOOL, (short)1);
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)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 org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWAL", org.apache.thrift.protocol.TType.BOOL, (short)4);
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 boolean isDelete; // required
public ByteBuffer column; // required
public ByteBuffer value; // required
public boolean writeToWAL; // 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 {
IS_DELETE((short)1, "isDelete"),
COLUMN((short)2, "column"),
VALUE((short)3, "value"),
WRITE_TO_WAL((short)4, "writeToWAL");
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: // IS_DELETE
return IS_DELETE;
case 2: // COLUMN
return COLUMN;
case 3: // VALUE
return VALUE;
case 4: // WRITE_TO_WAL
return WRITE_TO_WAL;
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 __ISDELETE_ISSET_ID = 0;
private static final int __WRITETOWAL_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.IS_DELETE, new org.apache.thrift.meta_data.FieldMetaData("isDelete", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWAL", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
}
public Mutation() {
this.isDelete = false;
this.writeToWAL = true;
}
public Mutation(
boolean isDelete,
ByteBuffer column,
ByteBuffer value,
boolean writeToWAL)
{
this();
this.isDelete = isDelete;
setIsDeleteIsSet(true);
this.column = column;
this.value = value;
this.writeToWAL = writeToWAL;
setWriteToWALIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public Mutation(Mutation other) {
__isset_bitfield = other.__isset_bitfield;
this.isDelete = other.isDelete;
if (other.isSetColumn()) {
this.column = other.column;
}
if (other.isSetValue()) {
this.value = other.value;
}
this.writeToWAL = other.writeToWAL;
}
public Mutation deepCopy() {
return new Mutation(this);
}
@Override
public void clear() {
this.isDelete = false;
this.column = null;
this.value = null;
this.writeToWAL = true;
}
public boolean isIsDelete() {
return this.isDelete;
}
public Mutation setIsDelete(boolean isDelete) {
this.isDelete = isDelete;
setIsDeleteIsSet(true);
return this;
}
public void unsetIsDelete() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISDELETE_ISSET_ID);
}
/** Returns true if field isDelete is set (has been assigned a value) and false otherwise */
public boolean isSetIsDelete() {
return EncodingUtils.testBit(__isset_bitfield, __ISDELETE_ISSET_ID);
}
public void setIsDeleteIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISDELETE_ISSET_ID, value);
}
public byte[] getColumn() {
setColumn(org.apache.thrift.TBaseHelper.rightSize(column));
return column == null ? null : column.array();
}
public ByteBuffer bufferForColumn() {
return column;
}
public Mutation setColumn(byte[] column) {
setColumn(column == null ? (ByteBuffer)null : ByteBuffer.wrap(column));
return this;
}
public Mutation 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 byte[] getValue() {
setValue(org.apache.thrift.TBaseHelper.rightSize(value));
return value == null ? null : value.array();
}
public ByteBuffer bufferForValue() {
return value;
}
public Mutation setValue(byte[] value) {
setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value));
return this;
}
public Mutation 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 boolean isWriteToWAL() {
return this.writeToWAL;
}
public Mutation setWriteToWAL(boolean writeToWAL) {
this.writeToWAL = writeToWAL;
setWriteToWALIsSet(true);
return this;
}
public void unsetWriteToWAL() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
}
/** Returns true if field writeToWAL is set (has been assigned a value) and false otherwise */
public boolean isSetWriteToWAL() {
return EncodingUtils.testBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
}
public void setWriteToWALIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case IS_DELETE:
if (value == null) {
unsetIsDelete();
} else {
setIsDelete((Boolean)value);
}
break;
case COLUMN:
if (value == null) {
unsetColumn();
} else {
setColumn((ByteBuffer)value);
}
break;
case VALUE:
if (value == null) {
unsetValue();
} else {
setValue((ByteBuffer)value);
}
break;
case WRITE_TO_WAL:
if (value == null) {
unsetWriteToWAL();
} else {
setWriteToWAL((Boolean)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case IS_DELETE:
return Boolean.valueOf(isIsDelete());
case COLUMN:
return getColumn();
case VALUE:
return getValue();
case WRITE_TO_WAL:
return Boolean.valueOf(isWriteToWAL());
}
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 IS_DELETE:
return isSetIsDelete();
case COLUMN:
return isSetColumn();
case VALUE:
return isSetValue();
case WRITE_TO_WAL:
return isSetWriteToWAL();
}
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_isDelete = true;
boolean that_present_isDelete = true;
if (this_present_isDelete || that_present_isDelete) {
if (!(this_present_isDelete && that_present_isDelete))
return false;
if (this.isDelete != that.isDelete)
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_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_writeToWAL = true;
boolean that_present_writeToWAL = true;
if (this_present_writeToWAL || that_present_writeToWAL) {
if (!(this_present_writeToWAL && that_present_writeToWAL))
return false;
if (this.writeToWAL != that.writeToWAL)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(Mutation other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
Mutation typedOther = (Mutation)other;
lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(typedOther.isSetIsDelete());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetIsDelete()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isDelete, typedOther.isDelete);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumn()).compareTo(typedOther.isSetColumn());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, typedOther.column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetWriteToWAL()).compareTo(typedOther.isSetWriteToWAL());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWriteToWAL()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeToWAL, typedOther.writeToWAL);
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;
sb.append("isDelete:");
sb.append(this.isDelete);
first = false;
if (!first) sb.append(", ");
sb.append("column:");
if (this.column == null) {
sb.append("null");
} else {
sb.append(this.column);
}
first = false;
if (!first) sb.append(", ");
sb.append("value:");
if (this.value == null) {
sb.append("null");
} else {
sb.append(this.value);
}
first = false;
if (!first) sb.append(", ");
sb.append("writeToWAL:");
sb.append(this.writeToWAL);
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 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: // IS_DELETE
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.isDelete = iprot.readBool();
struct.setIsDeleteIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // 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;
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;
case 4: // WRITE_TO_WAL
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.writeToWAL = iprot.readBool();
struct.setWriteToWALIsSet(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);
oprot.writeFieldBegin(IS_DELETE_FIELD_DESC);
oprot.writeBool(struct.isDelete);
oprot.writeFieldEnd();
if (struct.column != null) {
oprot.writeFieldBegin(COLUMN_FIELD_DESC);
oprot.writeBinary(struct.column);
oprot.writeFieldEnd();
}
if (struct.value != null) {
oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeBinary(struct.value);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(WRITE_TO_WAL_FIELD_DESC);
oprot.writeBool(struct.writeToWAL);
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.isSetIsDelete()) {
optionals.set(0);
}
if (struct.isSetColumn()) {
optionals.set(1);
}
if (struct.isSetValue()) {
optionals.set(2);
}
if (struct.isSetWriteToWAL()) {
optionals.set(3);
}
oprot.writeBitSet(optionals, 4);
if (struct.isSetIsDelete()) {
oprot.writeBool(struct.isDelete);
}
if (struct.isSetColumn()) {
oprot.writeBinary(struct.column);
}
if (struct.isSetValue()) {
oprot.writeBinary(struct.value);
}
if (struct.isSetWriteToWAL()) {
oprot.writeBool(struct.writeToWAL);
}
}
@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(4);
if (incoming.get(0)) {
struct.isDelete = iprot.readBool();
struct.setIsDeleteIsSet(true);
}
if (incoming.get(1)) {
struct.column = iprot.readBinary();
struct.setColumnIsSet(true);
}
if (incoming.get(2)) {
struct.value = iprot.readBinary();
struct.setValueIsSet(true);
}
if (incoming.get(3)) {
struct.writeToWAL = iprot.readBool();
struct.setWriteToWALIsSet(true);
}
}
}
}

View File

@ -0,0 +1,500 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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;
/**
* TCell - Used to transport a cell value (byte[]) and the timestamp it was
* stored with together as a result for get and getRow methods. This promotes
* the timestamp of a cell to a first-class value, making it easy to take
* note of temporal data. Cell is used all the way from HStore up to HTable.
*/
public class TCell implements org.apache.thrift.TBase<TCell, TCell._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCell");
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)1);
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)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TCellStandardSchemeFactory());
schemes.put(TupleScheme.class, new TCellTupleSchemeFactory());
}
public ByteBuffer value; // required
public long timestamp; // 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 {
VALUE((short)1, "value"),
TIMESTAMP((short)2, "timestamp");
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: // VALUE
return VALUE;
case 2: // TIMESTAMP
return TIMESTAMP;
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;
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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Bytes")));
tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCell.class, metaDataMap);
}
public TCell() {
}
public TCell(
ByteBuffer value,
long timestamp)
{
this();
this.value = value;
this.timestamp = timestamp;
setTimestampIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TCell(TCell other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetValue()) {
this.value = other.value;
}
this.timestamp = other.timestamp;
}
public TCell deepCopy() {
return new TCell(this);
}
@Override
public void clear() {
this.value = null;
setTimestampIsSet(false);
this.timestamp = 0;
}
public byte[] getValue() {
setValue(org.apache.thrift.TBaseHelper.rightSize(value));
return value == null ? null : value.array();
}
public ByteBuffer bufferForValue() {
return value;
}
public TCell setValue(byte[] value) {
setValue(value == null ? (ByteBuffer)null : ByteBuffer.wrap(value));
return this;
}
public TCell 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 TCell 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 void setFieldValue(_Fields field, Object value) {
switch (field) {
case VALUE:
if (value == null) {
unsetValue();
} else {
setValue((ByteBuffer)value);
}
break;
case TIMESTAMP:
if (value == null) {
unsetTimestamp();
} else {
setTimestamp((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case VALUE:
return getValue();
case TIMESTAMP:
return Long.valueOf(getTimestamp());
}
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 VALUE:
return isSetValue();
case TIMESTAMP:
return isSetTimestamp();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TCell)
return this.equals((TCell)that);
return false;
}
public boolean equals(TCell that) {
if (that == null)
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;
boolean that_present_timestamp = true;
if (this_present_timestamp || that_present_timestamp) {
if (!(this_present_timestamp && that_present_timestamp))
return false;
if (this.timestamp != that.timestamp)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(TCell other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
TCell typedOther = (TCell)other;
lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetValue()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimestamp()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
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("TCell(");
boolean first = true;
sb.append("value:");
if (this.value == null) {
sb.append("null");
} else {
sb.append(this.value);
}
first = false;
if (!first) sb.append(", ");
sb.append("timestamp:");
sb.append(this.timestamp);
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 TCellStandardSchemeFactory implements SchemeFactory {
public TCellStandardScheme getScheme() {
return new TCellStandardScheme();
}
}
private static class TCellStandardScheme extends StandardScheme<TCell> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TCell 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: // 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 2: // 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;
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, TCell struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.value != null) {
oprot.writeFieldBegin(VALUE_FIELD_DESC);
oprot.writeBinary(struct.value);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(struct.timestamp);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TCellTupleSchemeFactory implements SchemeFactory {
public TCellTupleScheme getScheme() {
return new TCellTupleScheme();
}
}
private static class TCellTupleScheme extends TupleScheme<TCell> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TCell struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetValue()) {
optionals.set(0);
}
if (struct.isSetTimestamp()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetValue()) {
oprot.writeBinary(struct.value);
}
if (struct.isSetTimestamp()) {
oprot.writeI64(struct.timestamp);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TCell struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.value = iprot.readBinary();
struct.setValueIsSet(true);
}
if (incoming.get(1)) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
}
}
}
}

View File

@ -0,0 +1,718 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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;
/**
* For increments that are not incrementColumnValue
* equivalents.
*/
public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncrement._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIncrement");
private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)2);
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)3);
private static final org.apache.thrift.protocol.TField AMMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("ammount", org.apache.thrift.protocol.TType.I64, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TIncrementStandardSchemeFactory());
schemes.put(TupleScheme.class, new TIncrementTupleSchemeFactory());
}
public ByteBuffer table; // required
public ByteBuffer row; // required
public ByteBuffer column; // required
public long ammount; // 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 {
TABLE((short)1, "table"),
ROW((short)2, "row"),
COLUMN((short)3, "column"),
AMMOUNT((short)4, "ammount");
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: // TABLE
return TABLE;
case 2: // ROW
return ROW;
case 3: // COLUMN
return COLUMN;
case 4: // AMMOUNT
return AMMOUNT;
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 __AMMOUNT_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.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.AMMOUNT, new org.apache.thrift.meta_data.FieldMetaData("ammount", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIncrement.class, metaDataMap);
}
public TIncrement() {
}
public TIncrement(
ByteBuffer table,
ByteBuffer row,
ByteBuffer column,
long ammount)
{
this();
this.table = table;
this.row = row;
this.column = column;
this.ammount = ammount;
setAmmountIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TIncrement(TIncrement other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetTable()) {
this.table = other.table;
}
if (other.isSetRow()) {
this.row = other.row;
}
if (other.isSetColumn()) {
this.column = other.column;
}
this.ammount = other.ammount;
}
public TIncrement deepCopy() {
return new TIncrement(this);
}
@Override
public void clear() {
this.table = null;
this.row = null;
this.column = null;
setAmmountIsSet(false);
this.ammount = 0;
}
public byte[] getTable() {
setTable(org.apache.thrift.TBaseHelper.rightSize(table));
return table == null ? null : table.array();
}
public ByteBuffer bufferForTable() {
return table;
}
public TIncrement setTable(byte[] table) {
setTable(table == null ? (ByteBuffer)null : ByteBuffer.wrap(table));
return this;
}
public TIncrement setTable(ByteBuffer table) {
this.table = table;
return this;
}
public void unsetTable() {
this.table = null;
}
/** Returns true if field table is set (has been assigned a value) and false otherwise */
public boolean isSetTable() {
return this.table != null;
}
public void setTableIsSet(boolean value) {
if (!value) {
this.table = null;
}
}
public byte[] getRow() {
setRow(org.apache.thrift.TBaseHelper.rightSize(row));
return row == null ? null : row.array();
}
public ByteBuffer bufferForRow() {
return row;
}
public TIncrement setRow(byte[] row) {
setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
return this;
}
public TIncrement setRow(ByteBuffer row) {
this.row = row;
return this;
}
public void unsetRow() {
this.row = null;
}
/** Returns true if field row is set (has been assigned a value) and false otherwise */
public boolean isSetRow() {
return this.row != null;
}
public void setRowIsSet(boolean value) {
if (!value) {
this.row = null;
}
}
public byte[] getColumn() {
setColumn(org.apache.thrift.TBaseHelper.rightSize(column));
return column == null ? null : column.array();
}
public ByteBuffer bufferForColumn() {
return column;
}
public TIncrement setColumn(byte[] column) {
setColumn(column == null ? (ByteBuffer)null : ByteBuffer.wrap(column));
return this;
}
public TIncrement 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 long getAmmount() {
return this.ammount;
}
public TIncrement setAmmount(long ammount) {
this.ammount = ammount;
setAmmountIsSet(true);
return this;
}
public void unsetAmmount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AMMOUNT_ISSET_ID);
}
/** Returns true if field ammount is set (has been assigned a value) and false otherwise */
public boolean isSetAmmount() {
return EncodingUtils.testBit(__isset_bitfield, __AMMOUNT_ISSET_ID);
}
public void setAmmountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AMMOUNT_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TABLE:
if (value == null) {
unsetTable();
} else {
setTable((ByteBuffer)value);
}
break;
case ROW:
if (value == null) {
unsetRow();
} else {
setRow((ByteBuffer)value);
}
break;
case COLUMN:
if (value == null) {
unsetColumn();
} else {
setColumn((ByteBuffer)value);
}
break;
case AMMOUNT:
if (value == null) {
unsetAmmount();
} else {
setAmmount((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TABLE:
return getTable();
case ROW:
return getRow();
case COLUMN:
return getColumn();
case AMMOUNT:
return Long.valueOf(getAmmount());
}
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 TABLE:
return isSetTable();
case ROW:
return isSetRow();
case COLUMN:
return isSetColumn();
case AMMOUNT:
return isSetAmmount();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TIncrement)
return this.equals((TIncrement)that);
return false;
}
public boolean equals(TIncrement that) {
if (that == null)
return false;
boolean this_present_table = true && this.isSetTable();
boolean that_present_table = true && that.isSetTable();
if (this_present_table || that_present_table) {
if (!(this_present_table && that_present_table))
return false;
if (!this.table.equals(that.table))
return false;
}
boolean this_present_row = true && this.isSetRow();
boolean that_present_row = true && that.isSetRow();
if (this_present_row || that_present_row) {
if (!(this_present_row && that_present_row))
return false;
if (!this.row.equals(that.row))
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_ammount = true;
boolean that_present_ammount = true;
if (this_present_ammount || that_present_ammount) {
if (!(this_present_ammount && that_present_ammount))
return false;
if (this.ammount != that.ammount)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(TIncrement other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
TIncrement typedOther = (TIncrement)other;
lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTable()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, typedOther.table);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRow()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumn()).compareTo(typedOther.isSetColumn());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumn()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, typedOther.column);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAmmount()).compareTo(typedOther.isSetAmmount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAmmount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ammount, typedOther.ammount);
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("TIncrement(");
boolean first = true;
sb.append("table:");
if (this.table == null) {
sb.append("null");
} else {
sb.append(this.table);
}
first = false;
if (!first) sb.append(", ");
sb.append("row:");
if (this.row == null) {
sb.append("null");
} else {
sb.append(this.row);
}
first = false;
if (!first) sb.append(", ");
sb.append("column:");
if (this.column == null) {
sb.append("null");
} else {
sb.append(this.column);
}
first = false;
if (!first) sb.append(", ");
sb.append("ammount:");
sb.append(this.ammount);
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 TIncrementStandardSchemeFactory implements SchemeFactory {
public TIncrementStandardScheme getScheme() {
return new TIncrementStandardScheme();
}
}
private static class TIncrementStandardScheme extends StandardScheme<TIncrement> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TIncrement 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: // TABLE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.table = iprot.readBinary();
struct.setTableIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // ROW
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.row = iprot.readBinary();
struct.setRowIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // 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;
case 4: // AMMOUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.ammount = iprot.readI64();
struct.setAmmountIsSet(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, TIncrement struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.table != null) {
oprot.writeFieldBegin(TABLE_FIELD_DESC);
oprot.writeBinary(struct.table);
oprot.writeFieldEnd();
}
if (struct.row != null) {
oprot.writeFieldBegin(ROW_FIELD_DESC);
oprot.writeBinary(struct.row);
oprot.writeFieldEnd();
}
if (struct.column != null) {
oprot.writeFieldBegin(COLUMN_FIELD_DESC);
oprot.writeBinary(struct.column);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(AMMOUNT_FIELD_DESC);
oprot.writeI64(struct.ammount);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TIncrementTupleSchemeFactory implements SchemeFactory {
public TIncrementTupleScheme getScheme() {
return new TIncrementTupleScheme();
}
}
private static class TIncrementTupleScheme extends TupleScheme<TIncrement> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetTable()) {
optionals.set(0);
}
if (struct.isSetRow()) {
optionals.set(1);
}
if (struct.isSetColumn()) {
optionals.set(2);
}
if (struct.isSetAmmount()) {
optionals.set(3);
}
oprot.writeBitSet(optionals, 4);
if (struct.isSetTable()) {
oprot.writeBinary(struct.table);
}
if (struct.isSetRow()) {
oprot.writeBinary(struct.row);
}
if (struct.isSetColumn()) {
oprot.writeBinary(struct.column);
}
if (struct.isSetAmmount()) {
oprot.writeI64(struct.ammount);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(4);
if (incoming.get(0)) {
struct.table = iprot.readBinary();
struct.setTableIsSet(true);
}
if (incoming.get(1)) {
struct.row = iprot.readBinary();
struct.setRowIsSet(true);
}
if (incoming.get(2)) {
struct.column = iprot.readBinary();
struct.setColumnIsSet(true);
}
if (incoming.get(3)) {
struct.ammount = iprot.readI64();
struct.setAmmountIsSet(true);
}
}
}
}

View File

@ -0,0 +1,564 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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;
/**
* Holds row name and then a map of columns to cells.
*/
public class TRowResult implements org.apache.thrift.TBase<TRowResult, TRowResult._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowResult");
private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", 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.MAP, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TRowResultStandardSchemeFactory());
schemes.put(TupleScheme.class, new TRowResultTupleSchemeFactory());
}
public ByteBuffer row; // required
public Map<ByteBuffer,TCell> 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 {
ROW((short)1, "row"),
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: // ROW
return ROW;
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.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.DEFAULT,
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 , "Text"),
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCell.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRowResult.class, metaDataMap);
}
public TRowResult() {
}
public TRowResult(
ByteBuffer row,
Map<ByteBuffer,TCell> columns)
{
this();
this.row = row;
this.columns = columns;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TRowResult(TRowResult other) {
if (other.isSetRow()) {
this.row = other.row;
}
if (other.isSetColumns()) {
Map<ByteBuffer,TCell> __this__columns = new HashMap<ByteBuffer,TCell>();
for (Map.Entry<ByteBuffer, TCell> other_element : other.columns.entrySet()) {
ByteBuffer other_element_key = other_element.getKey();
TCell other_element_value = other_element.getValue();
ByteBuffer __this__columns_copy_key = other_element_key;
TCell __this__columns_copy_value = new TCell(other_element_value);
__this__columns.put(__this__columns_copy_key, __this__columns_copy_value);
}
this.columns = __this__columns;
}
}
public TRowResult deepCopy() {
return new TRowResult(this);
}
@Override
public void clear() {
this.row = null;
this.columns = null;
}
public byte[] getRow() {
setRow(org.apache.thrift.TBaseHelper.rightSize(row));
return row == null ? null : row.array();
}
public ByteBuffer bufferForRow() {
return row;
}
public TRowResult setRow(byte[] row) {
setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
return this;
}
public TRowResult setRow(ByteBuffer row) {
this.row = row;
return this;
}
public void unsetRow() {
this.row = null;
}
/** Returns true if field row is set (has been assigned a value) and false otherwise */
public boolean isSetRow() {
return this.row != null;
}
public void setRowIsSet(boolean value) {
if (!value) {
this.row = null;
}
}
public int getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
public void putToColumns(ByteBuffer key, TCell val) {
if (this.columns == null) {
this.columns = new HashMap<ByteBuffer,TCell>();
}
this.columns.put(key, val);
}
public Map<ByteBuffer,TCell> getColumns() {
return this.columns;
}
public TRowResult setColumns(Map<ByteBuffer,TCell> 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 ROW:
if (value == null) {
unsetRow();
} else {
setRow((ByteBuffer)value);
}
break;
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((Map<ByteBuffer,TCell>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ROW:
return getRow();
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 ROW:
return isSetRow();
case COLUMNS:
return isSetColumns();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TRowResult)
return this.equals((TRowResult)that);
return false;
}
public boolean equals(TRowResult that) {
if (that == null)
return false;
boolean this_present_row = true && this.isSetRow();
boolean that_present_row = true && that.isSetRow();
if (this_present_row || that_present_row) {
if (!(this_present_row && that_present_row))
return false;
if (!this.row.equals(that.row))
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() {
return 0;
}
public int compareTo(TRowResult other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
TRowResult typedOther = (TRowResult)other;
lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRow()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.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("TRowResult(");
boolean first = true;
sb.append("row:");
if (this.row == null) {
sb.append("null");
} else {
sb.append(this.row);
}
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
// 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 TRowResultStandardSchemeFactory implements SchemeFactory {
public TRowResultStandardScheme getScheme() {
return new TRowResultStandardScheme();
}
}
private static class TRowResultStandardScheme extends StandardScheme<TRowResult> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TRowResult 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: // ROW
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.row = iprot.readBinary();
struct.setRowIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // COLUMNS
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
org.apache.thrift.protocol.TMap _map8 = iprot.readMapBegin();
struct.columns = new HashMap<ByteBuffer,TCell>(2*_map8.size);
for (int _i9 = 0; _i9 < _map8.size; ++_i9)
{
ByteBuffer _key10; // required
TCell _val11; // required
_key10 = iprot.readBinary();
_val11 = new TCell();
_val11.read(iprot);
struct.columns.put(_key10, _val11);
}
iprot.readMapEnd();
}
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, TRowResult struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.row != null) {
oprot.writeFieldBegin(ROW_FIELD_DESC);
oprot.writeBinary(struct.row);
oprot.writeFieldEnd();
}
if (struct.columns != null) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
for (Map.Entry<ByteBuffer, TCell> _iter12 : struct.columns.entrySet())
{
oprot.writeBinary(_iter12.getKey());
_iter12.getValue().write(oprot);
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TRowResultTupleSchemeFactory implements SchemeFactory {
public TRowResultTupleScheme getScheme() {
return new TRowResultTupleScheme();
}
}
private static class TRowResultTupleScheme extends TupleScheme<TRowResult> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TRowResult struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetRow()) {
optionals.set(0);
}
if (struct.isSetColumns()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetRow()) {
oprot.writeBinary(struct.row);
}
if (struct.isSetColumns()) {
{
oprot.writeI32(struct.columns.size());
for (Map.Entry<ByteBuffer, TCell> _iter13 : struct.columns.entrySet())
{
oprot.writeBinary(_iter13.getKey());
_iter13.getValue().write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TRowResult struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.row = iprot.readBinary();
struct.setRowIsSet(true);
}
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TMap _map14 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.columns = new HashMap<ByteBuffer,TCell>(2*_map14.size);
for (int _i15 = 0; _i15 < _map14.size; ++_i15)
{
ByteBuffer _key16; // required
TCell _val17; // required
_key16 = iprot.readBinary();
_val17 = new TCell();
_val17.read(iprot);
struct.columns.put(_key16, _val17);
}
}
struct.setColumnsIsSet(true);
}
}
}
}

View File

@ -0,0 +1,969 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hbase.thrift.generated;
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 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 Scan object is used to specify scanner parameters when opening a scanner.
*/
public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TScan");
private static final org.apache.thrift.protocol.TField START_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("startRow", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField STOP_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("stopRow", 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 COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)4);
private static final org.apache.thrift.protocol.TField CACHING_FIELD_DESC = new org.apache.thrift.protocol.TField("caching", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField FILTER_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("filterString", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new TScanStandardSchemeFactory());
schemes.put(TupleScheme.class, new TScanTupleSchemeFactory());
}
public ByteBuffer startRow; // optional
public ByteBuffer stopRow; // optional
public long timestamp; // optional
public List<ByteBuffer> columns; // optional
public int caching; // optional
public ByteBuffer filterString; // 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_ROW((short)1, "startRow"),
STOP_ROW((short)2, "stopRow"),
TIMESTAMP((short)3, "timestamp"),
COLUMNS((short)4, "columns"),
CACHING((short)5, "caching"),
FILTER_STRING((short)6, "filterString");
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_ROW
return START_ROW;
case 2: // STOP_ROW
return STOP_ROW;
case 3: // TIMESTAMP
return TIMESTAMP;
case 4: // COLUMNS
return COLUMNS;
case 5: // CACHING
return CACHING;
case 6: // FILTER_STRING
return FILTER_STRING;
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 __CACHING_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.TIMESTAMP,_Fields.COLUMNS,_Fields.CACHING,_Fields.FILTER_STRING};
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_ROW, new org.apache.thrift.meta_data.FieldMetaData("startRow", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
tmpMap.put(_Fields.STOP_ROW, new org.apache.thrift.meta_data.FieldMetaData("stopRow", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
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.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", 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 , "Text"))));
tmpMap.put(_Fields.CACHING, new org.apache.thrift.meta_data.FieldMetaData("caching", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.FILTER_STRING, new org.apache.thrift.meta_data.FieldMetaData("filterString", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TScan.class, metaDataMap);
}
public TScan() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TScan(TScan other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetStartRow()) {
this.startRow = other.startRow;
}
if (other.isSetStopRow()) {
this.stopRow = other.stopRow;
}
this.timestamp = other.timestamp;
if (other.isSetColumns()) {
List<ByteBuffer> __this__columns = new ArrayList<ByteBuffer>();
for (ByteBuffer other_element : other.columns) {
__this__columns.add(other_element);
}
this.columns = __this__columns;
}
this.caching = other.caching;
if (other.isSetFilterString()) {
this.filterString = other.filterString;
}
}
public TScan deepCopy() {
return new TScan(this);
}
@Override
public void clear() {
this.startRow = null;
this.stopRow = null;
setTimestampIsSet(false);
this.timestamp = 0;
this.columns = null;
setCachingIsSet(false);
this.caching = 0;
this.filterString = null;
}
public byte[] getStartRow() {
setStartRow(org.apache.thrift.TBaseHelper.rightSize(startRow));
return startRow == null ? null : startRow.array();
}
public ByteBuffer bufferForStartRow() {
return startRow;
}
public TScan setStartRow(byte[] startRow) {
setStartRow(startRow == null ? (ByteBuffer)null : ByteBuffer.wrap(startRow));
return this;
}
public TScan setStartRow(ByteBuffer startRow) {
this.startRow = startRow;
return this;
}
public void unsetStartRow() {
this.startRow = null;
}
/** Returns true if field startRow is set (has been assigned a value) and false otherwise */
public boolean isSetStartRow() {
return this.startRow != null;
}
public void setStartRowIsSet(boolean value) {
if (!value) {
this.startRow = null;
}
}
public byte[] getStopRow() {
setStopRow(org.apache.thrift.TBaseHelper.rightSize(stopRow));
return stopRow == null ? null : stopRow.array();
}
public ByteBuffer bufferForStopRow() {
return stopRow;
}
public TScan setStopRow(byte[] stopRow) {
setStopRow(stopRow == null ? (ByteBuffer)null : ByteBuffer.wrap(stopRow));
return this;
}
public TScan setStopRow(ByteBuffer stopRow) {
this.stopRow = stopRow;
return this;
}
public void unsetStopRow() {
this.stopRow = null;
}
/** Returns true if field stopRow is set (has been assigned a value) and false otherwise */
public boolean isSetStopRow() {
return this.stopRow != null;
}
public void setStopRowIsSet(boolean value) {
if (!value) {
this.stopRow = null;
}
}
public long getTimestamp() {
return this.timestamp;
}
public TScan 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 getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
public java.util.Iterator<ByteBuffer> getColumnsIterator() {
return (this.columns == null) ? null : this.columns.iterator();
}
public void addToColumns(ByteBuffer elem) {
if (this.columns == null) {
this.columns = new ArrayList<ByteBuffer>();
}
this.columns.add(elem);
}
public List<ByteBuffer> getColumns() {
return this.columns;
}
public TScan setColumns(List<ByteBuffer> 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 int getCaching() {
return this.caching;
}
public TScan setCaching(int caching) {
this.caching = caching;
setCachingIsSet(true);
return this;
}
public void unsetCaching() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CACHING_ISSET_ID);
}
/** Returns true if field caching is set (has been assigned a value) and false otherwise */
public boolean isSetCaching() {
return EncodingUtils.testBit(__isset_bitfield, __CACHING_ISSET_ID);
}
public void setCachingIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CACHING_ISSET_ID, value);
}
public byte[] getFilterString() {
setFilterString(org.apache.thrift.TBaseHelper.rightSize(filterString));
return filterString == null ? null : filterString.array();
}
public ByteBuffer bufferForFilterString() {
return filterString;
}
public TScan setFilterString(byte[] filterString) {
setFilterString(filterString == null ? (ByteBuffer)null : ByteBuffer.wrap(filterString));
return this;
}
public TScan setFilterString(ByteBuffer filterString) {
this.filterString = filterString;
return this;
}
public void unsetFilterString() {
this.filterString = null;
}
/** Returns true if field filterString is set (has been assigned a value) and false otherwise */
public boolean isSetFilterString() {
return this.filterString != null;
}
public void setFilterStringIsSet(boolean value) {
if (!value) {
this.filterString = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case START_ROW:
if (value == null) {
unsetStartRow();
} else {
setStartRow((ByteBuffer)value);
}
break;
case STOP_ROW:
if (value == null) {
unsetStopRow();
} else {
setStopRow((ByteBuffer)value);
}
break;
case TIMESTAMP:
if (value == null) {
unsetTimestamp();
} else {
setTimestamp((Long)value);
}
break;
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((List<ByteBuffer>)value);
}
break;
case CACHING:
if (value == null) {
unsetCaching();
} else {
setCaching((Integer)value);
}
break;
case FILTER_STRING:
if (value == null) {
unsetFilterString();
} else {
setFilterString((ByteBuffer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case START_ROW:
return getStartRow();
case STOP_ROW:
return getStopRow();
case TIMESTAMP:
return Long.valueOf(getTimestamp());
case COLUMNS:
return getColumns();
case CACHING:
return Integer.valueOf(getCaching());
case FILTER_STRING:
return getFilterString();
}
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_ROW:
return isSetStartRow();
case STOP_ROW:
return isSetStopRow();
case TIMESTAMP:
return isSetTimestamp();
case COLUMNS:
return isSetColumns();
case CACHING:
return isSetCaching();
case FILTER_STRING:
return isSetFilterString();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof TScan)
return this.equals((TScan)that);
return false;
}
public boolean equals(TScan that) {
if (that == null)
return false;
boolean this_present_startRow = true && this.isSetStartRow();
boolean that_present_startRow = true && that.isSetStartRow();
if (this_present_startRow || that_present_startRow) {
if (!(this_present_startRow && that_present_startRow))
return false;
if (!this.startRow.equals(that.startRow))
return false;
}
boolean this_present_stopRow = true && this.isSetStopRow();
boolean that_present_stopRow = true && that.isSetStopRow();
if (this_present_stopRow || that_present_stopRow) {
if (!(this_present_stopRow && that_present_stopRow))
return false;
if (!this.stopRow.equals(that.stopRow))
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_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;
}
boolean this_present_caching = true && this.isSetCaching();
boolean that_present_caching = true && that.isSetCaching();
if (this_present_caching || that_present_caching) {
if (!(this_present_caching && that_present_caching))
return false;
if (this.caching != that.caching)
return false;
}
boolean this_present_filterString = true && this.isSetFilterString();
boolean that_present_filterString = true && that.isSetFilterString();
if (this_present_filterString || that_present_filterString) {
if (!(this_present_filterString && that_present_filterString))
return false;
if (!this.filterString.equals(that.filterString))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(TScan other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
TScan typedOther = (TScan)other;
lastComparison = Boolean.valueOf(isSetStartRow()).compareTo(typedOther.isSetStartRow());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStartRow()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startRow, typedOther.startRow);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetStopRow()).compareTo(typedOther.isSetStopRow());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStopRow()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stopRow, typedOther.stopRow);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTimestamp()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.columns);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCaching()).compareTo(typedOther.isSetCaching());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCaching()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.caching, typedOther.caching);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFilterString()).compareTo(typedOther.isSetFilterString());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFilterString()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filterString, typedOther.filterString);
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("TScan(");
boolean first = true;
if (isSetStartRow()) {
sb.append("startRow:");
if (this.startRow == null) {
sb.append("null");
} else {
sb.append(this.startRow);
}
first = false;
}
if (isSetStopRow()) {
if (!first) sb.append(", ");
sb.append("stopRow:");
if (this.stopRow == null) {
sb.append("null");
} else {
sb.append(this.stopRow);
}
first = false;
}
if (isSetTimestamp()) {
if (!first) sb.append(", ");
sb.append("timestamp:");
sb.append(this.timestamp);
first = false;
}
if (isSetColumns()) {
if (!first) sb.append(", ");
sb.append("columns:");
if (this.columns == null) {
sb.append("null");
} else {
sb.append(this.columns);
}
first = false;
}
if (isSetCaching()) {
if (!first) sb.append(", ");
sb.append("caching:");
sb.append(this.caching);
first = false;
}
if (isSetFilterString()) {
if (!first) sb.append(", ");
sb.append("filterString:");
if (this.filterString == null) {
sb.append("null");
} else {
sb.append(this.filterString);
}
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 TScanStandardSchemeFactory implements SchemeFactory {
public TScanStandardScheme getScheme() {
return new TScanStandardScheme();
}
}
private static class TScanStandardScheme extends StandardScheme<TScan> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TScan 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_ROW
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.startRow = iprot.readBinary();
struct.setStartRowIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // STOP_ROW
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.stopRow = iprot.readBinary();
struct.setStopRowIsSet(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: // COLUMNS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list18 = iprot.readListBegin();
struct.columns = new ArrayList<ByteBuffer>(_list18.size);
for (int _i19 = 0; _i19 < _list18.size; ++_i19)
{
ByteBuffer _elem20; // required
_elem20 = iprot.readBinary();
struct.columns.add(_elem20);
}
iprot.readListEnd();
}
struct.setColumnsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // CACHING
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.caching = iprot.readI32();
struct.setCachingIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // FILTER_STRING
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.filterString = iprot.readBinary();
struct.setFilterStringIsSet(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, TScan struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.startRow != null) {
if (struct.isSetStartRow()) {
oprot.writeFieldBegin(START_ROW_FIELD_DESC);
oprot.writeBinary(struct.startRow);
oprot.writeFieldEnd();
}
}
if (struct.stopRow != null) {
if (struct.isSetStopRow()) {
oprot.writeFieldBegin(STOP_ROW_FIELD_DESC);
oprot.writeBinary(struct.stopRow);
oprot.writeFieldEnd();
}
}
if (struct.isSetTimestamp()) {
oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
oprot.writeI64(struct.timestamp);
oprot.writeFieldEnd();
}
if (struct.columns != null) {
if (struct.isSetColumns()) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.columns.size()));
for (ByteBuffer _iter21 : struct.columns)
{
oprot.writeBinary(_iter21);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
if (struct.isSetCaching()) {
oprot.writeFieldBegin(CACHING_FIELD_DESC);
oprot.writeI32(struct.caching);
oprot.writeFieldEnd();
}
if (struct.filterString != null) {
if (struct.isSetFilterString()) {
oprot.writeFieldBegin(FILTER_STRING_FIELD_DESC);
oprot.writeBinary(struct.filterString);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TScanTupleSchemeFactory implements SchemeFactory {
public TScanTupleScheme getScheme() {
return new TScanTupleScheme();
}
}
private static class TScanTupleScheme extends TupleScheme<TScan> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TScan struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetStartRow()) {
optionals.set(0);
}
if (struct.isSetStopRow()) {
optionals.set(1);
}
if (struct.isSetTimestamp()) {
optionals.set(2);
}
if (struct.isSetColumns()) {
optionals.set(3);
}
if (struct.isSetCaching()) {
optionals.set(4);
}
if (struct.isSetFilterString()) {
optionals.set(5);
}
oprot.writeBitSet(optionals, 6);
if (struct.isSetStartRow()) {
oprot.writeBinary(struct.startRow);
}
if (struct.isSetStopRow()) {
oprot.writeBinary(struct.stopRow);
}
if (struct.isSetTimestamp()) {
oprot.writeI64(struct.timestamp);
}
if (struct.isSetColumns()) {
{
oprot.writeI32(struct.columns.size());
for (ByteBuffer _iter22 : struct.columns)
{
oprot.writeBinary(_iter22);
}
}
}
if (struct.isSetCaching()) {
oprot.writeI32(struct.caching);
}
if (struct.isSetFilterString()) {
oprot.writeBinary(struct.filterString);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TScan struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(6);
if (incoming.get(0)) {
struct.startRow = iprot.readBinary();
struct.setStartRowIsSet(true);
}
if (incoming.get(1)) {
struct.stopRow = iprot.readBinary();
struct.setStopRowIsSet(true);
}
if (incoming.get(2)) {
struct.timestamp = iprot.readI64();
struct.setTimestampIsSet(true);
}
if (incoming.get(3)) {
{
org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.columns = new ArrayList<ByteBuffer>(_list23.size);
for (int _i24 = 0; _i24 < _list23.size; ++_i24)
{
ByteBuffer _elem25; // required
_elem25 = iprot.readBinary();
struct.columns.add(_elem25);
}
}
struct.setColumnsIsSet(true);
}
if (incoming.get(4)) {
struct.caching = iprot.readI32();
struct.setCachingIsSet(true);
}
if (incoming.get(5)) {
struct.filterString = iprot.readBinary();
struct.setFilterStringIsSet(true);
}
}
}
}

View File

@ -19,18 +19,13 @@
#
#
# Instructions:
# 1. Run Thrift to generate the perl module HBase
# thrift --gen perl ../../../src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
# 2. Add the gen-perl/Hbase directory to your perl's @INC path:
# a. This is one of the paths listed in: perl -e 'print join ("\n", @INC) . "\n"'
# -OR-
# b. set PERL5LIB to include the gen-perl/ directory
# 3. Execute perl DemoClient.pl.
use strict;
use warnings;
# Change the path here to point to your thrift directory.
use lib '/Users/sergey/Downloads/thrift/lib/perl/lib';
use lib 'gen-perl';
use Thrift::Socket;
use Thrift::BufferedTransport;
use Thrift::BinaryProtocol;

View File

@ -0,0 +1,13 @@
#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
package Hbase::Constants;
require 5.6.0;
use strict;
use warnings;
use Thrift;
1;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,27 +19,47 @@
* limitations under the License.
*/
# Instructions:
# 1. Run Thrift to generate the php module HBase
# thrift --gen php ../../../src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
# 2. Modify the import string below to point to {$THRIFT_HOME}/lib/php/src.
# 3. Execute {php DemoClient.php}. Note that you must use php5 or higher.
# 4. See {$THRIFT_HOME}/lib/php/README for additional help.
# See {$THRIFT_HOME}/lib/php/README for additional help.
# Change this to match your thrift root
# Change this to match your thrift root.
$GLOBALS['THRIFT_ROOT'] = '/Users/irubin/Thrift/thrift-20080411p1/lib/php/src';
require_once( $GLOBALS['THRIFT_ROOT'].'/Thrift.php' );
# Something is wrong with this. Is this the PHP way of doing things?
# Old versions of thrift seemingly worked with just a couple includes.
require_once( $GLOBALS['THRIFT_ROOT'].'/type/TMessageType.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/type/TType.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/exception/TException.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/factory/TStringFuncFactory.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/stringfunc/TStringFunc.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/stringfunc/Core.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php' );
# According to the thrift documentation, compiled PHP thrift libraries should
# reside under the THRIFT_ROOT/packages directory. If these compiled libraries
# are not present in this directory, move them there from gen-php/.
require_once( $GLOBALS['THRIFT_ROOT'].'/packages/Hbase/Hbase.php' );
# reside under the THRIFT_ROOT/packages directory. Copy them there from gen-php/.
if (mkdir($GLOBALS['THRIFT_ROOT'].'/packages/Hbase', 0770, true)) {
$files = scandir('gen-php/Hbase');
foreach ($files as $file) {
if (preg_match("/.*php$/", $file)) {
copy("./gen-php/Hbase/$file", $GLOBALS['THRIFT_ROOT']."/packages/Hbase/$file");
}
}
}
require_once( $GLOBALS['THRIFT_ROOT'].'/packages/Hbase/Hbase.php' );
require_once( $GLOBALS['THRIFT_ROOT'].'/packages/Hbase/Types.php' );
use Thrift\Transport\TSocket;
use Thrift\Transport\TBufferedTransport;
use Thrift\Protocol\TBinaryProtocol;
use Hbase\HbaseClient;
use Hbase\ColumnDescriptor;
use Hbase\Mutation;
function printRow( $rowresult ) {
echo( "row: {$rowresult->row}, cols: \n" );
$values = $rowresult->columns;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -16,19 +16,16 @@
See the License for the specific language governing permissions and
limitations under the License.
'''
# Instructions:
# 1. Run Thrift to generate the python module HBase
# thrift --gen py ../../../src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
# 2. Create a directory of your choosing that contains:
# a. This file (DemoClient.py).
# b. The directory gen-py/hbase (generated by instruction step 1).
# c. The directory {$THRIFT_HOME}/lib/py/build/lib.{YOUR_SYSTEM}/thrift.
# Or, modify the import statements below such that this file can access the
# directories from steps 3b and 3c.
# 3. Execute {python DemoClient.py}.
import sys
import time
import os
# Modify this import path to point to the correct location to thrift.
thrift_path = os.path.abspath('/Users/sergey/Downloads/thrift/lib/py/build/lib.macosx-10.8-intel-2.7')
sys.path.append(thrift_path)
gen_py_path = os.path.abspath('gen-py')
sys.path.append(gen_py_path)
from thrift import Thrift
from thrift.transport import TSocket, TTransport

View File

@ -0,0 +1,382 @@
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
import sys
import pprint
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol
import Hbase
from ttypes import *
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ''
print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
print ''
print 'Functions:'
print ' void enableTable(Bytes tableName)'
print ' void disableTable(Bytes tableName)'
print ' bool isTableEnabled(Bytes tableName)'
print ' void compact(Bytes tableNameOrRegionName)'
print ' void majorCompact(Bytes tableNameOrRegionName)'
print ' getTableNames()'
print ' getColumnDescriptors(Text tableName)'
print ' getTableRegions(Text tableName)'
print ' void createTable(Text tableName, columnFamilies)'
print ' void deleteTable(Text tableName)'
print ' get(Text tableName, Text row, Text column, attributes)'
print ' getVer(Text tableName, Text row, Text column, i32 numVersions, attributes)'
print ' getVerTs(Text tableName, Text row, Text column, i64 timestamp, i32 numVersions, attributes)'
print ' getRow(Text tableName, Text row, attributes)'
print ' getRowWithColumns(Text tableName, Text row, columns, attributes)'
print ' getRowTs(Text tableName, Text row, i64 timestamp, attributes)'
print ' getRowWithColumnsTs(Text tableName, Text row, columns, i64 timestamp, attributes)'
print ' getRows(Text tableName, rows, attributes)'
print ' getRowsWithColumns(Text tableName, rows, columns, attributes)'
print ' getRowsTs(Text tableName, rows, i64 timestamp, attributes)'
print ' getRowsWithColumnsTs(Text tableName, rows, columns, i64 timestamp, attributes)'
print ' void mutateRow(Text tableName, Text row, mutations, attributes)'
print ' void mutateRowTs(Text tableName, Text row, mutations, i64 timestamp, attributes)'
print ' void mutateRows(Text tableName, rowBatches, attributes)'
print ' void mutateRowsTs(Text tableName, rowBatches, i64 timestamp, attributes)'
print ' i64 atomicIncrement(Text tableName, Text row, Text column, i64 value)'
print ' void deleteAll(Text tableName, Text row, Text column, attributes)'
print ' void deleteAllTs(Text tableName, Text row, Text column, i64 timestamp, attributes)'
print ' void deleteAllRow(Text tableName, Text row, attributes)'
print ' void increment(TIncrement increment)'
print ' void incrementRows( increments)'
print ' void deleteAllRowTs(Text tableName, Text row, i64 timestamp, attributes)'
print ' ScannerID scannerOpenWithScan(Text tableName, TScan scan, attributes)'
print ' ScannerID scannerOpen(Text tableName, Text startRow, columns, attributes)'
print ' ScannerID scannerOpenWithStop(Text tableName, Text startRow, Text stopRow, columns, attributes)'
print ' ScannerID scannerOpenWithPrefix(Text tableName, Text startAndPrefix, columns, attributes)'
print ' ScannerID scannerOpenTs(Text tableName, Text startRow, columns, i64 timestamp, attributes)'
print ' ScannerID scannerOpenWithStopTs(Text tableName, Text startRow, Text stopRow, columns, i64 timestamp, attributes)'
print ' scannerGet(ScannerID id)'
print ' scannerGetList(ScannerID id, i32 nbRows)'
print ' void scannerClose(ScannerID id)'
print ' getRowOrBefore(Text tableName, Text row, Text family)'
print ' TRegionInfo getRegionInfo(Text row)'
print ''
sys.exit(0)
pp = pprint.PrettyPrinter(indent = 2)
host = 'localhost'
port = 9090
uri = ''
framed = False
http = False
argi = 1
if sys.argv[argi] == '-h':
parts = sys.argv[argi+1].split(':')
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
argi += 2
if sys.argv[argi] == '-u':
url = urlparse(sys.argv[argi+1])
parts = url[1].split(':')
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
else:
port = 80
uri = url[2]
if url[4]:
uri += '?%s' % url[4]
http = True
argi += 2
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
framed = True
argi += 1
cmd = sys.argv[argi]
args = sys.argv[argi+1:]
if http:
transport = THttpClient.THttpClient(host, port, uri)
else:
socket = TSocket.TSocket(host, port)
if framed:
transport = TTransport.TFramedTransport(socket)
else:
transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Hbase.Client(protocol)
transport.open()
if cmd == 'enableTable':
if len(args) != 1:
print 'enableTable requires 1 args'
sys.exit(1)
pp.pprint(client.enableTable(eval(args[0]),))
elif cmd == 'disableTable':
if len(args) != 1:
print 'disableTable requires 1 args'
sys.exit(1)
pp.pprint(client.disableTable(eval(args[0]),))
elif cmd == 'isTableEnabled':
if len(args) != 1:
print 'isTableEnabled requires 1 args'
sys.exit(1)
pp.pprint(client.isTableEnabled(eval(args[0]),))
elif cmd == 'compact':
if len(args) != 1:
print 'compact requires 1 args'
sys.exit(1)
pp.pprint(client.compact(eval(args[0]),))
elif cmd == 'majorCompact':
if len(args) != 1:
print 'majorCompact requires 1 args'
sys.exit(1)
pp.pprint(client.majorCompact(eval(args[0]),))
elif cmd == 'getTableNames':
if len(args) != 0:
print 'getTableNames requires 0 args'
sys.exit(1)
pp.pprint(client.getTableNames())
elif cmd == 'getColumnDescriptors':
if len(args) != 1:
print 'getColumnDescriptors requires 1 args'
sys.exit(1)
pp.pprint(client.getColumnDescriptors(eval(args[0]),))
elif cmd == 'getTableRegions':
if len(args) != 1:
print 'getTableRegions requires 1 args'
sys.exit(1)
pp.pprint(client.getTableRegions(eval(args[0]),))
elif cmd == 'createTable':
if len(args) != 2:
print 'createTable requires 2 args'
sys.exit(1)
pp.pprint(client.createTable(eval(args[0]),eval(args[1]),))
elif cmd == 'deleteTable':
if len(args) != 1:
print 'deleteTable requires 1 args'
sys.exit(1)
pp.pprint(client.deleteTable(eval(args[0]),))
elif cmd == 'get':
if len(args) != 4:
print 'get requires 4 args'
sys.exit(1)
pp.pprint(client.get(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'getVer':
if len(args) != 5:
print 'getVer requires 5 args'
sys.exit(1)
pp.pprint(client.getVer(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'getVerTs':
if len(args) != 6:
print 'getVerTs requires 6 args'
sys.exit(1)
pp.pprint(client.getVerTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),))
elif cmd == 'getRow':
if len(args) != 3:
print 'getRow requires 3 args'
sys.exit(1)
pp.pprint(client.getRow(eval(args[0]),eval(args[1]),eval(args[2]),))
elif cmd == 'getRowWithColumns':
if len(args) != 4:
print 'getRowWithColumns requires 4 args'
sys.exit(1)
pp.pprint(client.getRowWithColumns(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'getRowTs':
if len(args) != 4:
print 'getRowTs requires 4 args'
sys.exit(1)
pp.pprint(client.getRowTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'getRowWithColumnsTs':
if len(args) != 5:
print 'getRowWithColumnsTs requires 5 args'
sys.exit(1)
pp.pprint(client.getRowWithColumnsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'getRows':
if len(args) != 3:
print 'getRows requires 3 args'
sys.exit(1)
pp.pprint(client.getRows(eval(args[0]),eval(args[1]),eval(args[2]),))
elif cmd == 'getRowsWithColumns':
if len(args) != 4:
print 'getRowsWithColumns requires 4 args'
sys.exit(1)
pp.pprint(client.getRowsWithColumns(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'getRowsTs':
if len(args) != 4:
print 'getRowsTs requires 4 args'
sys.exit(1)
pp.pprint(client.getRowsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'getRowsWithColumnsTs':
if len(args) != 5:
print 'getRowsWithColumnsTs requires 5 args'
sys.exit(1)
pp.pprint(client.getRowsWithColumnsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'mutateRow':
if len(args) != 4:
print 'mutateRow requires 4 args'
sys.exit(1)
pp.pprint(client.mutateRow(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'mutateRowTs':
if len(args) != 5:
print 'mutateRowTs requires 5 args'
sys.exit(1)
pp.pprint(client.mutateRowTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'mutateRows':
if len(args) != 3:
print 'mutateRows requires 3 args'
sys.exit(1)
pp.pprint(client.mutateRows(eval(args[0]),eval(args[1]),eval(args[2]),))
elif cmd == 'mutateRowsTs':
if len(args) != 4:
print 'mutateRowsTs requires 4 args'
sys.exit(1)
pp.pprint(client.mutateRowsTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'atomicIncrement':
if len(args) != 4:
print 'atomicIncrement requires 4 args'
sys.exit(1)
pp.pprint(client.atomicIncrement(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'deleteAll':
if len(args) != 4:
print 'deleteAll requires 4 args'
sys.exit(1)
pp.pprint(client.deleteAll(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'deleteAllTs':
if len(args) != 5:
print 'deleteAllTs requires 5 args'
sys.exit(1)
pp.pprint(client.deleteAllTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'deleteAllRow':
if len(args) != 3:
print 'deleteAllRow requires 3 args'
sys.exit(1)
pp.pprint(client.deleteAllRow(eval(args[0]),eval(args[1]),eval(args[2]),))
elif cmd == 'increment':
if len(args) != 1:
print 'increment requires 1 args'
sys.exit(1)
pp.pprint(client.increment(eval(args[0]),))
elif cmd == 'incrementRows':
if len(args) != 1:
print 'incrementRows requires 1 args'
sys.exit(1)
pp.pprint(client.incrementRows(eval(args[0]),))
elif cmd == 'deleteAllRowTs':
if len(args) != 4:
print 'deleteAllRowTs requires 4 args'
sys.exit(1)
pp.pprint(client.deleteAllRowTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'scannerOpenWithScan':
if len(args) != 3:
print 'scannerOpenWithScan requires 3 args'
sys.exit(1)
pp.pprint(client.scannerOpenWithScan(eval(args[0]),eval(args[1]),eval(args[2]),))
elif cmd == 'scannerOpen':
if len(args) != 4:
print 'scannerOpen requires 4 args'
sys.exit(1)
pp.pprint(client.scannerOpen(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'scannerOpenWithStop':
if len(args) != 5:
print 'scannerOpenWithStop requires 5 args'
sys.exit(1)
pp.pprint(client.scannerOpenWithStop(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'scannerOpenWithPrefix':
if len(args) != 4:
print 'scannerOpenWithPrefix requires 4 args'
sys.exit(1)
pp.pprint(client.scannerOpenWithPrefix(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
elif cmd == 'scannerOpenTs':
if len(args) != 5:
print 'scannerOpenTs requires 5 args'
sys.exit(1)
pp.pprint(client.scannerOpenTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
elif cmd == 'scannerOpenWithStopTs':
if len(args) != 6:
print 'scannerOpenWithStopTs requires 6 args'
sys.exit(1)
pp.pprint(client.scannerOpenWithStopTs(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),))
elif cmd == 'scannerGet':
if len(args) != 1:
print 'scannerGet requires 1 args'
sys.exit(1)
pp.pprint(client.scannerGet(eval(args[0]),))
elif cmd == 'scannerGetList':
if len(args) != 2:
print 'scannerGetList requires 2 args'
sys.exit(1)
pp.pprint(client.scannerGetList(eval(args[0]),eval(args[1]),))
elif cmd == 'scannerClose':
if len(args) != 1:
print 'scannerClose requires 1 args'
sys.exit(1)
pp.pprint(client.scannerClose(eval(args[0]),))
elif cmd == 'getRowOrBefore':
if len(args) != 3:
print 'getRowOrBefore requires 3 args'
sys.exit(1)
pp.pprint(client.getRowOrBefore(eval(args[0]),eval(args[1]),eval(args[2]),))
elif cmd == 'getRegionInfo':
if len(args) != 1:
print 'getRegionInfo requires 1 args'
sys.exit(1)
pp.pprint(client.getRegionInfo(eval(args[0]),))
else:
print 'Unrecognized method %s' % cmd
sys.exit(1)
transport.close()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
__all__ = ['ttypes', 'constants', 'Hbase']

View File

@ -0,0 +1,11 @@
#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *

File diff suppressed because it is too large Load Diff

View File

@ -18,17 +18,14 @@
# limitations under the License.
# Instructions:
# 1. Run Thrift to generate the ruby module HBase
# thrift --gen rb ../../../src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
# 2. Modify the import string below to point to {$THRIFT_HOME}/lib/rb/lib.
# 3. Execute {ruby DemoClient.rb}.
# Modify the import string below to point to {$THRIFT_HOME}/lib/rb/lib.
# You will need to modify this import string:
# TODO: fix rb/php/py examples to actually work, similar to HBASE-3630.
$:.push('~/Thrift/thrift-20080411p1/lib/rb/lib')
$:.push('./gen-rb')
require 'thrift/transport/tsocket'
require 'thrift/protocol/tbinaryprotocol'
require 'thrift'
require 'Hbase'
@ -40,8 +37,18 @@ def printRow(rowresult)
puts ""
end
transport = TBufferedTransport.new(TSocket.new("localhost", 9090))
protocol = TBinaryProtocol.new(transport)
host = "localhost"
port = 9090
if ARGV.length > 0
host = ARGV[0]
end
if ARGV.length > 1
port = ARGV[1]
end
transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, port))
protocol = Thrift::BinaryProtocol.new(transport)
client = Apache::Hadoop::Hbase::Thrift::Hbase::Client.new(protocol)
transport.open()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
require 'thrift'
require 'hbase_types'
module Apache
module Hadoop
module Hbase
module Thrift
end
end
end
end

View File

@ -0,0 +1,284 @@
#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
require 'thrift'
module Apache
module Hadoop
module Hbase
module Thrift
# TCell - Used to transport a cell value (byte[]) and the timestamp it was
# stored with together as a result for get and getRow methods. This promotes
# the timestamp of a cell to a first-class value, making it easy to take
# note of temporal data. Cell is used all the way from HStore up to HTable.
class TCell
include ::Thrift::Struct, ::Thrift::Struct_Union
VALUE = 1
TIMESTAMP = 2
FIELDS = {
VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# An HColumnDescriptor contains information about a column family
# such as the number of versions, compression settings, etc. It is
# used as input when creating a table or adding a column.
class ColumnDescriptor
include ::Thrift::Struct, ::Thrift::Struct_Union
NAME = 1
MAXVERSIONS = 2
COMPRESSION = 3
INMEMORY = 4
BLOOMFILTERTYPE = 5
BLOOMFILTERVECTORSIZE = 6
BLOOMFILTERNBHASHES = 7
BLOCKCACHEENABLED = 8
TIMETOLIVE = 9
FIELDS = {
NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
MAXVERSIONS => {:type => ::Thrift::Types::I32, :name => 'maxVersions', :default => 3},
COMPRESSION => {:type => ::Thrift::Types::STRING, :name => 'compression', :default => %q"NONE"},
INMEMORY => {:type => ::Thrift::Types::BOOL, :name => 'inMemory', :default => false},
BLOOMFILTERTYPE => {:type => ::Thrift::Types::STRING, :name => 'bloomFilterType', :default => %q"NONE"},
BLOOMFILTERVECTORSIZE => {:type => ::Thrift::Types::I32, :name => 'bloomFilterVectorSize', :default => 0},
BLOOMFILTERNBHASHES => {:type => ::Thrift::Types::I32, :name => 'bloomFilterNbHashes', :default => 0},
BLOCKCACHEENABLED => {:type => ::Thrift::Types::BOOL, :name => 'blockCacheEnabled', :default => false},
TIMETOLIVE => {:type => ::Thrift::Types::I32, :name => 'timeToLive', :default => -1}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# A TRegionInfo contains information about an HTable region.
class TRegionInfo
include ::Thrift::Struct, ::Thrift::Struct_Union
STARTKEY = 1
ENDKEY = 2
ID = 3
NAME = 4
VERSION = 5
SERVERNAME = 6
PORT = 7
FIELDS = {
STARTKEY => {:type => ::Thrift::Types::STRING, :name => 'startKey', :binary => true},
ENDKEY => {:type => ::Thrift::Types::STRING, :name => 'endKey', :binary => true},
ID => {:type => ::Thrift::Types::I64, :name => 'id'},
NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
VERSION => {:type => ::Thrift::Types::BYTE, :name => 'version'},
SERVERNAME => {:type => ::Thrift::Types::STRING, :name => 'serverName', :binary => true},
PORT => {:type => ::Thrift::Types::I32, :name => 'port'}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# A Mutation object is used to either update or delete a column-value.
class Mutation
include ::Thrift::Struct, ::Thrift::Struct_Union
ISDELETE = 1
COLUMN = 2
VALUE = 3
WRITETOWAL = 4
FIELDS = {
ISDELETE => {:type => ::Thrift::Types::BOOL, :name => 'isDelete', :default => false},
COLUMN => {:type => ::Thrift::Types::STRING, :name => 'column', :binary => true},
VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
WRITETOWAL => {:type => ::Thrift::Types::BOOL, :name => 'writeToWAL', :default => true}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# A BatchMutation object is used to apply a number of Mutations to a single row.
class BatchMutation
include ::Thrift::Struct, ::Thrift::Struct_Union
ROW = 1
MUTATIONS = 2
FIELDS = {
ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
MUTATIONS => {:type => ::Thrift::Types::LIST, :name => 'mutations', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Apache::Hadoop::Hbase::Thrift::Mutation}}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# For increments that are not incrementColumnValue
# equivalents.
class TIncrement
include ::Thrift::Struct, ::Thrift::Struct_Union
TABLE = 1
ROW = 2
COLUMN = 3
AMMOUNT = 4
FIELDS = {
TABLE => {:type => ::Thrift::Types::STRING, :name => 'table', :binary => true},
ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
COLUMN => {:type => ::Thrift::Types::STRING, :name => 'column', :binary => true},
AMMOUNT => {:type => ::Thrift::Types::I64, :name => 'ammount'}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# Holds row name and then a map of columns to cells.
class TRowResult
include ::Thrift::Struct, ::Thrift::Struct_Union
ROW = 1
COLUMNS = 2
FIELDS = {
ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
COLUMNS => {:type => ::Thrift::Types::MAP, :name => 'columns', :key => {:type => ::Thrift::Types::STRING, :binary => true}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::Apache::Hadoop::Hbase::Thrift::TCell}}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# A Scan object is used to specify scanner parameters when opening a scanner.
class TScan
include ::Thrift::Struct, ::Thrift::Struct_Union
STARTROW = 1
STOPROW = 2
TIMESTAMP = 3
COLUMNS = 4
CACHING = 5
FILTERSTRING = 6
FIELDS = {
STARTROW => {:type => ::Thrift::Types::STRING, :name => 'startRow', :binary => true, :optional => true},
STOPROW => {:type => ::Thrift::Types::STRING, :name => 'stopRow', :binary => true, :optional => true},
TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true},
COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRING, :binary => true}, :optional => true},
CACHING => {:type => ::Thrift::Types::I32, :name => 'caching', :optional => true},
FILTERSTRING => {:type => ::Thrift::Types::STRING, :name => 'filterString', :binary => true, :optional => true}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# An IOError exception signals that an error occurred communicating
# to the Hbase master or an Hbase region server. Also used to return
# more general Hbase error conditions.
class IOError < ::Thrift::Exception
include ::Thrift::Struct, ::Thrift::Struct_Union
def initialize(message=nil)
super()
self.message = message
end
MESSAGE = 1
FIELDS = {
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# An IllegalArgument exception indicates an illegal or invalid
# argument was passed into a procedure.
class IllegalArgument < ::Thrift::Exception
include ::Thrift::Struct, ::Thrift::Struct_Union
def initialize(message=nil)
super()
self.message = message
end
MESSAGE = 1
FIELDS = {
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
# An AlreadyExists exceptions signals that a table with the specified
# name already exists
class AlreadyExists < ::Thrift::Exception
include ::Thrift::Struct, ::Thrift::Struct_Union
def initialize(message=nil)
super()
self.message = message
end
MESSAGE = 1
FIELDS = {
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
}
def struct_fields; FIELDS; end
def validate
end
::Thrift::Struct.generate_accessors self
end
end
end
end
end

View File

@ -35,7 +35,7 @@ namespace cpp apache.hadoop.hbase.thrift
namespace rb Apache.Hadoop.Hbase.Thrift
namespace py hbase
namespace perl Hbase
namespace php Hbase
//
// Types
//

View File

@ -55,6 +55,7 @@
<module>hbase-hadoop-compat</module>
<module>hbase-common</module>
<module>hbase-it</module>
<module>hbase-examples</module>
</modules>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/hbase/trunk</connection>
@ -941,6 +942,11 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>hbase-examples</artifactId>
<groupId>org.apache.hbase</groupId>
<version>${project.version}</version>
</dependency>
<!-- General dependencies -->
<dependency>
<groupId>io.netty</groupId>

View File

@ -42,6 +42,7 @@
<include>org.apache.hbase:hbase-hadoop-compat</include>
<include>org.apache.hbase:hbase-server</include>
<include>org.apache.hbase:hbase-hadoop1-compat</include>
<include>org.apache.hbase:hbase-examples</include>
</includes>
<!-- Include all the sources in the top directory -->
<sources>

View File

@ -43,6 +43,7 @@
<include>org.apache.hbase:hbase-hadoop-compat</include>
<include>org.apache.hbase:hbase-server</include>
<include>org.apache.hbase:hbase-hadoop1-compat</include>
<include>org.apache.hbase:hbase-examples</include>
</includes>
<!-- Include all the sources in the top directory -->
<sources>