diff --git a/README.md b/README.md index 3534f511..923ca5a2 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,4 @@ Connectors for [Apache HBase™](https://hbase.apache.org) * [Kafka Proxy](https://github.com/apache/hbase-connectors/tree/master/kafka) * [Spark](https://github.com/apache/hbase-connectors/tree/master/spark) + * [Python-Thrift2](https://github.com/apache/hbase-connectors/tree/master/thrift-python) diff --git a/thrift-python/README.md b/thrift-python/README.md new file mode 100644 index 00000000..1db64ea3 --- /dev/null +++ b/thrift-python/README.md @@ -0,0 +1,200 @@ + + +# Project description +This is a client python API for HBase thrift2 service. Added exception handling and autoretry, reconnection functions. +## Build and upload to pypi (for project maintainer) +1. We need to build up a pypi project with the corresponding name (hbase-client-thrift2). +2. Modify the version number in the setup.py file. +3. Run python packing instruction: +```python +python setup.py sdist +``` +The target package will be created in a new created dist directory. +4. Upload the package to pypi with twine. +```python +python -m twine upload dist/the_pacakge_file +``` +The last step needs the pypi account and password. Besides, there should be a existing pypi project with the same name under the account. +## Install +Use pip to install the package (recommended). +```commandline +pip install hbase-client-thrift2 +``` +## Usage +### Single thread +```python +from hbase-client-thrift2.thrift2.client import Client +from hbase-client-thrift2.config import ClientConfig, TransportType, ProtocolType +from hbase-client-thrift2.thrift2.operation import Delete, Scan, Put, Get + +if __name__ == '__main__': + conf = ClientConfig(thrift_host=host, + port=port, + retry_times=10, + retry_timeout=10, + transport_type=TransportType.BUFFERED, + protocol_type=ProtocolType.BINARY, + use_ssl=True, + batch_size=10, + use_http=True) + client = Client(conf) + if client.open_connection(): + table = client.get_table("your_table_name") + # example for a single operation + p = Put(row="your_row_key", + family="column_family", + qualifier="column_qualifier", + value="your_value") + table.put(p) + # example for a batch operation + put_list = [] + for i in range(100): + row_key = "row{}".format(i) + p = Put(row=row_key, + family="column_family", + qualifier="column_qualifier", + value="your_value") + put_list.append(p) + table.put_batch(put_list) + # do not forget to close the connection after using + client.close_connection() +``` +###Multi-threaded +The thrift basic transport is not thread-safe. In this case, if you want to parallelize your program, +you should create a new connection object for each thread. +The sample code is: +```python +from hbase-client-thrift2.thrift2.client import Client +from hbase-client-thrift2.config import ClientConfig, TransportType, ProtocolType +from hbase-client-thrift2.thrift2.operation import Delete, Scan, Put, Get +import threading +import logging + + +# initialize the logger to check runtime log information for more details about logger usage please refer: https://docs.python.org/2.7/library/logging.html +logging.basicConfig() + + +host = your_host +port = your_port + + +def demo_func(conf): + # get the Client object + client = Client(conf) + + # Open the connection + if client.open_connection(): + + # get a table object with given table name + table = client.get_table("your_table_name") + # single put operation + p = Put(row="your_row_key", + family="your_column_family", + qualifier="your_column_qualifier", + value="your_data") + if table.put(p): + # do sth + else: + # do sth + + + # batch put operation + put_list = [] + for i in range(100): + row_key = "row{}".format(i) + p = Put(row=row_key, + family="your_column_family", + qualifier="your_column_qualifier", + value="your_data") + put_list.append(p) + if table.put_batch(put_list): + # do sth + else: + # do sth + + # single get operation + g = Get(row=row_key,family="your_column_family",qualifier="your_coloumn_qualifier",max_versions=your_max_version) + result = table.get(g) + + # batch get operation + get_list = [] + for i in range(10): + get_list.append(Get(row=row_key, + family='0', + qualifier=None, + max_versions=1)) + table.get_batch(get_list) + + # single delete operation + delete = Delete(row='row10', + family='0') + if table.delete(delete): + # do sth. + + else: + # do sth. + + # delete batch operation + delete_list = [] + for i in range(10): + delete_list.append(Delete(row='row{}'.format(i))) + if table.delete_batch(delete_list): + # do sth. + else: + # do sth. + + # scan operation + scan = Scan(start_row="your_start_row_key", + family="your_column_family", + qualifier="your_column_qualifier", + max_versions="your_max_version", + reversed="if_reverse_results") + results = table.scan(scan=scan) + print [str(r) for r in results] + # don't forget to close the connection after using. + client.close_connection() + + +if __name__ == '__main__': + + # initialize the client configuration + conf = ClientConfig(thrift_host=host, # thrift server address type: str + port=9090, # thrift server port type: int, default 9090 + retry_times=10, + # retry times for reconnection when client lose connnection with the server, type: int, default: 10 + retry_timeout=10, # seconds between two reconnection tries, type: int, default: 10 + transport_type=TransportType.FRAMED, + # Use the Enum class, default: TransportType.BUFFERED + protocol_type=ProtocolType.BINARY, + # Use the relative Enum class, default: ProtocolType.BINARY + use_ssl=True, + # If True, the Client will use SSL Socket to transport requests to the thrift server + batch_size=10, # The max size of the batch operations + use_http=True, + ) + # initialize thread list + thread_list = [] + for _ in range(10): + x = threading.Thread(target=demo_func, args=(conf,)) + thread_list.append(x) + x.start() + for thread in thread_list: + thread.join() +``` diff --git a/thrift-python/hbase-client-thrift2/__init__.py b/thrift-python/hbase-client-thrift2/__init__.py new file mode 100644 index 00000000..68d08b17 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/__init__.py @@ -0,0 +1,14 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +__all__ = ['clientbase', 'connection'] \ No newline at end of file diff --git a/thrift-python/hbase-client-thrift2/clientbase.py b/thrift-python/hbase-client-thrift2/clientbase.py new file mode 100644 index 00000000..e409f192 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/clientbase.py @@ -0,0 +1,326 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from thbase.config import ClientConfig +from thbase.connection import Connection +from thbase.util.handlers import ExceptionHandler, MessageType +import abc +import logging + +logger = logging.getLogger(__name__) + + +class ClientBase(object): + """ + Abstract class for both thrift1 and thrift2 client. Implemented with Observer design pattern. + This class uses a connection object to manage the basic thrift connection with thrift server. + """ + def __init__(self, conf): + """ + Initialize the thrift connection and add a new exception handler to deal with exceptions. + This class should be used by user in NO circumstance! + Args: + conf: a customized ClientConfig object. + """ + if not isinstance(conf, ClientConfig): + err_str = "Invalid Client Configuration type {}.".format(type(conf)) + logger.error(ValueError(err_str)) + raise ValueError(err_str) + self.conf = conf + self.connection = Connection(host=self.conf.host, + port=self.conf.port, + transport_type=self.conf.transport_type, + protocol_type=self.conf.protocol_type, + retry_timeout=self.conf.retry_timeout, + retry_times=self.conf.retry_times, + use_ssl=self.conf.use_ssl, + use_http=self.conf.use_http, + authentication=self.conf.authentication, + keep_alive=self.conf.keep_alive, + ) + self._observers = set() + self.attach(ExceptionHandler(self)) + + def attach(self, observer): + """ + Add a new observer into the observer set. + Args: + observer: object watching on this client. + + Returns: + + """ + self._observers.add(observer) + + def detach(self, observer): + """ + Remove an observer from the observer set. If the observer is not registered, do nothing. + Args: + observer: object in the observer set. + + Returns: + + """ + if observer in self._observers: + self._observers.discard(observer) + + def notify(self, message_type, value): + """ + Notify all the observer to handle something. + Args: + message_type: an enum defined in util.handlers module. + value: the data for handling. + + Returns: + + """ + for obr in self._observers: + obr.handle(message_type, value) + + def open_connection(self): + """ + This method open the connection with thrift server. + Raise TTransport exception. + Returns: True if success, else False. + + """ + try: + if not self.connection.is_open(): + self.connection.open() + return self.connection.is_open() + return True + except Exception as e: + self.notify(MessageType.ERROR, e) + return self.connection.is_open() + + def close_connection(self): + """ + This method close the current connection. The close() will not raise any exception and will always success. + Returns: None + + """ + if self.connection.is_open(): + self.connection.close() + + @abc.abstractmethod + def _put_row(self, table_name, put): + """ + Send a single put request to thrift server. Only should be invoked by a Table object. + Args: + table_name: Should be invoked by a Table object. + put: a Put object. + + Returns: + True if the operation successes, else False. + + """ + pass + + @abc.abstractmethod + def _put_rows(self, table_name, put_list): + """ + Send a batch of put requests to thrift server. Only should be invoked by a Table object. + Args: + table_name: a str representation of Table name, including the namespace part. + put_list: a list of Put objects. + + Returns: + True if the operation successes, else False. + + """ + pass + + @abc.abstractmethod + def _get_row(self, table_name, get): + """ + Send a single get request to thrift server. Only should be invoked by a Table object. + Args: + table_name: a str representation of Table name, including the namespace part. + get: a Get object. + + Returns: + A list of Cells if success. An empty list if the operation fails or the target cell does not exists. + """ + pass + + @abc.abstractmethod + def _get_rows(self, table_name, get_list): + """ + Send a batch of get requests to thrift server. Only should be invoked by a Table object. + Args: + table_name: a str representation of Table name, including the namespace part. + get_list: a list of Get objects. + + Returns: + A list of Cells if success. An empty list if the operation fails or the target cells do not exists. + """ + pass + + @abc.abstractmethod + def _scan(self, table_name, scan): + """ + Send a scan request to thrift server. Only should be invoked by a Table object. + Args: + table_name: a str representation of Table name, including the namespace part. + scan: a Scan object. + + Returns: + A list of Cells if success. An empty list if the operation fails or the target cells do not exists. + """ + pass + + @abc.abstractmethod + def _delete_row(self, table_name, delete): + """ + Send a delete request to thrift server. Only should be invoked by a Table object. + Args: + table_name: a str representation of Table name, including the namespace part. + delete: a Delete object. + + Returns: + True if successes, else False. + """ + pass + + @abc.abstractmethod + def _delete_batch(self, table_name, delete_list): + """ + Send a batch of delete requests to thrift server. Only should be invoked by a Table object. + Args: + table_name: a str representation of Table name, including the namespace part. + delete_list: a list of Delete objects. + + Returns: + True if successes, else False. + """ + pass + + @abc.abstractmethod + def _refresh_client(self): + """ + Reconstruct a client, be used when the client reconnects to the thrift server. + Returns: + None + """ + pass + + @abc.abstractmethod + def get_table(self, table_name): + """ + Get a Table object of given table name. + Args: + table_name: a str representation of Table name, including the namespace part. + + Returns: + a Table object. + """ + pass + + @abc.abstractmethod + def create_table(self, desc, split_keys): + """ + Create a table. + Args: + desc: a TTableDescriptor that contains the table meta data. + split_keys: keys for pre-splitting + + Returns: + True if success, else False. + """ + pass + + @abc.abstractmethod + def delete_table(self, table_name): + """ + Delete a table. The table should be disabled first. + Args: + table_name: The corresponding table name. + + Returns: + + """ + pass + + @abc.abstractmethod + def enable_table(self, table_name): + """ + Enable a table. If the table is already enabled, will return an error. + Args: + table_name: The name of corresponding table. + + Returns: + + """ + pass + + @abc.abstractmethod + def disable_table(self, table_name): + """ + Disable a table. If the table is already disabled, will return an error. + Args: + table_name: The name of corresponding table. + + Returns: + + """ + pass + + @abc.abstractmethod + def truncate_table(self, table_name, preserve_splits): + """ + Drop a table and recreate it. + Args: + table_name: The name of the table. + preserve_splits: If the splits need to be preserved. + + Returns: + + """ + pass + + @abc.abstractmethod + def is_enabled(self, table_name): + """ + Check if the given table is enabled. + Args: + table_name: TTableName + + Returns: + + """ + pass + + @abc.abstractmethod + def get_tableDescriptor(self, table_name): + """ + Get a TTableDescriptor of a specific table. + Args: + table_name: + + Returns: + + """ + pass + + @abc.abstractmethod + def modify_columnFamily(self, table_name, desc): + """ + Modify the attribute of a column family. + Args: + table_name: + desc: + + Returns: + + """ + pass diff --git a/thrift-python/hbase-client-thrift2/config.py b/thrift-python/hbase-client-thrift2/config.py new file mode 100644 index 00000000..62ba34cf --- /dev/null +++ b/thrift-python/hbase-client-thrift2/config.py @@ -0,0 +1,154 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from enum import Enum +from thbase.util.login import LoginEntry + +TransportType = Enum('TransportType', ['FRAMED', 'BUFFERED']) +ProtocolType = Enum('ProtocolType', ['BINARY', 'COMPACT']) + +HOST_DEFAULT = 'localhost' +PORT_DEFAULT = 9090 +TRANSPORT_DEFAULT = TransportType.FRAMED +PROTOCOL_DEFAULT = ProtocolType.BINARY +RETRY_TIMEOUT_DEFAULT = 1 +RETRY_TIMES_DEFAULT = 10 +BATCH_SIZE_DEFAULT = 10 +USE_SSL_DEFAULT = False +USE_HTTP_DEFAULT = False +RECONNECTION_TIMES = 10 +RECONNECTION_TIMEOUT = 10 + + +class ClientConfig(object): + def __init__(self, thrift_host=HOST_DEFAULT, # type: str + port=PORT_DEFAULT, # type: int + retry_timeout=RETRY_TIMES_DEFAULT, # type: int + retry_times=RETRY_TIMES_DEFAULT, # type: int + connection_retry_times=RECONNECTION_TIMES, # type: int + connection_retry_timeout=RECONNECTION_TIMEOUT, # type: int + transport_type=TRANSPORT_DEFAULT, # type: TransportType + protocol_type=PROTOCOL_DEFAULT, # type: ProtocolType + use_ssl=USE_SSL_DEFAULT, # type: bool + batch_size=BATCH_SIZE_DEFAULT, # type: int + use_http=USE_HTTP_DEFAULT, # type: bool + authentication=None, # type: LoginEntry + keep_alive=False, + ): + """ + Basic client configuration. + Args: + thrift_host: thrift server address + port: thrift server port + retry_timeout: time interval between two retries for operation. Unit is seconds. + retry_times: operation retry times. If the operation is still unsuccessful after being + retried for this times, it will return False. + connection_retry_times: time interval between two retries for reconnection. Unit is seconds. + connection_retry_timeout: reconnection retry times. If the client still cannot rebuild the connection + after retrying for this times, an exception will be raised. + transport_type: Up to now, the server support "framed", "buffered" and "http" transport. + protocol_type: Up to now, the server support "Binary" and "Compact" protocol. + use_ssl: if the client use SSL to secure the connection. Only support http transport and binary protocol. + batch_size: the max size of the batch when using batch operation in a Table object. + Batch size can be customized with given setter method. + use_http: if the client use http as the transport but not TCP. + keep_alive: if the client keep the basic TCP socket alive. + """ + self._host = thrift_host + self._port = port + self._connection_retry_timeout = connection_retry_timeout + self._connection_retry_times = connection_retry_times + self._retry_timeout = retry_timeout + self._retry_times = retry_times + self._transport_type = transport_type + self._protocol_type = protocol_type + self._batch_size = batch_size + self._use_ssl = use_ssl + self._use_http = use_http + self._authentication = authentication + self._keep_alive = keep_alive + self._parameter_check() + + def _parameter_check(self): + if not isinstance(self.port, int) or self.port not in range(65536): + raise ValueError("Port must be an integer in 0~65535.") + if not isinstance(self.retry_times, int) or self.retry_times < 1: + raise ValueError("Retry times for connection rebuild must be a positive integer.") + if not isinstance(self.retry_timeout, int) or self.retry_timeout < 1: + raise ValueError("Time interval for connection rebuild must be a positive integer.") + if not isinstance(self.batch_size, int) or self.batch_size < 1: + raise ValueError("Batch size must be a positive integer.") + if not isinstance(self.use_ssl, bool): + raise ValueError("parameter use_ssl must be a bool value.") + if not isinstance(self.use_http, bool): + raise ValueError("parameter use_http must be a bool value.") + if not (isinstance(self._authentication, LoginEntry) or None): + raise ValueError("parameter authentication must be a LoginEntry object or None.") + if self._transport_type not in TransportType: + raise ValueError("Invalid type of transport {}. Use one of the specific enum type {}." + .format(type(self._transport_type), ', '.join([str(a) for a in TransportType]))) + if self._protocol_type not in ProtocolType: + raise ValueError("Invalid type of protocol {}. Use one of the specific enum type {}." + .format(type(self._protocol_type), ', '.join([str(a) for a in ProtocolType]))) + + @property + def host(self): + return self._host + + @property + def port(self): + return self._port + + @property + def connection_retry_timeout(self): + return self._connection_retry_timeout + + @property + def connection_retry_times(self): + return self._connection_retry_times + + @property + def transport_type(self): + return self._transport_type + + @property + def protocol_type(self): + return self._protocol_type + + @property + def batch_size(self): + return self._batch_size + + @property + def use_ssl(self): + return self._use_ssl + + @property + def use_http(self): + return self._use_http + + @property + def retry_times(self): + return self._retry_times + + @property + def retry_timeout(self): + return self._retry_timeout + + @property + def authentication(self): + return self._authentication + + @property + def keep_alive(self): + return self._keep_alive diff --git a/thrift-python/hbase-client-thrift2/connection.py b/thrift-python/hbase-client-thrift2/connection.py new file mode 100644 index 00000000..d130786c --- /dev/null +++ b/thrift-python/hbase-client-thrift2/connection.py @@ -0,0 +1,140 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +import logging +import time + +from thrift.protocol import TBinaryProtocol, TCompactProtocol +from thrift.transport.TSocket import TSocket +from thrift.transport.TTransport import TBufferedTransport, TFramedTransport, TTransportException, TSaslClientTransport +from thrift.transport.THttpClient import THttpClient + +from thbase.config import TransportType, ProtocolType + +logger = logging.getLogger(__name__) + +THRIFT_TRANSPORTS = { + TransportType.BUFFERED: TBufferedTransport, + TransportType.FRAMED: TFramedTransport, +} +THRIFT_PROTOCOLS = { + ProtocolType.BINARY: TBinaryProtocol.TBinaryProtocol, + ProtocolType.COMPACT: TCompactProtocol.TCompactProtocol, +} + + +class Connection(object): + """ + Class to manage basic transport and protocol. + User should not use instances of this class directly. + The instances should be managed by a Client object. + + """ + def __init__(self, host, + port, + transport_type, + protocol_type, + retry_timeout, + retry_times, + use_ssl, + use_http, + authentication, + keep_alive=False): + + self.host = host + self.port = port + self.use_ssl = use_ssl + self.use_http = use_http + self.authentication = authentication + self.keep_alive = keep_alive + + self._transport_type = THRIFT_TRANSPORTS[transport_type] + self._protocol_type = THRIFT_PROTOCOLS[protocol_type] + self._retry_timeout = retry_timeout + self._retry_times = retry_times + self._rebuild_protocol() + self._initialized = True + + def _rebuild_protocol(self): + """ + Rebuild the transport, protocol from the configuration. + Should not be used directly by users. + Returns: + None + """ + if self.use_http: + # if use http transport, + prefix = 'https://' if self.use_ssl else 'http://' + self.transport = THttpClient(uri_or_host=prefix + self.host + ':' + str(self.port)) + self.protocol = TBinaryProtocol.TBinaryProtocol(self.transport) + return + + if self.use_ssl: + from thrift.transport.TSSLSocket import TSSLSocket + socket = TSSLSocket(host=self.host, port=self.port, validate=False, socket_keepalive=self.keep_alive) + else: + socket = TSocket(host=self.host, port=self.port, socket_keepalive=self.keep_alive) + + if self.authentication: + socket = TSaslClientTransport(socket, host=self.host, + service=self.authentication.service, + mechanism=self.authentication.mechanism, + username=self.authentication.username, + password=self.authentication.password, + ) + + self.transport = self._transport_type(socket) + self.protocol = self._protocol_type(self.transport) + + def is_open(self): + return self.transport.isOpen() + + def open(self): + if self.transport.isOpen(): + return + logger.debug("Opening thrift transport throught TCP connection.") + self.transport.open() + + def close(self): + if not self.transport.isOpen(): + return + if logger is not None: + logger.debug("Closing thrift transport to {}:{}.".format(self.host, self.port)) + self.transport.close() + + def _reconnect(self): + """ + Method to rebuild the connection with thrift server. Should not be used by the user directly. + Returns: None + + """ + if not self.transport.isOpen(): + logger.info("Connection lose is detected and start reconnecting to the target thrift server.") + for i in range(self._retry_times): + if self.transport.isOpen(): + logger.info("Reconnection success after retrying {} times.".format(i)) + return True + self._rebuild_protocol() + try: + logger.info("Starting reconnection to thrift server.") + self.transport.open() + logger.info("Reconnection success after retrying {} times.".format(i + 1)) + return True + except TTransportException: + logger.error("Reconnected {} times but failed.".format(i + 1)) + time.sleep(self._retry_timeout) + if not self.transport.isOpen(): + logger.error("Failed to rebuild connection with target thrift server.") + raise TTransportException(type=TTransportException.NOT_OPEN, + message="Failed to rebuild connection with target thrift server.") + return False diff --git a/thrift-python/hbase-client-thrift2/hbase/THBaseService-remote b/thrift-python/hbase-client-thrift2/hbase/THBaseService-remote new file mode 100755 index 00000000..f1ccc8ed --- /dev/null +++ b/thrift-python/hbase-client-thrift2/hbase/THBaseService-remote @@ -0,0 +1,474 @@ +#!/usr/bin/env python +# +# Autogenerated by Thrift Compiler (0.13.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +import sys +import pprint +if sys.version_info[0] > 2: + from urllib.parse import urlparse +else: + from urlparse import urlparse +from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient +from thrift.protocol.TBinaryProtocol import TBinaryProtocol + +from hbase import THBaseService +from hbase.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]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' bool exists(string table, TGet tget)') + print(' existsAll(string table, tgets)') + print(' TResult get(string table, TGet tget)') + print(' getMultiple(string table, tgets)') + print(' void put(string table, TPut tput)') + print(' bool checkAndPut(string table, string row, string family, string qualifier, string value, TPut tput)') + print(' void putMultiple(string table, tputs)') + print(' void deleteSingle(string table, TDelete tdelete)') + print(' deleteMultiple(string table, tdeletes)') + print(' bool checkAndDelete(string table, string row, string family, string qualifier, string value, TDelete tdelete)') + print(' TResult increment(string table, TIncrement tincrement)') + print(' TResult append(string table, TAppend tappend)') + print(' i32 openScanner(string table, TScan tscan)') + print(' getScannerRows(i32 scannerId, i32 numRows)') + print(' void closeScanner(i32 scannerId)') + print(' void mutateRow(string table, TRowMutations trowMutations)') + print(' getScannerResults(string table, TScan tscan, i32 numRows)') + print(' THRegionLocation getRegionLocation(string table, string row, bool reload)') + print(' getAllRegionLocations(string table)') + print(' bool checkAndMutate(string table, string row, string family, string qualifier, TCompareOp compareOp, string value, TRowMutations rowMutations)') + print(' TTableDescriptor getTableDescriptor(TTableName table)') + print(' getTableDescriptors( tables)') + print(' bool tableExists(TTableName tableName)') + print(' getTableDescriptorsByPattern(string regex, bool includeSysTables)') + print(' getTableDescriptorsByNamespace(string name)') + print(' getTableNamesByPattern(string regex, bool includeSysTables)') + print(' getTableNamesByNamespace(string name)') + print(' void createTable(TTableDescriptor desc, splitKeys)') + print(' void deleteTable(TTableName tableName)') + print(' void truncateTable(TTableName tableName, bool preserveSplits)') + print(' void enableTable(TTableName tableName)') + print(' void disableTable(TTableName tableName)') + print(' bool isTableEnabled(TTableName tableName)') + print(' bool isTableDisabled(TTableName tableName)') + print(' bool isTableAvailable(TTableName tableName)') + print(' bool isTableAvailableWithSplit(TTableName tableName, splitKeys)') + print(' void addColumnFamily(TTableName tableName, TColumnFamilyDescriptor column)') + print(' void deleteColumnFamily(TTableName tableName, string column)') + print(' void modifyColumnFamily(TTableName tableName, TColumnFamilyDescriptor column)') + print(' void modifyTable(TTableDescriptor desc)') + print(' void createNamespace(TNamespaceDescriptor namespaceDesc)') + print(' void modifyNamespace(TNamespaceDescriptor namespaceDesc)') + print(' void deleteNamespace(string name)') + print(' TNamespaceDescriptor getNamespaceDescriptor(string name)') + print(' listNamespaceDescriptors()') + print(' listNamespaces()') + print(' TThriftServerType getThriftServerType()') + print(' getSlowLogResponses( serverNames, TLogQueryFilter logQueryFilter)') + print(' clearSlowLogResponses( serverNames)') + print(' bool grant(TAccessControlEntity info)') + print(' bool revoke(TAccessControlEntity info)') + print(' getUserPermission(string domainName, TPermissionScope scope)') + print('') + sys.exit(0) + +pp = pprint.PrettyPrinter(indent=2) +host = 'localhost' +port = 9090 +uri = '' +framed = False +ssl = False +validate = True +ca_certs = None +keyfile = None +certfile = None +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 + +if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': + ssl = True + argi += 1 + +if sys.argv[argi] == '-novalidate': + validate = False + argi += 1 + +if sys.argv[argi] == '-ca_certs': + ca_certs = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-keyfile': + keyfile = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-certfile': + certfile = sys.argv[argi+1] + argi += 2 + +cmd = sys.argv[argi] +args = sys.argv[argi + 1:] + +if http: + transport = THttpClient.THttpClient(host, port, uri) +else: + if ssl: + socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile) + else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol(transport) +client = THBaseService.Client(protocol) +transport.open() + +if cmd == 'exists': + if len(args) != 2: + print('exists requires 2 args') + sys.exit(1) + pp.pprint(client.exists(args[0], eval(args[1]),)) + +elif cmd == 'existsAll': + if len(args) != 2: + print('existsAll requires 2 args') + sys.exit(1) + pp.pprint(client.existsAll(args[0], eval(args[1]),)) + +elif cmd == 'get': + if len(args) != 2: + print('get requires 2 args') + sys.exit(1) + pp.pprint(client.get(args[0], eval(args[1]),)) + +elif cmd == 'getMultiple': + if len(args) != 2: + print('getMultiple requires 2 args') + sys.exit(1) + pp.pprint(client.getMultiple(args[0], eval(args[1]),)) + +elif cmd == 'put': + if len(args) != 2: + print('put requires 2 args') + sys.exit(1) + pp.pprint(client.put(args[0], eval(args[1]),)) + +elif cmd == 'checkAndPut': + if len(args) != 6: + print('checkAndPut requires 6 args') + sys.exit(1) + pp.pprint(client.checkAndPut(args[0], args[1], args[2], args[3], args[4], eval(args[5]),)) + +elif cmd == 'putMultiple': + if len(args) != 2: + print('putMultiple requires 2 args') + sys.exit(1) + pp.pprint(client.putMultiple(args[0], eval(args[1]),)) + +elif cmd == 'deleteSingle': + if len(args) != 2: + print('deleteSingle requires 2 args') + sys.exit(1) + pp.pprint(client.deleteSingle(args[0], eval(args[1]),)) + +elif cmd == 'deleteMultiple': + if len(args) != 2: + print('deleteMultiple requires 2 args') + sys.exit(1) + pp.pprint(client.deleteMultiple(args[0], eval(args[1]),)) + +elif cmd == 'checkAndDelete': + if len(args) != 6: + print('checkAndDelete requires 6 args') + sys.exit(1) + pp.pprint(client.checkAndDelete(args[0], args[1], args[2], args[3], args[4], eval(args[5]),)) + +elif cmd == 'increment': + if len(args) != 2: + print('increment requires 2 args') + sys.exit(1) + pp.pprint(client.increment(args[0], eval(args[1]),)) + +elif cmd == 'append': + if len(args) != 2: + print('append requires 2 args') + sys.exit(1) + pp.pprint(client.append(args[0], eval(args[1]),)) + +elif cmd == 'openScanner': + if len(args) != 2: + print('openScanner requires 2 args') + sys.exit(1) + pp.pprint(client.openScanner(args[0], eval(args[1]),)) + +elif cmd == 'getScannerRows': + if len(args) != 2: + print('getScannerRows requires 2 args') + sys.exit(1) + pp.pprint(client.getScannerRows(eval(args[0]), eval(args[1]),)) + +elif cmd == 'closeScanner': + if len(args) != 1: + print('closeScanner requires 1 args') + sys.exit(1) + pp.pprint(client.closeScanner(eval(args[0]),)) + +elif cmd == 'mutateRow': + if len(args) != 2: + print('mutateRow requires 2 args') + sys.exit(1) + pp.pprint(client.mutateRow(args[0], eval(args[1]),)) + +elif cmd == 'getScannerResults': + if len(args) != 3: + print('getScannerResults requires 3 args') + sys.exit(1) + pp.pprint(client.getScannerResults(args[0], eval(args[1]), eval(args[2]),)) + +elif cmd == 'getRegionLocation': + if len(args) != 3: + print('getRegionLocation requires 3 args') + sys.exit(1) + pp.pprint(client.getRegionLocation(args[0], args[1], eval(args[2]),)) + +elif cmd == 'getAllRegionLocations': + if len(args) != 1: + print('getAllRegionLocations requires 1 args') + sys.exit(1) + pp.pprint(client.getAllRegionLocations(args[0],)) + +elif cmd == 'checkAndMutate': + if len(args) != 7: + print('checkAndMutate requires 7 args') + sys.exit(1) + pp.pprint(client.checkAndMutate(args[0], args[1], args[2], args[3], eval(args[4]), args[5], eval(args[6]),)) + +elif cmd == 'getTableDescriptor': + if len(args) != 1: + print('getTableDescriptor requires 1 args') + sys.exit(1) + pp.pprint(client.getTableDescriptor(eval(args[0]),)) + +elif cmd == 'getTableDescriptors': + if len(args) != 1: + print('getTableDescriptors requires 1 args') + sys.exit(1) + pp.pprint(client.getTableDescriptors(eval(args[0]),)) + +elif cmd == 'tableExists': + if len(args) != 1: + print('tableExists requires 1 args') + sys.exit(1) + pp.pprint(client.tableExists(eval(args[0]),)) + +elif cmd == 'getTableDescriptorsByPattern': + if len(args) != 2: + print('getTableDescriptorsByPattern requires 2 args') + sys.exit(1) + pp.pprint(client.getTableDescriptorsByPattern(args[0], eval(args[1]),)) + +elif cmd == 'getTableDescriptorsByNamespace': + if len(args) != 1: + print('getTableDescriptorsByNamespace requires 1 args') + sys.exit(1) + pp.pprint(client.getTableDescriptorsByNamespace(args[0],)) + +elif cmd == 'getTableNamesByPattern': + if len(args) != 2: + print('getTableNamesByPattern requires 2 args') + sys.exit(1) + pp.pprint(client.getTableNamesByPattern(args[0], eval(args[1]),)) + +elif cmd == 'getTableNamesByNamespace': + if len(args) != 1: + print('getTableNamesByNamespace requires 1 args') + sys.exit(1) + pp.pprint(client.getTableNamesByNamespace(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 == 'truncateTable': + if len(args) != 2: + print('truncateTable requires 2 args') + sys.exit(1) + pp.pprint(client.truncateTable(eval(args[0]), eval(args[1]),)) + +elif 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 == 'isTableDisabled': + if len(args) != 1: + print('isTableDisabled requires 1 args') + sys.exit(1) + pp.pprint(client.isTableDisabled(eval(args[0]),)) + +elif cmd == 'isTableAvailable': + if len(args) != 1: + print('isTableAvailable requires 1 args') + sys.exit(1) + pp.pprint(client.isTableAvailable(eval(args[0]),)) + +elif cmd == 'isTableAvailableWithSplit': + if len(args) != 2: + print('isTableAvailableWithSplit requires 2 args') + sys.exit(1) + pp.pprint(client.isTableAvailableWithSplit(eval(args[0]), eval(args[1]),)) + +elif cmd == 'addColumnFamily': + if len(args) != 2: + print('addColumnFamily requires 2 args') + sys.exit(1) + pp.pprint(client.addColumnFamily(eval(args[0]), eval(args[1]),)) + +elif cmd == 'deleteColumnFamily': + if len(args) != 2: + print('deleteColumnFamily requires 2 args') + sys.exit(1) + pp.pprint(client.deleteColumnFamily(eval(args[0]), args[1],)) + +elif cmd == 'modifyColumnFamily': + if len(args) != 2: + print('modifyColumnFamily requires 2 args') + sys.exit(1) + pp.pprint(client.modifyColumnFamily(eval(args[0]), eval(args[1]),)) + +elif cmd == 'modifyTable': + if len(args) != 1: + print('modifyTable requires 1 args') + sys.exit(1) + pp.pprint(client.modifyTable(eval(args[0]),)) + +elif cmd == 'createNamespace': + if len(args) != 1: + print('createNamespace requires 1 args') + sys.exit(1) + pp.pprint(client.createNamespace(eval(args[0]),)) + +elif cmd == 'modifyNamespace': + if len(args) != 1: + print('modifyNamespace requires 1 args') + sys.exit(1) + pp.pprint(client.modifyNamespace(eval(args[0]),)) + +elif cmd == 'deleteNamespace': + if len(args) != 1: + print('deleteNamespace requires 1 args') + sys.exit(1) + pp.pprint(client.deleteNamespace(args[0],)) + +elif cmd == 'getNamespaceDescriptor': + if len(args) != 1: + print('getNamespaceDescriptor requires 1 args') + sys.exit(1) + pp.pprint(client.getNamespaceDescriptor(args[0],)) + +elif cmd == 'listNamespaceDescriptors': + if len(args) != 0: + print('listNamespaceDescriptors requires 0 args') + sys.exit(1) + pp.pprint(client.listNamespaceDescriptors()) + +elif cmd == 'listNamespaces': + if len(args) != 0: + print('listNamespaces requires 0 args') + sys.exit(1) + pp.pprint(client.listNamespaces()) + +elif cmd == 'getThriftServerType': + if len(args) != 0: + print('getThriftServerType requires 0 args') + sys.exit(1) + pp.pprint(client.getThriftServerType()) + +elif cmd == 'getSlowLogResponses': + if len(args) != 2: + print('getSlowLogResponses requires 2 args') + sys.exit(1) + pp.pprint(client.getSlowLogResponses(eval(args[0]), eval(args[1]),)) + +elif cmd == 'clearSlowLogResponses': + if len(args) != 1: + print('clearSlowLogResponses requires 1 args') + sys.exit(1) + pp.pprint(client.clearSlowLogResponses(eval(args[0]),)) + +elif cmd == 'grant': + if len(args) != 1: + print('grant requires 1 args') + sys.exit(1) + pp.pprint(client.grant(eval(args[0]),)) + +elif cmd == 'revoke': + if len(args) != 1: + print('revoke requires 1 args') + sys.exit(1) + pp.pprint(client.revoke(eval(args[0]),)) + +elif cmd == 'getUserPermission': + if len(args) != 2: + print('getUserPermission requires 2 args') + sys.exit(1) + pp.pprint(client.getUserPermission(args[0], eval(args[1]),)) + +else: + print('Unrecognized method %s' % cmd) + sys.exit(1) + +transport.close() diff --git a/thrift-python/hbase-client-thrift2/hbase/THBaseService.py b/thrift-python/hbase-client-thrift2/hbase/THBaseService.py new file mode 100644 index 00000000..2f92e65f --- /dev/null +++ b/thrift-python/hbase-client-thrift2/hbase/THBaseService.py @@ -0,0 +1,11918 @@ +# +# Autogenerated by Thrift Compiler (0.13.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + +import sys +import logging +from .ttypes import * +from thrift.Thrift import TProcessor +from thrift.transport import TTransport +all_structs = [] + + +class Iface(object): + def exists(self, table, tget): + """ + Test for the existence of columns in the table, as specified in the TGet. + + @return true if the specified TGet matches one or more keys, false if not + + Parameters: + - table: the table to check on + - tget: the TGet to check for + + """ + pass + + def existsAll(self, table, tgets): + """ + Test for the existence of columns in the table, as specified by the TGets. + + This will return an array of booleans. Each value will be true if the related Get matches + one or more keys, false if not. + + Parameters: + - table: the table to check on + - tgets: a list of TGets to check for + + """ + pass + + def get(self, table, tget): + """ + Method for getting data from a row. + + If the row cannot be found an empty Result is returned. + This can be checked by the empty field of the TResult + + @return the result + + Parameters: + - table: the table to get from + - tget: the TGet to fetch + + """ + pass + + def getMultiple(self, table, tgets): + """ + Method for getting multiple rows. + + If a row cannot be found there will be a null + value in the result list for that TGet at the + same position. + + So the Results are in the same order as the TGets. + + Parameters: + - table: the table to get from + - tgets: a list of TGets to fetch, the Result list + will have the Results at corresponding positions + or null if there was an error + + """ + pass + + def put(self, table, tput): + """ + Commit a TPut to a table. + + Parameters: + - table: the table to put data in + - tput: the TPut to put + + """ + pass + + def checkAndPut(self, table, row, family, qualifier, value, tput): + """ + Atomically checks if a row/family/qualifier value matches the expected + value. If it does, it adds the TPut. + + @return true if the new put was executed, false otherwise + + Parameters: + - table: to check in and put to + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - value: the expected value, if not provided the + check is for the non-existence of the + column in question + - tput: the TPut to put if the check succeeds + + """ + pass + + def putMultiple(self, table, tputs): + """ + Commit a List of Puts to the table. + + Parameters: + - table: the table to put data in + - tputs: a list of TPuts to commit + + """ + pass + + def deleteSingle(self, table, tdelete): + """ + Deletes as specified by the TDelete. + + Note: "delete" is a reserved keyword and cannot be used in Thrift + thus the inconsistent naming scheme from the other functions. + + Parameters: + - table: the table to delete from + - tdelete: the TDelete to delete + + """ + pass + + def deleteMultiple(self, table, tdeletes): + """ + Bulk commit a List of TDeletes to the table. + + Throws a TIOError if any of the deletes fail. + + Always returns an empty list for backwards compatibility. + + Parameters: + - table: the table to delete from + - tdeletes: list of TDeletes to delete + + """ + pass + + def checkAndDelete(self, table, row, family, qualifier, value, tdelete): + """ + Atomically checks if a row/family/qualifier value matches the expected + value. If it does, it adds the delete. + + @return true if the new delete was executed, false otherwise + + Parameters: + - table: to check in and delete from + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - value: the expected value, if not provided the + check is for the non-existence of the + column in question + - tdelete: the TDelete to execute if the check succeeds + + """ + pass + + def increment(self, table, tincrement): + """ + Parameters: + - table: the table to increment the value on + - tincrement: the TIncrement to increment + + """ + pass + + def append(self, table, tappend): + """ + Parameters: + - table: the table to append the value on + - tappend: the TAppend to append + + """ + pass + + def openScanner(self, table, tscan): + """ + Get a Scanner for the provided TScan object. + + @return Scanner Id to be used with other scanner procedures + + Parameters: + - table: the table to get the Scanner for + - tscan: the scan object to get a Scanner for + + """ + pass + + def getScannerRows(self, scannerId, numRows): + """ + Grabs multiple rows from a Scanner. + + @return Between zero and numRows TResults + + Parameters: + - scannerId: the Id of the Scanner to return rows from. This is an Id returned from the openScanner function. + - numRows: number of rows to return + + """ + pass + + def closeScanner(self, scannerId): + """ + Closes the scanner. Should be called to free server side resources timely. + Typically close once the scanner is not needed anymore, i.e. after looping + over it to get all the required rows. + + Parameters: + - scannerId: the Id of the Scanner to close * + + """ + pass + + def mutateRow(self, table, trowMutations): + """ + mutateRow performs multiple mutations atomically on a single row. + + Parameters: + - table: table to apply the mutations + - trowMutations: mutations to apply + + """ + pass + + def getScannerResults(self, table, tscan, numRows): + """ + Get results for the provided TScan object. + This helper function opens a scanner, get the results and close the scanner. + + @return between zero and numRows TResults + + Parameters: + - table: the table to get the Scanner for + - tscan: the scan object to get a Scanner for + - numRows: number of rows to return + + """ + pass + + def getRegionLocation(self, table, row, reload): + """ + Given a table and a row get the location of the region that + would contain the given row key. + + reload = true means the cache will be cleared and the location + will be fetched from meta. + + Parameters: + - table + - row + - reload + + """ + pass + + def getAllRegionLocations(self, table): + """ + Get all of the region locations for a given table. + + + Parameters: + - table + + """ + pass + + def checkAndMutate(self, table, row, family, qualifier, compareOp, value, rowMutations): + """ + Atomically checks if a row/family/qualifier value matches the expected + value. If it does, it mutates the row. + + @return true if the row was mutated, false otherwise + + Parameters: + - table: to check in and delete from + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - compareOp: comparison to make on the value + - value: the expected value to be compared against, if not provided the + check is for the non-existence of the column in question + - rowMutations: row mutations to execute if the value matches + + """ + pass + + def getTableDescriptor(self, table): + """ + Get a table descriptor. + @return the TableDescriptor of the giving tablename + + + Parameters: + - table: the tablename of the table to get tableDescriptor + + """ + pass + + def getTableDescriptors(self, tables): + """ + Get table descriptors of tables. + @return the TableDescriptor of the giving tablename + + + Parameters: + - tables: the tablename list of the tables to get tableDescriptor + + """ + pass + + def tableExists(self, tableName): + """ + + @return true if table exists already, false if not + + + Parameters: + - tableName: the tablename of the tables to check + + """ + pass + + def getTableDescriptorsByPattern(self, regex, includeSysTables): + """ + Get table descriptors of tables that match the given pattern + @return the tableDescriptors of the matching table + + + Parameters: + - regex: The regular expression to match against + - includeSysTables: set to false if match only against userspace tables + + """ + pass + + def getTableDescriptorsByNamespace(self, name): + """ + Get table descriptors of tables in the given namespace + @return the tableDescriptors in the namespce + + + Parameters: + - name: The namesapce's name + + """ + pass + + def getTableNamesByPattern(self, regex, includeSysTables): + """ + Get table names of tables that match the given pattern + @return the table names of the matching table + + + Parameters: + - regex: The regular expression to match against + - includeSysTables: set to false if match only against userspace tables + + """ + pass + + def getTableNamesByNamespace(self, name): + """ + Get table names of tables in the given namespace + @return the table names of the matching table + + + Parameters: + - name: The namesapce's name + + """ + pass + + def createTable(self, desc, splitKeys): + """ + Creates a new table with an initial set of empty regions defined by the specified split keys. + The total number of regions created will be the number of split keys plus one. Synchronous + operation. + + + Parameters: + - desc: table descriptor for table + - splitKeys: rray of split keys for the initial regions of the table + + """ + pass + + def deleteTable(self, tableName): + """ + Deletes a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to delete + + """ + pass + + def truncateTable(self, tableName, preserveSplits): + """ + Truncate a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to truncate + - preserveSplits: whether to preserve previous splits + + """ + pass + + def enableTable(self, tableName): + """ + Enalbe a table + + + Parameters: + - tableName: the tablename to enable + + """ + pass + + def disableTable(self, tableName): + """ + Disable a table + + + Parameters: + - tableName: the tablename to disable + + """ + pass + + def isTableEnabled(self, tableName): + """ + + @return true if table is enabled, false if not + + + Parameters: + - tableName: the tablename to check + + """ + pass + + def isTableDisabled(self, tableName): + """ + + @return true if table is disabled, false if not + + + Parameters: + - tableName: the tablename to check + + """ + pass + + def isTableAvailable(self, tableName): + """ + + @return true if table is available, false if not + + + Parameters: + - tableName: the tablename to check + + """ + pass + + def isTableAvailableWithSplit(self, tableName, splitKeys): + """ + * Use this api to check if the table has been created with the specified number of splitkeys + * which was used while creating the given table. Note : If this api is used after a table's + * region gets splitted, the api may return false. + * + * @return true if table is available, false if not + * + * @deprecated Since 2.2.0. Because the same method in Table interface has been deprecated + * since 2.0.0, we will remove it in 3.0.0 release. + * Use {@link #isTableAvailable(TTableName tableName)} instead + * + + Parameters: + - tableName: the tablename to check + - splitKeys: keys to check if the table has been created with all split keys + + """ + pass + + def addColumnFamily(self, tableName, column): + """ + Add a column family to an existing table. Synchronous operation. + + + Parameters: + - tableName: the tablename to add column family to + - column: column family descriptor of column family to be added + + """ + pass + + def deleteColumnFamily(self, tableName, column): + """ + Delete a column family from a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to delete column family from + - column: name of column family to be deleted + + """ + pass + + def modifyColumnFamily(self, tableName, column): + """ + Modify an existing column family on a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to modify column family + - column: column family descriptor of column family to be modified + + """ + pass + + def modifyTable(self, desc): + """ + Modify an existing table + + + Parameters: + - desc: the descriptor of the table to modify + + """ + pass + + def createNamespace(self, namespaceDesc): + """ + Create a new namespace. Blocks until namespace has been successfully created or an exception is + thrown + + + Parameters: + - namespaceDesc: descriptor which describes the new namespace + + """ + pass + + def modifyNamespace(self, namespaceDesc): + """ + Modify an existing namespace. Blocks until namespace has been successfully modified or an + exception is thrown + + + Parameters: + - namespaceDesc: descriptor which describes the new namespace + + """ + pass + + def deleteNamespace(self, name): + """ + Delete an existing namespace. Only empty namespaces (no tables) can be removed. + Blocks until namespace has been successfully deleted or an + exception is thrown. + + + Parameters: + - name: namespace name + + """ + pass + + def getNamespaceDescriptor(self, name): + """ + Get a namespace descriptor by name. + @retrun the descriptor + + + Parameters: + - name: name of namespace descriptor + + """ + pass + + def listNamespaceDescriptors(self): + """ + @return all namespaces + + + """ + pass + + def listNamespaces(self): + """ + @return all namespace names + + + """ + pass + + def getThriftServerType(self): + """ + Get the type of this thrift server. + + @return the type of this thrift server + + """ + pass + + def getSlowLogResponses(self, serverNames, logQueryFilter): + """ + Retrieves online slow RPC logs from the provided list of + RegionServers + + @return online slowlog response list + @throws TIOError if a remote or network exception occurs + + Parameters: + - serverNames: @param serverNames Server names to get slowlog responses from + - logQueryFilter: @param logQueryFilter filter to be used if provided + + """ + pass + + def clearSlowLogResponses(self, serverNames): + """ + Clears online slow/large RPC logs from the provided list of + RegionServers + + @return List of booleans representing if online slowlog response buffer is cleaned + from each RegionServer + @throws TIOError if a remote or network exception occurs + + Parameters: + - serverNames: @param serverNames Set of Server names to clean slowlog responses from + + """ + pass + + def grant(self, info): + """ + Grant permissions in table or namespace level. + + Parameters: + - info + + """ + pass + + def revoke(self, info): + """ + Revoke permissions in table or namespace level. + + Parameters: + - info + + """ + pass + + def getUserPermission(self, domainName, scope): + """ + Get the user permissions in table or namespace level. + Return a string representing the permissions. + + Parameters: + - domainName + - scope + + """ + pass + + +class Client(Iface): + def __init__(self, iprot, oprot=None): + self._iprot = self._oprot = iprot + if oprot is not None: + self._oprot = oprot + self._seqid = 0 + + def exists(self, table, tget): + """ + Test for the existence of columns in the table, as specified in the TGet. + + @return true if the specified TGet matches one or more keys, false if not + + Parameters: + - table: the table to check on + - tget: the TGet to check for + + """ + self.send_exists(table, tget) + return self.recv_exists() + + def send_exists(self, table, tget): + self._oprot.writeMessageBegin('exists', TMessageType.CALL, self._seqid) + args = exists_args() + args.table = table + args.tget = tget + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_exists(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = exists_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "exists failed: unknown result") + + def existsAll(self, table, tgets): + """ + Test for the existence of columns in the table, as specified by the TGets. + + This will return an array of booleans. Each value will be true if the related Get matches + one or more keys, false if not. + + Parameters: + - table: the table to check on + - tgets: a list of TGets to check for + + """ + self.send_existsAll(table, tgets) + return self.recv_existsAll() + + def send_existsAll(self, table, tgets): + self._oprot.writeMessageBegin('existsAll', TMessageType.CALL, self._seqid) + args = existsAll_args() + args.table = table + args.tgets = tgets + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_existsAll(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = existsAll_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "existsAll failed: unknown result") + + def get(self, table, tget): + """ + Method for getting data from a row. + + If the row cannot be found an empty Result is returned. + This can be checked by the empty field of the TResult + + @return the result + + Parameters: + - table: the table to get from + - tget: the TGet to fetch + + """ + self.send_get(table, tget) + return self.recv_get() + + def send_get(self, table, tget): + self._oprot.writeMessageBegin('get', TMessageType.CALL, self._seqid) + args = get_args() + args.table = table + args.tget = tget + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "get failed: unknown result") + + def getMultiple(self, table, tgets): + """ + Method for getting multiple rows. + + If a row cannot be found there will be a null + value in the result list for that TGet at the + same position. + + So the Results are in the same order as the TGets. + + Parameters: + - table: the table to get from + - tgets: a list of TGets to fetch, the Result list + will have the Results at corresponding positions + or null if there was an error + + """ + self.send_getMultiple(table, tgets) + return self.recv_getMultiple() + + def send_getMultiple(self, table, tgets): + self._oprot.writeMessageBegin('getMultiple', TMessageType.CALL, self._seqid) + args = getMultiple_args() + args.table = table + args.tgets = tgets + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getMultiple(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getMultiple_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getMultiple failed: unknown result") + + def put(self, table, tput): + """ + Commit a TPut to a table. + + Parameters: + - table: the table to put data in + - tput: the TPut to put + + """ + self.send_put(table, tput) + self.recv_put() + + def send_put(self, table, tput): + self._oprot.writeMessageBegin('put', TMessageType.CALL, self._seqid) + args = put_args() + args.table = table + args.tput = tput + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_put(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = put_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def checkAndPut(self, table, row, family, qualifier, value, tput): + """ + Atomically checks if a row/family/qualifier value matches the expected + value. If it does, it adds the TPut. + + @return true if the new put was executed, false otherwise + + Parameters: + - table: to check in and put to + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - value: the expected value, if not provided the + check is for the non-existence of the + column in question + - tput: the TPut to put if the check succeeds + + """ + self.send_checkAndPut(table, row, family, qualifier, value, tput) + return self.recv_checkAndPut() + + def send_checkAndPut(self, table, row, family, qualifier, value, tput): + self._oprot.writeMessageBegin('checkAndPut', TMessageType.CALL, self._seqid) + args = checkAndPut_args() + args.table = table + args.row = row + args.family = family + args.qualifier = qualifier + args.value = value + args.tput = tput + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_checkAndPut(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = checkAndPut_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "checkAndPut failed: unknown result") + + def putMultiple(self, table, tputs): + """ + Commit a List of Puts to the table. + + Parameters: + - table: the table to put data in + - tputs: a list of TPuts to commit + + """ + self.send_putMultiple(table, tputs) + self.recv_putMultiple() + + def send_putMultiple(self, table, tputs): + self._oprot.writeMessageBegin('putMultiple', TMessageType.CALL, self._seqid) + args = putMultiple_args() + args.table = table + args.tputs = tputs + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_putMultiple(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = putMultiple_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def deleteSingle(self, table, tdelete): + """ + Deletes as specified by the TDelete. + + Note: "delete" is a reserved keyword and cannot be used in Thrift + thus the inconsistent naming scheme from the other functions. + + Parameters: + - table: the table to delete from + - tdelete: the TDelete to delete + + """ + self.send_deleteSingle(table, tdelete) + self.recv_deleteSingle() + + def send_deleteSingle(self, table, tdelete): + self._oprot.writeMessageBegin('deleteSingle', TMessageType.CALL, self._seqid) + args = deleteSingle_args() + args.table = table + args.tdelete = tdelete + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteSingle(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = deleteSingle_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def deleteMultiple(self, table, tdeletes): + """ + Bulk commit a List of TDeletes to the table. + + Throws a TIOError if any of the deletes fail. + + Always returns an empty list for backwards compatibility. + + Parameters: + - table: the table to delete from + - tdeletes: list of TDeletes to delete + + """ + self.send_deleteMultiple(table, tdeletes) + return self.recv_deleteMultiple() + + def send_deleteMultiple(self, table, tdeletes): + self._oprot.writeMessageBegin('deleteMultiple', TMessageType.CALL, self._seqid) + args = deleteMultiple_args() + args.table = table + args.tdeletes = tdeletes + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteMultiple(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = deleteMultiple_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "deleteMultiple failed: unknown result") + + def checkAndDelete(self, table, row, family, qualifier, value, tdelete): + """ + Atomically checks if a row/family/qualifier value matches the expected + value. If it does, it adds the delete. + + @return true if the new delete was executed, false otherwise + + Parameters: + - table: to check in and delete from + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - value: the expected value, if not provided the + check is for the non-existence of the + column in question + - tdelete: the TDelete to execute if the check succeeds + + """ + self.send_checkAndDelete(table, row, family, qualifier, value, tdelete) + return self.recv_checkAndDelete() + + def send_checkAndDelete(self, table, row, family, qualifier, value, tdelete): + self._oprot.writeMessageBegin('checkAndDelete', TMessageType.CALL, self._seqid) + args = checkAndDelete_args() + args.table = table + args.row = row + args.family = family + args.qualifier = qualifier + args.value = value + args.tdelete = tdelete + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_checkAndDelete(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = checkAndDelete_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "checkAndDelete failed: unknown result") + + def increment(self, table, tincrement): + """ + Parameters: + - table: the table to increment the value on + - tincrement: the TIncrement to increment + + """ + self.send_increment(table, tincrement) + return self.recv_increment() + + def send_increment(self, table, tincrement): + self._oprot.writeMessageBegin('increment', TMessageType.CALL, self._seqid) + args = increment_args() + args.table = table + args.tincrement = tincrement + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_increment(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = increment_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "increment failed: unknown result") + + def append(self, table, tappend): + """ + Parameters: + - table: the table to append the value on + - tappend: the TAppend to append + + """ + self.send_append(table, tappend) + return self.recv_append() + + def send_append(self, table, tappend): + self._oprot.writeMessageBegin('append', TMessageType.CALL, self._seqid) + args = append_args() + args.table = table + args.tappend = tappend + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_append(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = append_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "append failed: unknown result") + + def openScanner(self, table, tscan): + """ + Get a Scanner for the provided TScan object. + + @return Scanner Id to be used with other scanner procedures + + Parameters: + - table: the table to get the Scanner for + - tscan: the scan object to get a Scanner for + + """ + self.send_openScanner(table, tscan) + return self.recv_openScanner() + + def send_openScanner(self, table, tscan): + self._oprot.writeMessageBegin('openScanner', TMessageType.CALL, self._seqid) + args = openScanner_args() + args.table = table + args.tscan = tscan + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_openScanner(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = openScanner_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "openScanner failed: unknown result") + + def getScannerRows(self, scannerId, numRows): + """ + Grabs multiple rows from a Scanner. + + @return Between zero and numRows TResults + + Parameters: + - scannerId: the Id of the Scanner to return rows from. This is an Id returned from the openScanner function. + - numRows: number of rows to return + + """ + self.send_getScannerRows(scannerId, numRows) + return self.recv_getScannerRows() + + def send_getScannerRows(self, scannerId, numRows): + self._oprot.writeMessageBegin('getScannerRows', TMessageType.CALL, self._seqid) + args = getScannerRows_args() + args.scannerId = scannerId + args.numRows = numRows + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getScannerRows(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getScannerRows_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + if result.ia is not None: + raise result.ia + raise TApplicationException(TApplicationException.MISSING_RESULT, "getScannerRows failed: unknown result") + + def closeScanner(self, scannerId): + """ + Closes the scanner. Should be called to free server side resources timely. + Typically close once the scanner is not needed anymore, i.e. after looping + over it to get all the required rows. + + Parameters: + - scannerId: the Id of the Scanner to close * + + """ + self.send_closeScanner(scannerId) + self.recv_closeScanner() + + def send_closeScanner(self, scannerId): + self._oprot.writeMessageBegin('closeScanner', TMessageType.CALL, self._seqid) + args = closeScanner_args() + args.scannerId = scannerId + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_closeScanner(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = closeScanner_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + if result.ia is not None: + raise result.ia + return + + def mutateRow(self, table, trowMutations): + """ + mutateRow performs multiple mutations atomically on a single row. + + Parameters: + - table: table to apply the mutations + - trowMutations: mutations to apply + + """ + self.send_mutateRow(table, trowMutations) + self.recv_mutateRow() + + def send_mutateRow(self, table, trowMutations): + self._oprot.writeMessageBegin('mutateRow', TMessageType.CALL, self._seqid) + args = mutateRow_args() + args.table = table + args.trowMutations = trowMutations + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_mutateRow(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = mutateRow_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def getScannerResults(self, table, tscan, numRows): + """ + Get results for the provided TScan object. + This helper function opens a scanner, get the results and close the scanner. + + @return between zero and numRows TResults + + Parameters: + - table: the table to get the Scanner for + - tscan: the scan object to get a Scanner for + - numRows: number of rows to return + + """ + self.send_getScannerResults(table, tscan, numRows) + return self.recv_getScannerResults() + + def send_getScannerResults(self, table, tscan, numRows): + self._oprot.writeMessageBegin('getScannerResults', TMessageType.CALL, self._seqid) + args = getScannerResults_args() + args.table = table + args.tscan = tscan + args.numRows = numRows + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getScannerResults(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getScannerResults_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getScannerResults failed: unknown result") + + def getRegionLocation(self, table, row, reload): + """ + Given a table and a row get the location of the region that + would contain the given row key. + + reload = true means the cache will be cleared and the location + will be fetched from meta. + + Parameters: + - table + - row + - reload + + """ + self.send_getRegionLocation(table, row, reload) + return self.recv_getRegionLocation() + + def send_getRegionLocation(self, table, row, reload): + self._oprot.writeMessageBegin('getRegionLocation', TMessageType.CALL, self._seqid) + args = getRegionLocation_args() + args.table = table + args.row = row + args.reload = reload + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getRegionLocation(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getRegionLocation_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getRegionLocation failed: unknown result") + + def getAllRegionLocations(self, table): + """ + Get all of the region locations for a given table. + + + Parameters: + - table + + """ + self.send_getAllRegionLocations(table) + return self.recv_getAllRegionLocations() + + def send_getAllRegionLocations(self, table): + self._oprot.writeMessageBegin('getAllRegionLocations', TMessageType.CALL, self._seqid) + args = getAllRegionLocations_args() + args.table = table + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getAllRegionLocations(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getAllRegionLocations_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllRegionLocations failed: unknown result") + + def checkAndMutate(self, table, row, family, qualifier, compareOp, value, rowMutations): + """ + Atomically checks if a row/family/qualifier value matches the expected + value. If it does, it mutates the row. + + @return true if the row was mutated, false otherwise + + Parameters: + - table: to check in and delete from + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - compareOp: comparison to make on the value + - value: the expected value to be compared against, if not provided the + check is for the non-existence of the column in question + - rowMutations: row mutations to execute if the value matches + + """ + self.send_checkAndMutate(table, row, family, qualifier, compareOp, value, rowMutations) + return self.recv_checkAndMutate() + + def send_checkAndMutate(self, table, row, family, qualifier, compareOp, value, rowMutations): + self._oprot.writeMessageBegin('checkAndMutate', TMessageType.CALL, self._seqid) + args = checkAndMutate_args() + args.table = table + args.row = row + args.family = family + args.qualifier = qualifier + args.compareOp = compareOp + args.value = value + args.rowMutations = rowMutations + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_checkAndMutate(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = checkAndMutate_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "checkAndMutate failed: unknown result") + + def getTableDescriptor(self, table): + """ + Get a table descriptor. + @return the TableDescriptor of the giving tablename + + + Parameters: + - table: the tablename of the table to get tableDescriptor + + """ + self.send_getTableDescriptor(table) + return self.recv_getTableDescriptor() + + def send_getTableDescriptor(self, table): + self._oprot.writeMessageBegin('getTableDescriptor', TMessageType.CALL, self._seqid) + args = getTableDescriptor_args() + args.table = table + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getTableDescriptor(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getTableDescriptor_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getTableDescriptor failed: unknown result") + + def getTableDescriptors(self, tables): + """ + Get table descriptors of tables. + @return the TableDescriptor of the giving tablename + + + Parameters: + - tables: the tablename list of the tables to get tableDescriptor + + """ + self.send_getTableDescriptors(tables) + return self.recv_getTableDescriptors() + + def send_getTableDescriptors(self, tables): + self._oprot.writeMessageBegin('getTableDescriptors', TMessageType.CALL, self._seqid) + args = getTableDescriptors_args() + args.tables = tables + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getTableDescriptors(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getTableDescriptors_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getTableDescriptors failed: unknown result") + + def tableExists(self, tableName): + """ + + @return true if table exists already, false if not + + + Parameters: + - tableName: the tablename of the tables to check + + """ + self.send_tableExists(tableName) + return self.recv_tableExists() + + def send_tableExists(self, tableName): + self._oprot.writeMessageBegin('tableExists', TMessageType.CALL, self._seqid) + args = tableExists_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_tableExists(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = tableExists_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "tableExists failed: unknown result") + + def getTableDescriptorsByPattern(self, regex, includeSysTables): + """ + Get table descriptors of tables that match the given pattern + @return the tableDescriptors of the matching table + + + Parameters: + - regex: The regular expression to match against + - includeSysTables: set to false if match only against userspace tables + + """ + self.send_getTableDescriptorsByPattern(regex, includeSysTables) + return self.recv_getTableDescriptorsByPattern() + + def send_getTableDescriptorsByPattern(self, regex, includeSysTables): + self._oprot.writeMessageBegin('getTableDescriptorsByPattern', TMessageType.CALL, self._seqid) + args = getTableDescriptorsByPattern_args() + args.regex = regex + args.includeSysTables = includeSysTables + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getTableDescriptorsByPattern(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getTableDescriptorsByPattern_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getTableDescriptorsByPattern failed: unknown result") + + def getTableDescriptorsByNamespace(self, name): + """ + Get table descriptors of tables in the given namespace + @return the tableDescriptors in the namespce + + + Parameters: + - name: The namesapce's name + + """ + self.send_getTableDescriptorsByNamespace(name) + return self.recv_getTableDescriptorsByNamespace() + + def send_getTableDescriptorsByNamespace(self, name): + self._oprot.writeMessageBegin('getTableDescriptorsByNamespace', TMessageType.CALL, self._seqid) + args = getTableDescriptorsByNamespace_args() + args.name = name + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getTableDescriptorsByNamespace(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getTableDescriptorsByNamespace_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getTableDescriptorsByNamespace failed: unknown result") + + def getTableNamesByPattern(self, regex, includeSysTables): + """ + Get table names of tables that match the given pattern + @return the table names of the matching table + + + Parameters: + - regex: The regular expression to match against + - includeSysTables: set to false if match only against userspace tables + + """ + self.send_getTableNamesByPattern(regex, includeSysTables) + return self.recv_getTableNamesByPattern() + + def send_getTableNamesByPattern(self, regex, includeSysTables): + self._oprot.writeMessageBegin('getTableNamesByPattern', TMessageType.CALL, self._seqid) + args = getTableNamesByPattern_args() + args.regex = regex + args.includeSysTables = includeSysTables + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getTableNamesByPattern(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getTableNamesByPattern_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getTableNamesByPattern failed: unknown result") + + def getTableNamesByNamespace(self, name): + """ + Get table names of tables in the given namespace + @return the table names of the matching table + + + Parameters: + - name: The namesapce's name + + """ + self.send_getTableNamesByNamespace(name) + return self.recv_getTableNamesByNamespace() + + def send_getTableNamesByNamespace(self, name): + self._oprot.writeMessageBegin('getTableNamesByNamespace', TMessageType.CALL, self._seqid) + args = getTableNamesByNamespace_args() + args.name = name + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getTableNamesByNamespace(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getTableNamesByNamespace_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getTableNamesByNamespace failed: unknown result") + + def createTable(self, desc, splitKeys): + """ + Creates a new table with an initial set of empty regions defined by the specified split keys. + The total number of regions created will be the number of split keys plus one. Synchronous + operation. + + + Parameters: + - desc: table descriptor for table + - splitKeys: rray of split keys for the initial regions of the table + + """ + self.send_createTable(desc, splitKeys) + self.recv_createTable() + + def send_createTable(self, desc, splitKeys): + self._oprot.writeMessageBegin('createTable', TMessageType.CALL, self._seqid) + args = createTable_args() + args.desc = desc + args.splitKeys = splitKeys + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_createTable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = createTable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def deleteTable(self, tableName): + """ + Deletes a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to delete + + """ + self.send_deleteTable(tableName) + self.recv_deleteTable() + + def send_deleteTable(self, tableName): + self._oprot.writeMessageBegin('deleteTable', TMessageType.CALL, self._seqid) + args = deleteTable_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteTable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = deleteTable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def truncateTable(self, tableName, preserveSplits): + """ + Truncate a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to truncate + - preserveSplits: whether to preserve previous splits + + """ + self.send_truncateTable(tableName, preserveSplits) + self.recv_truncateTable() + + def send_truncateTable(self, tableName, preserveSplits): + self._oprot.writeMessageBegin('truncateTable', TMessageType.CALL, self._seqid) + args = truncateTable_args() + args.tableName = tableName + args.preserveSplits = preserveSplits + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_truncateTable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = truncateTable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def enableTable(self, tableName): + """ + Enalbe a table + + + Parameters: + - tableName: the tablename to enable + + """ + self.send_enableTable(tableName) + self.recv_enableTable() + + def send_enableTable(self, tableName): + self._oprot.writeMessageBegin('enableTable', TMessageType.CALL, self._seqid) + args = enableTable_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_enableTable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = enableTable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def disableTable(self, tableName): + """ + Disable a table + + + Parameters: + - tableName: the tablename to disable + + """ + self.send_disableTable(tableName) + self.recv_disableTable() + + def send_disableTable(self, tableName): + self._oprot.writeMessageBegin('disableTable', TMessageType.CALL, self._seqid) + args = disableTable_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_disableTable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = disableTable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def isTableEnabled(self, tableName): + """ + + @return true if table is enabled, false if not + + + Parameters: + - tableName: the tablename to check + + """ + self.send_isTableEnabled(tableName) + return self.recv_isTableEnabled() + + def send_isTableEnabled(self, tableName): + self._oprot.writeMessageBegin('isTableEnabled', TMessageType.CALL, self._seqid) + args = isTableEnabled_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_isTableEnabled(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = isTableEnabled_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "isTableEnabled failed: unknown result") + + def isTableDisabled(self, tableName): + """ + + @return true if table is disabled, false if not + + + Parameters: + - tableName: the tablename to check + + """ + self.send_isTableDisabled(tableName) + return self.recv_isTableDisabled() + + def send_isTableDisabled(self, tableName): + self._oprot.writeMessageBegin('isTableDisabled', TMessageType.CALL, self._seqid) + args = isTableDisabled_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_isTableDisabled(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = isTableDisabled_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "isTableDisabled failed: unknown result") + + def isTableAvailable(self, tableName): + """ + + @return true if table is available, false if not + + + Parameters: + - tableName: the tablename to check + + """ + self.send_isTableAvailable(tableName) + return self.recv_isTableAvailable() + + def send_isTableAvailable(self, tableName): + self._oprot.writeMessageBegin('isTableAvailable', TMessageType.CALL, self._seqid) + args = isTableAvailable_args() + args.tableName = tableName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_isTableAvailable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = isTableAvailable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "isTableAvailable failed: unknown result") + + def isTableAvailableWithSplit(self, tableName, splitKeys): + """ + * Use this api to check if the table has been created with the specified number of splitkeys + * which was used while creating the given table. Note : If this api is used after a table's + * region gets splitted, the api may return false. + * + * @return true if table is available, false if not + * + * @deprecated Since 2.2.0. Because the same method in Table interface has been deprecated + * since 2.0.0, we will remove it in 3.0.0 release. + * Use {@link #isTableAvailable(TTableName tableName)} instead + * + + Parameters: + - tableName: the tablename to check + - splitKeys: keys to check if the table has been created with all split keys + + """ + self.send_isTableAvailableWithSplit(tableName, splitKeys) + return self.recv_isTableAvailableWithSplit() + + def send_isTableAvailableWithSplit(self, tableName, splitKeys): + self._oprot.writeMessageBegin('isTableAvailableWithSplit', TMessageType.CALL, self._seqid) + args = isTableAvailableWithSplit_args() + args.tableName = tableName + args.splitKeys = splitKeys + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_isTableAvailableWithSplit(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = isTableAvailableWithSplit_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "isTableAvailableWithSplit failed: unknown result") + + def addColumnFamily(self, tableName, column): + """ + Add a column family to an existing table. Synchronous operation. + + + Parameters: + - tableName: the tablename to add column family to + - column: column family descriptor of column family to be added + + """ + self.send_addColumnFamily(tableName, column) + self.recv_addColumnFamily() + + def send_addColumnFamily(self, tableName, column): + self._oprot.writeMessageBegin('addColumnFamily', TMessageType.CALL, self._seqid) + args = addColumnFamily_args() + args.tableName = tableName + args.column = column + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_addColumnFamily(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = addColumnFamily_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def deleteColumnFamily(self, tableName, column): + """ + Delete a column family from a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to delete column family from + - column: name of column family to be deleted + + """ + self.send_deleteColumnFamily(tableName, column) + self.recv_deleteColumnFamily() + + def send_deleteColumnFamily(self, tableName, column): + self._oprot.writeMessageBegin('deleteColumnFamily', TMessageType.CALL, self._seqid) + args = deleteColumnFamily_args() + args.tableName = tableName + args.column = column + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteColumnFamily(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = deleteColumnFamily_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def modifyColumnFamily(self, tableName, column): + """ + Modify an existing column family on a table. Synchronous operation. + + + Parameters: + - tableName: the tablename to modify column family + - column: column family descriptor of column family to be modified + + """ + self.send_modifyColumnFamily(tableName, column) + self.recv_modifyColumnFamily() + + def send_modifyColumnFamily(self, tableName, column): + self._oprot.writeMessageBegin('modifyColumnFamily', TMessageType.CALL, self._seqid) + args = modifyColumnFamily_args() + args.tableName = tableName + args.column = column + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_modifyColumnFamily(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = modifyColumnFamily_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def modifyTable(self, desc): + """ + Modify an existing table + + + Parameters: + - desc: the descriptor of the table to modify + + """ + self.send_modifyTable(desc) + self.recv_modifyTable() + + def send_modifyTable(self, desc): + self._oprot.writeMessageBegin('modifyTable', TMessageType.CALL, self._seqid) + args = modifyTable_args() + args.desc = desc + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_modifyTable(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = modifyTable_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def createNamespace(self, namespaceDesc): + """ + Create a new namespace. Blocks until namespace has been successfully created or an exception is + thrown + + + Parameters: + - namespaceDesc: descriptor which describes the new namespace + + """ + self.send_createNamespace(namespaceDesc) + self.recv_createNamespace() + + def send_createNamespace(self, namespaceDesc): + self._oprot.writeMessageBegin('createNamespace', TMessageType.CALL, self._seqid) + args = createNamespace_args() + args.namespaceDesc = namespaceDesc + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_createNamespace(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = createNamespace_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def modifyNamespace(self, namespaceDesc): + """ + Modify an existing namespace. Blocks until namespace has been successfully modified or an + exception is thrown + + + Parameters: + - namespaceDesc: descriptor which describes the new namespace + + """ + self.send_modifyNamespace(namespaceDesc) + self.recv_modifyNamespace() + + def send_modifyNamespace(self, namespaceDesc): + self._oprot.writeMessageBegin('modifyNamespace', TMessageType.CALL, self._seqid) + args = modifyNamespace_args() + args.namespaceDesc = namespaceDesc + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_modifyNamespace(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = modifyNamespace_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def deleteNamespace(self, name): + """ + Delete an existing namespace. Only empty namespaces (no tables) can be removed. + Blocks until namespace has been successfully deleted or an + exception is thrown. + + + Parameters: + - name: namespace name + + """ + self.send_deleteNamespace(name) + self.recv_deleteNamespace() + + def send_deleteNamespace(self, name): + self._oprot.writeMessageBegin('deleteNamespace', TMessageType.CALL, self._seqid) + args = deleteNamespace_args() + args.name = name + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteNamespace(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = deleteNamespace_result() + result.read(iprot) + iprot.readMessageEnd() + if result.io is not None: + raise result.io + return + + def getNamespaceDescriptor(self, name): + """ + Get a namespace descriptor by name. + @retrun the descriptor + + + Parameters: + - name: name of namespace descriptor + + """ + self.send_getNamespaceDescriptor(name) + return self.recv_getNamespaceDescriptor() + + def send_getNamespaceDescriptor(self, name): + self._oprot.writeMessageBegin('getNamespaceDescriptor', TMessageType.CALL, self._seqid) + args = getNamespaceDescriptor_args() + args.name = name + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getNamespaceDescriptor(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getNamespaceDescriptor_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getNamespaceDescriptor failed: unknown result") + + def listNamespaceDescriptors(self): + """ + @return all namespaces + + + """ + self.send_listNamespaceDescriptors() + return self.recv_listNamespaceDescriptors() + + def send_listNamespaceDescriptors(self): + self._oprot.writeMessageBegin('listNamespaceDescriptors', TMessageType.CALL, self._seqid) + args = listNamespaceDescriptors_args() + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_listNamespaceDescriptors(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = listNamespaceDescriptors_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "listNamespaceDescriptors failed: unknown result") + + def listNamespaces(self): + """ + @return all namespace names + + + """ + self.send_listNamespaces() + return self.recv_listNamespaces() + + def send_listNamespaces(self): + self._oprot.writeMessageBegin('listNamespaces', TMessageType.CALL, self._seqid) + args = listNamespaces_args() + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_listNamespaces(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = listNamespaces_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "listNamespaces failed: unknown result") + + def getThriftServerType(self): + """ + Get the type of this thrift server. + + @return the type of this thrift server + + """ + self.send_getThriftServerType() + return self.recv_getThriftServerType() + + def send_getThriftServerType(self): + self._oprot.writeMessageBegin('getThriftServerType', TMessageType.CALL, self._seqid) + args = getThriftServerType_args() + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getThriftServerType(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getThriftServerType_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "getThriftServerType failed: unknown result") + + def getSlowLogResponses(self, serverNames, logQueryFilter): + """ + Retrieves online slow RPC logs from the provided list of + RegionServers + + @return online slowlog response list + @throws TIOError if a remote or network exception occurs + + Parameters: + - serverNames: @param serverNames Server names to get slowlog responses from + - logQueryFilter: @param logQueryFilter filter to be used if provided + + """ + self.send_getSlowLogResponses(serverNames, logQueryFilter) + return self.recv_getSlowLogResponses() + + def send_getSlowLogResponses(self, serverNames, logQueryFilter): + self._oprot.writeMessageBegin('getSlowLogResponses', TMessageType.CALL, self._seqid) + args = getSlowLogResponses_args() + args.serverNames = serverNames + args.logQueryFilter = logQueryFilter + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getSlowLogResponses(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getSlowLogResponses_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "getSlowLogResponses failed: unknown result") + + def clearSlowLogResponses(self, serverNames): + """ + Clears online slow/large RPC logs from the provided list of + RegionServers + + @return List of booleans representing if online slowlog response buffer is cleaned + from each RegionServer + @throws TIOError if a remote or network exception occurs + + Parameters: + - serverNames: @param serverNames Set of Server names to clean slowlog responses from + + """ + self.send_clearSlowLogResponses(serverNames) + return self.recv_clearSlowLogResponses() + + def send_clearSlowLogResponses(self, serverNames): + self._oprot.writeMessageBegin('clearSlowLogResponses', TMessageType.CALL, self._seqid) + args = clearSlowLogResponses_args() + args.serverNames = serverNames + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_clearSlowLogResponses(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = clearSlowLogResponses_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "clearSlowLogResponses failed: unknown result") + + def grant(self, info): + """ + Grant permissions in table or namespace level. + + Parameters: + - info + + """ + self.send_grant(info) + return self.recv_grant() + + def send_grant(self, info): + self._oprot.writeMessageBegin('grant', TMessageType.CALL, self._seqid) + args = grant_args() + args.info = info + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_grant(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = grant_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "grant failed: unknown result") + + def revoke(self, info): + """ + Revoke permissions in table or namespace level. + + Parameters: + - info + + """ + self.send_revoke(info) + return self.recv_revoke() + + def send_revoke(self, info): + self._oprot.writeMessageBegin('revoke', TMessageType.CALL, self._seqid) + args = revoke_args() + args.info = info + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_revoke(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = revoke_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.io is not None: + raise result.io + raise TApplicationException(TApplicationException.MISSING_RESULT, "revoke failed: unknown result") + + def getUserPermission(self, domainName, scope): + """ + Get the user permissions in table or namespace level. + Return a string representing the permissions. + + Parameters: + - domainName + - scope + + """ + self.send_getUserPermission(domainName, scope) + return self.recv_getUserPermission() + + def send_getUserPermission(self, domainName, scope): + self._oprot.writeMessageBegin('getUserPermission', TMessageType.CALL, self._seqid) + args = getUserPermission_args() + args.domainName = domainName + args.scope = scope + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getUserPermission(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getUserPermission_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "getUserPermission failed: unknown result") + + +class Processor(Iface, TProcessor): + def __init__(self, handler): + self._handler = handler + self._processMap = {} + self._processMap["exists"] = Processor.process_exists + self._processMap["existsAll"] = Processor.process_existsAll + self._processMap["get"] = Processor.process_get + self._processMap["getMultiple"] = Processor.process_getMultiple + self._processMap["put"] = Processor.process_put + self._processMap["checkAndPut"] = Processor.process_checkAndPut + self._processMap["putMultiple"] = Processor.process_putMultiple + self._processMap["deleteSingle"] = Processor.process_deleteSingle + self._processMap["deleteMultiple"] = Processor.process_deleteMultiple + self._processMap["checkAndDelete"] = Processor.process_checkAndDelete + self._processMap["increment"] = Processor.process_increment + self._processMap["append"] = Processor.process_append + self._processMap["openScanner"] = Processor.process_openScanner + self._processMap["getScannerRows"] = Processor.process_getScannerRows + self._processMap["closeScanner"] = Processor.process_closeScanner + self._processMap["mutateRow"] = Processor.process_mutateRow + self._processMap["getScannerResults"] = Processor.process_getScannerResults + self._processMap["getRegionLocation"] = Processor.process_getRegionLocation + self._processMap["getAllRegionLocations"] = Processor.process_getAllRegionLocations + self._processMap["checkAndMutate"] = Processor.process_checkAndMutate + self._processMap["getTableDescriptor"] = Processor.process_getTableDescriptor + self._processMap["getTableDescriptors"] = Processor.process_getTableDescriptors + self._processMap["tableExists"] = Processor.process_tableExists + self._processMap["getTableDescriptorsByPattern"] = Processor.process_getTableDescriptorsByPattern + self._processMap["getTableDescriptorsByNamespace"] = Processor.process_getTableDescriptorsByNamespace + self._processMap["getTableNamesByPattern"] = Processor.process_getTableNamesByPattern + self._processMap["getTableNamesByNamespace"] = Processor.process_getTableNamesByNamespace + self._processMap["createTable"] = Processor.process_createTable + self._processMap["deleteTable"] = Processor.process_deleteTable + self._processMap["truncateTable"] = Processor.process_truncateTable + self._processMap["enableTable"] = Processor.process_enableTable + self._processMap["disableTable"] = Processor.process_disableTable + self._processMap["isTableEnabled"] = Processor.process_isTableEnabled + self._processMap["isTableDisabled"] = Processor.process_isTableDisabled + self._processMap["isTableAvailable"] = Processor.process_isTableAvailable + self._processMap["isTableAvailableWithSplit"] = Processor.process_isTableAvailableWithSplit + self._processMap["addColumnFamily"] = Processor.process_addColumnFamily + self._processMap["deleteColumnFamily"] = Processor.process_deleteColumnFamily + self._processMap["modifyColumnFamily"] = Processor.process_modifyColumnFamily + self._processMap["modifyTable"] = Processor.process_modifyTable + self._processMap["createNamespace"] = Processor.process_createNamespace + self._processMap["modifyNamespace"] = Processor.process_modifyNamespace + self._processMap["deleteNamespace"] = Processor.process_deleteNamespace + self._processMap["getNamespaceDescriptor"] = Processor.process_getNamespaceDescriptor + self._processMap["listNamespaceDescriptors"] = Processor.process_listNamespaceDescriptors + self._processMap["listNamespaces"] = Processor.process_listNamespaces + self._processMap["getThriftServerType"] = Processor.process_getThriftServerType + self._processMap["getSlowLogResponses"] = Processor.process_getSlowLogResponses + self._processMap["clearSlowLogResponses"] = Processor.process_clearSlowLogResponses + self._processMap["grant"] = Processor.process_grant + self._processMap["revoke"] = Processor.process_revoke + self._processMap["getUserPermission"] = Processor.process_getUserPermission + self._on_message_begin = None + + def on_message_begin(self, func): + self._on_message_begin = func + + def process(self, iprot, oprot): + (name, type, seqid) = iprot.readMessageBegin() + if self._on_message_begin: + self._on_message_begin(name, type, seqid) + if name not in self._processMap: + iprot.skip(TType.STRUCT) + iprot.readMessageEnd() + x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) + oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) + x.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + return + else: + self._processMap[name](self, seqid, iprot, oprot) + return True + + def process_exists(self, seqid, iprot, oprot): + args = exists_args() + args.read(iprot) + iprot.readMessageEnd() + result = exists_result() + try: + result.success = self._handler.exists(args.table, args.tget) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("exists", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_existsAll(self, seqid, iprot, oprot): + args = existsAll_args() + args.read(iprot) + iprot.readMessageEnd() + result = existsAll_result() + try: + result.success = self._handler.existsAll(args.table, args.tgets) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("existsAll", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_get(self, seqid, iprot, oprot): + args = get_args() + args.read(iprot) + iprot.readMessageEnd() + result = get_result() + try: + result.success = self._handler.get(args.table, args.tget) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getMultiple(self, seqid, iprot, oprot): + args = getMultiple_args() + args.read(iprot) + iprot.readMessageEnd() + result = getMultiple_result() + try: + result.success = self._handler.getMultiple(args.table, args.tgets) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getMultiple", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_put(self, seqid, iprot, oprot): + args = put_args() + args.read(iprot) + iprot.readMessageEnd() + result = put_result() + try: + self._handler.put(args.table, args.tput) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("put", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_checkAndPut(self, seqid, iprot, oprot): + args = checkAndPut_args() + args.read(iprot) + iprot.readMessageEnd() + result = checkAndPut_result() + try: + result.success = self._handler.checkAndPut(args.table, args.row, args.family, args.qualifier, args.value, args.tput) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("checkAndPut", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_putMultiple(self, seqid, iprot, oprot): + args = putMultiple_args() + args.read(iprot) + iprot.readMessageEnd() + result = putMultiple_result() + try: + self._handler.putMultiple(args.table, args.tputs) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("putMultiple", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteSingle(self, seqid, iprot, oprot): + args = deleteSingle_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteSingle_result() + try: + self._handler.deleteSingle(args.table, args.tdelete) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("deleteSingle", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteMultiple(self, seqid, iprot, oprot): + args = deleteMultiple_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteMultiple_result() + try: + result.success = self._handler.deleteMultiple(args.table, args.tdeletes) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("deleteMultiple", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_checkAndDelete(self, seqid, iprot, oprot): + args = checkAndDelete_args() + args.read(iprot) + iprot.readMessageEnd() + result = checkAndDelete_result() + try: + result.success = self._handler.checkAndDelete(args.table, args.row, args.family, args.qualifier, args.value, args.tdelete) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("checkAndDelete", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_increment(self, seqid, iprot, oprot): + args = increment_args() + args.read(iprot) + iprot.readMessageEnd() + result = increment_result() + try: + result.success = self._handler.increment(args.table, args.tincrement) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("increment", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_append(self, seqid, iprot, oprot): + args = append_args() + args.read(iprot) + iprot.readMessageEnd() + result = append_result() + try: + result.success = self._handler.append(args.table, args.tappend) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("append", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_openScanner(self, seqid, iprot, oprot): + args = openScanner_args() + args.read(iprot) + iprot.readMessageEnd() + result = openScanner_result() + try: + result.success = self._handler.openScanner(args.table, args.tscan) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("openScanner", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getScannerRows(self, seqid, iprot, oprot): + args = getScannerRows_args() + args.read(iprot) + iprot.readMessageEnd() + result = getScannerRows_result() + try: + result.success = self._handler.getScannerRows(args.scannerId, args.numRows) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TIllegalArgument as ia: + msg_type = TMessageType.REPLY + result.ia = ia + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getScannerRows", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_closeScanner(self, seqid, iprot, oprot): + args = closeScanner_args() + args.read(iprot) + iprot.readMessageEnd() + result = closeScanner_result() + try: + self._handler.closeScanner(args.scannerId) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TIllegalArgument as ia: + msg_type = TMessageType.REPLY + result.ia = ia + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("closeScanner", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_mutateRow(self, seqid, iprot, oprot): + args = mutateRow_args() + args.read(iprot) + iprot.readMessageEnd() + result = mutateRow_result() + try: + self._handler.mutateRow(args.table, args.trowMutations) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("mutateRow", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getScannerResults(self, seqid, iprot, oprot): + args = getScannerResults_args() + args.read(iprot) + iprot.readMessageEnd() + result = getScannerResults_result() + try: + result.success = self._handler.getScannerResults(args.table, args.tscan, args.numRows) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getScannerResults", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getRegionLocation(self, seqid, iprot, oprot): + args = getRegionLocation_args() + args.read(iprot) + iprot.readMessageEnd() + result = getRegionLocation_result() + try: + result.success = self._handler.getRegionLocation(args.table, args.row, args.reload) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getRegionLocation", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getAllRegionLocations(self, seqid, iprot, oprot): + args = getAllRegionLocations_args() + args.read(iprot) + iprot.readMessageEnd() + result = getAllRegionLocations_result() + try: + result.success = self._handler.getAllRegionLocations(args.table) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getAllRegionLocations", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_checkAndMutate(self, seqid, iprot, oprot): + args = checkAndMutate_args() + args.read(iprot) + iprot.readMessageEnd() + result = checkAndMutate_result() + try: + result.success = self._handler.checkAndMutate(args.table, args.row, args.family, args.qualifier, args.compareOp, args.value, args.rowMutations) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("checkAndMutate", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getTableDescriptor(self, seqid, iprot, oprot): + args = getTableDescriptor_args() + args.read(iprot) + iprot.readMessageEnd() + result = getTableDescriptor_result() + try: + result.success = self._handler.getTableDescriptor(args.table) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getTableDescriptor", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getTableDescriptors(self, seqid, iprot, oprot): + args = getTableDescriptors_args() + args.read(iprot) + iprot.readMessageEnd() + result = getTableDescriptors_result() + try: + result.success = self._handler.getTableDescriptors(args.tables) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getTableDescriptors", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_tableExists(self, seqid, iprot, oprot): + args = tableExists_args() + args.read(iprot) + iprot.readMessageEnd() + result = tableExists_result() + try: + result.success = self._handler.tableExists(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("tableExists", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getTableDescriptorsByPattern(self, seqid, iprot, oprot): + args = getTableDescriptorsByPattern_args() + args.read(iprot) + iprot.readMessageEnd() + result = getTableDescriptorsByPattern_result() + try: + result.success = self._handler.getTableDescriptorsByPattern(args.regex, args.includeSysTables) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getTableDescriptorsByPattern", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getTableDescriptorsByNamespace(self, seqid, iprot, oprot): + args = getTableDescriptorsByNamespace_args() + args.read(iprot) + iprot.readMessageEnd() + result = getTableDescriptorsByNamespace_result() + try: + result.success = self._handler.getTableDescriptorsByNamespace(args.name) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getTableDescriptorsByNamespace", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getTableNamesByPattern(self, seqid, iprot, oprot): + args = getTableNamesByPattern_args() + args.read(iprot) + iprot.readMessageEnd() + result = getTableNamesByPattern_result() + try: + result.success = self._handler.getTableNamesByPattern(args.regex, args.includeSysTables) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getTableNamesByPattern", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getTableNamesByNamespace(self, seqid, iprot, oprot): + args = getTableNamesByNamespace_args() + args.read(iprot) + iprot.readMessageEnd() + result = getTableNamesByNamespace_result() + try: + result.success = self._handler.getTableNamesByNamespace(args.name) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getTableNamesByNamespace", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_createTable(self, seqid, iprot, oprot): + args = createTable_args() + args.read(iprot) + iprot.readMessageEnd() + result = createTable_result() + try: + self._handler.createTable(args.desc, args.splitKeys) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("createTable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteTable(self, seqid, iprot, oprot): + args = deleteTable_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteTable_result() + try: + self._handler.deleteTable(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("deleteTable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_truncateTable(self, seqid, iprot, oprot): + args = truncateTable_args() + args.read(iprot) + iprot.readMessageEnd() + result = truncateTable_result() + try: + self._handler.truncateTable(args.tableName, args.preserveSplits) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("truncateTable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_enableTable(self, seqid, iprot, oprot): + args = enableTable_args() + args.read(iprot) + iprot.readMessageEnd() + result = enableTable_result() + try: + self._handler.enableTable(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("enableTable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_disableTable(self, seqid, iprot, oprot): + args = disableTable_args() + args.read(iprot) + iprot.readMessageEnd() + result = disableTable_result() + try: + self._handler.disableTable(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("disableTable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_isTableEnabled(self, seqid, iprot, oprot): + args = isTableEnabled_args() + args.read(iprot) + iprot.readMessageEnd() + result = isTableEnabled_result() + try: + result.success = self._handler.isTableEnabled(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("isTableEnabled", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_isTableDisabled(self, seqid, iprot, oprot): + args = isTableDisabled_args() + args.read(iprot) + iprot.readMessageEnd() + result = isTableDisabled_result() + try: + result.success = self._handler.isTableDisabled(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("isTableDisabled", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_isTableAvailable(self, seqid, iprot, oprot): + args = isTableAvailable_args() + args.read(iprot) + iprot.readMessageEnd() + result = isTableAvailable_result() + try: + result.success = self._handler.isTableAvailable(args.tableName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("isTableAvailable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_isTableAvailableWithSplit(self, seqid, iprot, oprot): + args = isTableAvailableWithSplit_args() + args.read(iprot) + iprot.readMessageEnd() + result = isTableAvailableWithSplit_result() + try: + result.success = self._handler.isTableAvailableWithSplit(args.tableName, args.splitKeys) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("isTableAvailableWithSplit", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_addColumnFamily(self, seqid, iprot, oprot): + args = addColumnFamily_args() + args.read(iprot) + iprot.readMessageEnd() + result = addColumnFamily_result() + try: + self._handler.addColumnFamily(args.tableName, args.column) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("addColumnFamily", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteColumnFamily(self, seqid, iprot, oprot): + args = deleteColumnFamily_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteColumnFamily_result() + try: + self._handler.deleteColumnFamily(args.tableName, args.column) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("deleteColumnFamily", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_modifyColumnFamily(self, seqid, iprot, oprot): + args = modifyColumnFamily_args() + args.read(iprot) + iprot.readMessageEnd() + result = modifyColumnFamily_result() + try: + self._handler.modifyColumnFamily(args.tableName, args.column) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("modifyColumnFamily", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_modifyTable(self, seqid, iprot, oprot): + args = modifyTable_args() + args.read(iprot) + iprot.readMessageEnd() + result = modifyTable_result() + try: + self._handler.modifyTable(args.desc) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("modifyTable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_createNamespace(self, seqid, iprot, oprot): + args = createNamespace_args() + args.read(iprot) + iprot.readMessageEnd() + result = createNamespace_result() + try: + self._handler.createNamespace(args.namespaceDesc) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("createNamespace", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_modifyNamespace(self, seqid, iprot, oprot): + args = modifyNamespace_args() + args.read(iprot) + iprot.readMessageEnd() + result = modifyNamespace_result() + try: + self._handler.modifyNamespace(args.namespaceDesc) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("modifyNamespace", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteNamespace(self, seqid, iprot, oprot): + args = deleteNamespace_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteNamespace_result() + try: + self._handler.deleteNamespace(args.name) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("deleteNamespace", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getNamespaceDescriptor(self, seqid, iprot, oprot): + args = getNamespaceDescriptor_args() + args.read(iprot) + iprot.readMessageEnd() + result = getNamespaceDescriptor_result() + try: + result.success = self._handler.getNamespaceDescriptor(args.name) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getNamespaceDescriptor", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_listNamespaceDescriptors(self, seqid, iprot, oprot): + args = listNamespaceDescriptors_args() + args.read(iprot) + iprot.readMessageEnd() + result = listNamespaceDescriptors_result() + try: + result.success = self._handler.listNamespaceDescriptors() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("listNamespaceDescriptors", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_listNamespaces(self, seqid, iprot, oprot): + args = listNamespaces_args() + args.read(iprot) + iprot.readMessageEnd() + result = listNamespaces_result() + try: + result.success = self._handler.listNamespaces() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("listNamespaces", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getThriftServerType(self, seqid, iprot, oprot): + args = getThriftServerType_args() + args.read(iprot) + iprot.readMessageEnd() + result = getThriftServerType_result() + try: + result.success = self._handler.getThriftServerType() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getThriftServerType", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getSlowLogResponses(self, seqid, iprot, oprot): + args = getSlowLogResponses_args() + args.read(iprot) + iprot.readMessageEnd() + result = getSlowLogResponses_result() + try: + result.success = self._handler.getSlowLogResponses(args.serverNames, args.logQueryFilter) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getSlowLogResponses", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_clearSlowLogResponses(self, seqid, iprot, oprot): + args = clearSlowLogResponses_args() + args.read(iprot) + iprot.readMessageEnd() + result = clearSlowLogResponses_result() + try: + result.success = self._handler.clearSlowLogResponses(args.serverNames) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("clearSlowLogResponses", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_grant(self, seqid, iprot, oprot): + args = grant_args() + args.read(iprot) + iprot.readMessageEnd() + result = grant_result() + try: + result.success = self._handler.grant(args.info) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("grant", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_revoke(self, seqid, iprot, oprot): + args = revoke_args() + args.read(iprot) + iprot.readMessageEnd() + result = revoke_result() + try: + result.success = self._handler.revoke(args.info) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TIOError as io: + msg_type = TMessageType.REPLY + result.io = io + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("revoke", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getUserPermission(self, seqid, iprot, oprot): + args = getUserPermission_args() + args.read(iprot) + iprot.readMessageEnd() + result = getUserPermission_result() + try: + result.success = self._handler.getUserPermission(args.domainName, args.scope) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("getUserPermission", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + +# HELPER FUNCTIONS AND STRUCTURES + + +class exists_args(object): + """ + Attributes: + - table: the table to check on + - tget: the TGet to check for + + """ + + + def __init__(self, table=None, tget=None,): + self.table = table + self.tget = tget + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tget = TGet() + self.tget.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('exists_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tget is not None: + oprot.writeFieldBegin('tget', TType.STRUCT, 2) + self.tget.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tget is None: + raise TProtocolException(message='Required field tget is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(exists_args) +exists_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tget', [TGet, None], None, ), # 2 +) + + +class exists_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('exists_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(exists_result) +exists_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class existsAll_args(object): + """ + Attributes: + - table: the table to check on + - tgets: a list of TGets to check for + + """ + + + def __init__(self, table=None, tgets=None,): + self.table = table + self.tgets = tgets + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.tgets = [] + (_etype172, _size169) = iprot.readListBegin() + for _i173 in range(_size169): + _elem174 = TGet() + _elem174.read(iprot) + self.tgets.append(_elem174) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('existsAll_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tgets is not None: + oprot.writeFieldBegin('tgets', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.tgets)) + for iter175 in self.tgets: + iter175.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tgets is None: + raise TProtocolException(message='Required field tgets is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(existsAll_args) +existsAll_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.LIST, 'tgets', (TType.STRUCT, [TGet, None], False), None, ), # 2 +) + + +class existsAll_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype179, _size176) = iprot.readListBegin() + for _i180 in range(_size176): + _elem181 = iprot.readBool() + self.success.append(_elem181) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('existsAll_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.BOOL, len(self.success)) + for iter182 in self.success: + oprot.writeBool(iter182) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(existsAll_result) +existsAll_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.BOOL, None, False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class get_args(object): + """ + Attributes: + - table: the table to get from + - tget: the TGet to fetch + + """ + + + def __init__(self, table=None, tget=None,): + self.table = table + self.tget = tget + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tget = TGet() + self.tget.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('get_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tget is not None: + oprot.writeFieldBegin('tget', TType.STRUCT, 2) + self.tget.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tget is None: + raise TProtocolException(message='Required field tget is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(get_args) +get_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tget', [TGet, None], None, ), # 2 +) + + +class get_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TResult() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(get_result) +get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [TResult, None], None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getMultiple_args(object): + """ + Attributes: + - table: the table to get from + - tgets: a list of TGets to fetch, the Result list + will have the Results at corresponding positions + or null if there was an error + + """ + + + def __init__(self, table=None, tgets=None,): + self.table = table + self.tgets = tgets + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.tgets = [] + (_etype186, _size183) = iprot.readListBegin() + for _i187 in range(_size183): + _elem188 = TGet() + _elem188.read(iprot) + self.tgets.append(_elem188) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getMultiple_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tgets is not None: + oprot.writeFieldBegin('tgets', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.tgets)) + for iter189 in self.tgets: + iter189.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tgets is None: + raise TProtocolException(message='Required field tgets is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getMultiple_args) +getMultiple_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.LIST, 'tgets', (TType.STRUCT, [TGet, None], False), None, ), # 2 +) + + +class getMultiple_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype193, _size190) = iprot.readListBegin() + for _i194 in range(_size190): + _elem195 = TResult() + _elem195.read(iprot) + self.success.append(_elem195) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getMultiple_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter196 in self.success: + iter196.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getMultiple_result) +getMultiple_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TResult, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class put_args(object): + """ + Attributes: + - table: the table to put data in + - tput: the TPut to put + + """ + + + def __init__(self, table=None, tput=None,): + self.table = table + self.tput = tput + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tput = TPut() + self.tput.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('put_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tput is not None: + oprot.writeFieldBegin('tput', TType.STRUCT, 2) + self.tput.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tput is None: + raise TProtocolException(message='Required field tput is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(put_args) +put_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tput', [TPut, None], None, ), # 2 +) + + +class put_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('put_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(put_result) +put_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class checkAndPut_args(object): + """ + Attributes: + - table: to check in and put to + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - value: the expected value, if not provided the + check is for the non-existence of the + column in question + - tput: the TPut to put if the check succeeds + + """ + + + def __init__(self, table=None, row=None, family=None, qualifier=None, value=None, tput=None,): + self.table = table + self.row = row + self.family = family + self.qualifier = qualifier + self.value = value + self.tput = tput + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.family = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.value = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.tput = TPut() + self.tput.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('checkAndPut_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 2) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.family is not None: + oprot.writeFieldBegin('family', TType.STRING, 3) + oprot.writeBinary(self.family) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 4) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + if self.value is not None: + oprot.writeFieldBegin('value', TType.STRING, 5) + oprot.writeBinary(self.value) + oprot.writeFieldEnd() + if self.tput is not None: + oprot.writeFieldBegin('tput', TType.STRUCT, 6) + self.tput.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.family is None: + raise TProtocolException(message='Required field family is unset!') + if self.qualifier is None: + raise TProtocolException(message='Required field qualifier is unset!') + if self.tput is None: + raise TProtocolException(message='Required field tput is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(checkAndPut_args) +checkAndPut_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRING, 'row', 'BINARY', None, ), # 2 + (3, TType.STRING, 'family', 'BINARY', None, ), # 3 + (4, TType.STRING, 'qualifier', 'BINARY', None, ), # 4 + (5, TType.STRING, 'value', 'BINARY', None, ), # 5 + (6, TType.STRUCT, 'tput', [TPut, None], None, ), # 6 +) + + +class checkAndPut_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('checkAndPut_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(checkAndPut_result) +checkAndPut_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class putMultiple_args(object): + """ + Attributes: + - table: the table to put data in + - tputs: a list of TPuts to commit + + """ + + + def __init__(self, table=None, tputs=None,): + self.table = table + self.tputs = tputs + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.tputs = [] + (_etype200, _size197) = iprot.readListBegin() + for _i201 in range(_size197): + _elem202 = TPut() + _elem202.read(iprot) + self.tputs.append(_elem202) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('putMultiple_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tputs is not None: + oprot.writeFieldBegin('tputs', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.tputs)) + for iter203 in self.tputs: + iter203.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tputs is None: + raise TProtocolException(message='Required field tputs is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(putMultiple_args) +putMultiple_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.LIST, 'tputs', (TType.STRUCT, [TPut, None], False), None, ), # 2 +) + + +class putMultiple_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('putMultiple_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(putMultiple_result) +putMultiple_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class deleteSingle_args(object): + """ + Attributes: + - table: the table to delete from + - tdelete: the TDelete to delete + + """ + + + def __init__(self, table=None, tdelete=None,): + self.table = table + self.tdelete = tdelete + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tdelete = TDelete() + self.tdelete.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteSingle_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tdelete is not None: + oprot.writeFieldBegin('tdelete', TType.STRUCT, 2) + self.tdelete.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tdelete is None: + raise TProtocolException(message='Required field tdelete is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteSingle_args) +deleteSingle_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tdelete', [TDelete, None], None, ), # 2 +) + + +class deleteSingle_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteSingle_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteSingle_result) +deleteSingle_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class deleteMultiple_args(object): + """ + Attributes: + - table: the table to delete from + - tdeletes: list of TDeletes to delete + + """ + + + def __init__(self, table=None, tdeletes=None,): + self.table = table + self.tdeletes = tdeletes + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.tdeletes = [] + (_etype207, _size204) = iprot.readListBegin() + for _i208 in range(_size204): + _elem209 = TDelete() + _elem209.read(iprot) + self.tdeletes.append(_elem209) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteMultiple_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tdeletes is not None: + oprot.writeFieldBegin('tdeletes', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.tdeletes)) + for iter210 in self.tdeletes: + iter210.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tdeletes is None: + raise TProtocolException(message='Required field tdeletes is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteMultiple_args) +deleteMultiple_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.LIST, 'tdeletes', (TType.STRUCT, [TDelete, None], False), None, ), # 2 +) + + +class deleteMultiple_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype214, _size211) = iprot.readListBegin() + for _i215 in range(_size211): + _elem216 = TDelete() + _elem216.read(iprot) + self.success.append(_elem216) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteMultiple_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter217 in self.success: + iter217.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteMultiple_result) +deleteMultiple_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TDelete, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class checkAndDelete_args(object): + """ + Attributes: + - table: to check in and delete from + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - value: the expected value, if not provided the + check is for the non-existence of the + column in question + - tdelete: the TDelete to execute if the check succeeds + + """ + + + def __init__(self, table=None, row=None, family=None, qualifier=None, value=None, tdelete=None,): + self.table = table + self.row = row + self.family = family + self.qualifier = qualifier + self.value = value + self.tdelete = tdelete + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.family = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.value = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.tdelete = TDelete() + self.tdelete.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('checkAndDelete_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 2) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.family is not None: + oprot.writeFieldBegin('family', TType.STRING, 3) + oprot.writeBinary(self.family) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 4) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + if self.value is not None: + oprot.writeFieldBegin('value', TType.STRING, 5) + oprot.writeBinary(self.value) + oprot.writeFieldEnd() + if self.tdelete is not None: + oprot.writeFieldBegin('tdelete', TType.STRUCT, 6) + self.tdelete.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.family is None: + raise TProtocolException(message='Required field family is unset!') + if self.qualifier is None: + raise TProtocolException(message='Required field qualifier is unset!') + if self.tdelete is None: + raise TProtocolException(message='Required field tdelete is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(checkAndDelete_args) +checkAndDelete_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRING, 'row', 'BINARY', None, ), # 2 + (3, TType.STRING, 'family', 'BINARY', None, ), # 3 + (4, TType.STRING, 'qualifier', 'BINARY', None, ), # 4 + (5, TType.STRING, 'value', 'BINARY', None, ), # 5 + (6, TType.STRUCT, 'tdelete', [TDelete, None], None, ), # 6 +) + + +class checkAndDelete_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('checkAndDelete_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(checkAndDelete_result) +checkAndDelete_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class increment_args(object): + """ + Attributes: + - table: the table to increment the value on + - tincrement: the TIncrement to increment + + """ + + + def __init__(self, table=None, tincrement=None,): + self.table = table + self.tincrement = tincrement + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tincrement = TIncrement() + self.tincrement.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('increment_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tincrement is not None: + oprot.writeFieldBegin('tincrement', TType.STRUCT, 2) + self.tincrement.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tincrement is None: + raise TProtocolException(message='Required field tincrement is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(increment_args) +increment_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tincrement', [TIncrement, None], None, ), # 2 +) + + +class increment_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TResult() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('increment_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(increment_result) +increment_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [TResult, None], None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class append_args(object): + """ + Attributes: + - table: the table to append the value on + - tappend: the TAppend to append + + """ + + + def __init__(self, table=None, tappend=None,): + self.table = table + self.tappend = tappend + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tappend = TAppend() + self.tappend.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('append_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tappend is not None: + oprot.writeFieldBegin('tappend', TType.STRUCT, 2) + self.tappend.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tappend is None: + raise TProtocolException(message='Required field tappend is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(append_args) +append_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tappend', [TAppend, None], None, ), # 2 +) + + +class append_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TResult() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('append_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(append_result) +append_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [TResult, None], None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class openScanner_args(object): + """ + Attributes: + - table: the table to get the Scanner for + - tscan: the scan object to get a Scanner for + + """ + + + def __init__(self, table=None, tscan=None,): + self.table = table + self.tscan = tscan + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tscan = TScan() + self.tscan.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('openScanner_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tscan is not None: + oprot.writeFieldBegin('tscan', TType.STRUCT, 2) + self.tscan.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tscan is None: + raise TProtocolException(message='Required field tscan is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(openScanner_args) +openScanner_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tscan', [TScan, None], None, ), # 2 +) + + +class openScanner_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('openScanner_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(openScanner_result) +openScanner_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getScannerRows_args(object): + """ + Attributes: + - scannerId: the Id of the Scanner to return rows from. This is an Id returned from the openScanner function. + - numRows: number of rows to return + + """ + + + def __init__(self, scannerId=None, numRows=1,): + self.scannerId = scannerId + self.numRows = numRows + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.scannerId = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.numRows = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getScannerRows_args') + if self.scannerId is not None: + oprot.writeFieldBegin('scannerId', TType.I32, 1) + oprot.writeI32(self.scannerId) + oprot.writeFieldEnd() + if self.numRows is not None: + oprot.writeFieldBegin('numRows', TType.I32, 2) + oprot.writeI32(self.numRows) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.scannerId is None: + raise TProtocolException(message='Required field scannerId is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getScannerRows_args) +getScannerRows_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'scannerId', None, None, ), # 1 + (2, TType.I32, 'numRows', None, 1, ), # 2 +) + + +class getScannerRows_result(object): + """ + Attributes: + - success + - io + - ia: if the scannerId is invalid + + """ + + + def __init__(self, success=None, io=None, ia=None,): + self.success = success + self.io = io + self.ia = ia + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype221, _size218) = iprot.readListBegin() + for _i222 in range(_size218): + _elem223 = TResult() + _elem223.read(iprot) + self.success.append(_elem223) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.ia = TIllegalArgument() + self.ia.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getScannerRows_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter224 in self.success: + iter224.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + if self.ia is not None: + oprot.writeFieldBegin('ia', TType.STRUCT, 2) + self.ia.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getScannerRows_result) +getScannerRows_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TResult, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 + (2, TType.STRUCT, 'ia', [TIllegalArgument, None], None, ), # 2 +) + + +class closeScanner_args(object): + """ + Attributes: + - scannerId: the Id of the Scanner to close * + + """ + + + def __init__(self, scannerId=None,): + self.scannerId = scannerId + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.scannerId = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('closeScanner_args') + if self.scannerId is not None: + oprot.writeFieldBegin('scannerId', TType.I32, 1) + oprot.writeI32(self.scannerId) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.scannerId is None: + raise TProtocolException(message='Required field scannerId is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(closeScanner_args) +closeScanner_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'scannerId', None, None, ), # 1 +) + + +class closeScanner_result(object): + """ + Attributes: + - io + - ia: if the scannerId is invalid + + """ + + + def __init__(self, io=None, ia=None,): + self.io = io + self.ia = ia + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.ia = TIllegalArgument() + self.ia.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('closeScanner_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + if self.ia is not None: + oprot.writeFieldBegin('ia', TType.STRUCT, 2) + self.ia.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(closeScanner_result) +closeScanner_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 + (2, TType.STRUCT, 'ia', [TIllegalArgument, None], None, ), # 2 +) + + +class mutateRow_args(object): + """ + Attributes: + - table: table to apply the mutations + - trowMutations: mutations to apply + + """ + + + def __init__(self, table=None, trowMutations=None,): + self.table = table + self.trowMutations = trowMutations + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.trowMutations = TRowMutations() + self.trowMutations.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('mutateRow_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.trowMutations is not None: + oprot.writeFieldBegin('trowMutations', TType.STRUCT, 2) + self.trowMutations.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.trowMutations is None: + raise TProtocolException(message='Required field trowMutations is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(mutateRow_args) +mutateRow_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'trowMutations', [TRowMutations, None], None, ), # 2 +) + + +class mutateRow_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('mutateRow_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(mutateRow_result) +mutateRow_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getScannerResults_args(object): + """ + Attributes: + - table: the table to get the Scanner for + - tscan: the scan object to get a Scanner for + - numRows: number of rows to return + + """ + + + def __init__(self, table=None, tscan=None, numRows=1,): + self.table = table + self.tscan = tscan + self.numRows = numRows + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.tscan = TScan() + self.tscan.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.numRows = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getScannerResults_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.tscan is not None: + oprot.writeFieldBegin('tscan', TType.STRUCT, 2) + self.tscan.write(oprot) + oprot.writeFieldEnd() + if self.numRows is not None: + oprot.writeFieldBegin('numRows', TType.I32, 3) + oprot.writeI32(self.numRows) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.tscan is None: + raise TProtocolException(message='Required field tscan is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getScannerResults_args) +getScannerResults_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRUCT, 'tscan', [TScan, None], None, ), # 2 + (3, TType.I32, 'numRows', None, 1, ), # 3 +) + + +class getScannerResults_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype228, _size225) = iprot.readListBegin() + for _i229 in range(_size225): + _elem230 = TResult() + _elem230.read(iprot) + self.success.append(_elem230) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getScannerResults_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter231 in self.success: + iter231.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getScannerResults_result) +getScannerResults_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TResult, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getRegionLocation_args(object): + """ + Attributes: + - table + - row + - reload + + """ + + + def __init__(self, table=None, row=None, reload=None,): + self.table = table + self.row = row + self.reload = reload + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.reload = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getRegionLocation_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 2) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.reload is not None: + oprot.writeFieldBegin('reload', TType.BOOL, 3) + oprot.writeBool(self.reload) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getRegionLocation_args) +getRegionLocation_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRING, 'row', 'BINARY', None, ), # 2 + (3, TType.BOOL, 'reload', None, None, ), # 3 +) + + +class getRegionLocation_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = THRegionLocation() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getRegionLocation_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getRegionLocation_result) +getRegionLocation_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [THRegionLocation, None], None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getAllRegionLocations_args(object): + """ + Attributes: + - table + + """ + + + def __init__(self, table=None,): + self.table = table + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getAllRegionLocations_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getAllRegionLocations_args) +getAllRegionLocations_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 +) + + +class getAllRegionLocations_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype235, _size232) = iprot.readListBegin() + for _i236 in range(_size232): + _elem237 = THRegionLocation() + _elem237.read(iprot) + self.success.append(_elem237) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getAllRegionLocations_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter238 in self.success: + iter238.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getAllRegionLocations_result) +getAllRegionLocations_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [THRegionLocation, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class checkAndMutate_args(object): + """ + Attributes: + - table: to check in and delete from + - row: row to check + - family: column family to check + - qualifier: column qualifier to check + - compareOp: comparison to make on the value + - value: the expected value to be compared against, if not provided the + check is for the non-existence of the column in question + - rowMutations: row mutations to execute if the value matches + + """ + + + def __init__(self, table=None, row=None, family=None, qualifier=None, compareOp=None, value=None, rowMutations=None,): + self.table = table + self.row = row + self.family = family + self.qualifier = qualifier + self.compareOp = compareOp + self.value = value + self.rowMutations = rowMutations + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.table = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.family = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.compareOp = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.value = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRUCT: + self.rowMutations = TRowMutations() + self.rowMutations.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('checkAndMutate_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRING, 1) + oprot.writeBinary(self.table) + oprot.writeFieldEnd() + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 2) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.family is not None: + oprot.writeFieldBegin('family', TType.STRING, 3) + oprot.writeBinary(self.family) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 4) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + if self.compareOp is not None: + oprot.writeFieldBegin('compareOp', TType.I32, 5) + oprot.writeI32(self.compareOp) + oprot.writeFieldEnd() + if self.value is not None: + oprot.writeFieldBegin('value', TType.STRING, 6) + oprot.writeBinary(self.value) + oprot.writeFieldEnd() + if self.rowMutations is not None: + oprot.writeFieldBegin('rowMutations', TType.STRUCT, 7) + self.rowMutations.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.family is None: + raise TProtocolException(message='Required field family is unset!') + if self.qualifier is None: + raise TProtocolException(message='Required field qualifier is unset!') + if self.compareOp is None: + raise TProtocolException(message='Required field compareOp is unset!') + if self.rowMutations is None: + raise TProtocolException(message='Required field rowMutations is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(checkAndMutate_args) +checkAndMutate_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'table', 'BINARY', None, ), # 1 + (2, TType.STRING, 'row', 'BINARY', None, ), # 2 + (3, TType.STRING, 'family', 'BINARY', None, ), # 3 + (4, TType.STRING, 'qualifier', 'BINARY', None, ), # 4 + (5, TType.I32, 'compareOp', None, None, ), # 5 + (6, TType.STRING, 'value', 'BINARY', None, ), # 6 + (7, TType.STRUCT, 'rowMutations', [TRowMutations, None], None, ), # 7 +) + + +class checkAndMutate_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('checkAndMutate_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(checkAndMutate_result) +checkAndMutate_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getTableDescriptor_args(object): + """ + Attributes: + - table: the tablename of the table to get tableDescriptor + + """ + + + def __init__(self, table=None,): + self.table = table + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.table = TTableName() + self.table.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptor_args') + if self.table is not None: + oprot.writeFieldBegin('table', TType.STRUCT, 1) + self.table.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.table is None: + raise TProtocolException(message='Required field table is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptor_args) +getTableDescriptor_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'table', [TTableName, None], None, ), # 1 +) + + +class getTableDescriptor_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TTableDescriptor() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptor_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptor_result) +getTableDescriptor_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [TTableDescriptor, None], None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getTableDescriptors_args(object): + """ + Attributes: + - tables: the tablename list of the tables to get tableDescriptor + + """ + + + def __init__(self, tables=None,): + self.tables = tables + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.tables = [] + (_etype242, _size239) = iprot.readListBegin() + for _i243 in range(_size239): + _elem244 = TTableName() + _elem244.read(iprot) + self.tables.append(_elem244) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptors_args') + if self.tables is not None: + oprot.writeFieldBegin('tables', TType.LIST, 1) + oprot.writeListBegin(TType.STRUCT, len(self.tables)) + for iter245 in self.tables: + iter245.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tables is None: + raise TProtocolException(message='Required field tables is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptors_args) +getTableDescriptors_args.thrift_spec = ( + None, # 0 + (1, TType.LIST, 'tables', (TType.STRUCT, [TTableName, None], False), None, ), # 1 +) + + +class getTableDescriptors_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype249, _size246) = iprot.readListBegin() + for _i250 in range(_size246): + _elem251 = TTableDescriptor() + _elem251.read(iprot) + self.success.append(_elem251) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptors_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter252 in self.success: + iter252.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptors_result) +getTableDescriptors_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TTableDescriptor, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class tableExists_args(object): + """ + Attributes: + - tableName: the tablename of the tables to check + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('tableExists_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(tableExists_args) +tableExists_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class tableExists_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('tableExists_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(tableExists_result) +tableExists_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getTableDescriptorsByPattern_args(object): + """ + Attributes: + - regex: The regular expression to match against + - includeSysTables: set to false if match only against userspace tables + + """ + + + def __init__(self, regex=None, includeSysTables=None,): + self.regex = regex + self.includeSysTables = includeSysTables + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.regex = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.includeSysTables = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptorsByPattern_args') + if self.regex is not None: + oprot.writeFieldBegin('regex', TType.STRING, 1) + oprot.writeString(self.regex.encode('utf-8') if sys.version_info[0] == 2 else self.regex) + oprot.writeFieldEnd() + if self.includeSysTables is not None: + oprot.writeFieldBegin('includeSysTables', TType.BOOL, 2) + oprot.writeBool(self.includeSysTables) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.includeSysTables is None: + raise TProtocolException(message='Required field includeSysTables is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptorsByPattern_args) +getTableDescriptorsByPattern_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'regex', 'UTF8', None, ), # 1 + (2, TType.BOOL, 'includeSysTables', None, None, ), # 2 +) + + +class getTableDescriptorsByPattern_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype256, _size253) = iprot.readListBegin() + for _i257 in range(_size253): + _elem258 = TTableDescriptor() + _elem258.read(iprot) + self.success.append(_elem258) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptorsByPattern_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter259 in self.success: + iter259.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptorsByPattern_result) +getTableDescriptorsByPattern_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TTableDescriptor, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getTableDescriptorsByNamespace_args(object): + """ + Attributes: + - name: The namesapce's name + + """ + + + def __init__(self, name=None,): + self.name = name + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptorsByNamespace_args') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.name is None: + raise TProtocolException(message='Required field name is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptorsByNamespace_args) +getTableDescriptorsByNamespace_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'UTF8', None, ), # 1 +) + + +class getTableDescriptorsByNamespace_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype263, _size260) = iprot.readListBegin() + for _i264 in range(_size260): + _elem265 = TTableDescriptor() + _elem265.read(iprot) + self.success.append(_elem265) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableDescriptorsByNamespace_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter266 in self.success: + iter266.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableDescriptorsByNamespace_result) +getTableDescriptorsByNamespace_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TTableDescriptor, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getTableNamesByPattern_args(object): + """ + Attributes: + - regex: The regular expression to match against + - includeSysTables: set to false if match only against userspace tables + + """ + + + def __init__(self, regex=None, includeSysTables=None,): + self.regex = regex + self.includeSysTables = includeSysTables + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.regex = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.includeSysTables = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableNamesByPattern_args') + if self.regex is not None: + oprot.writeFieldBegin('regex', TType.STRING, 1) + oprot.writeString(self.regex.encode('utf-8') if sys.version_info[0] == 2 else self.regex) + oprot.writeFieldEnd() + if self.includeSysTables is not None: + oprot.writeFieldBegin('includeSysTables', TType.BOOL, 2) + oprot.writeBool(self.includeSysTables) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.includeSysTables is None: + raise TProtocolException(message='Required field includeSysTables is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableNamesByPattern_args) +getTableNamesByPattern_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'regex', 'UTF8', None, ), # 1 + (2, TType.BOOL, 'includeSysTables', None, None, ), # 2 +) + + +class getTableNamesByPattern_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype270, _size267) = iprot.readListBegin() + for _i271 in range(_size267): + _elem272 = TTableName() + _elem272.read(iprot) + self.success.append(_elem272) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableNamesByPattern_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter273 in self.success: + iter273.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableNamesByPattern_result) +getTableNamesByPattern_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TTableName, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getTableNamesByNamespace_args(object): + """ + Attributes: + - name: The namesapce's name + + """ + + + def __init__(self, name=None,): + self.name = name + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableNamesByNamespace_args') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.name is None: + raise TProtocolException(message='Required field name is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableNamesByNamespace_args) +getTableNamesByNamespace_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'UTF8', None, ), # 1 +) + + +class getTableNamesByNamespace_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype277, _size274) = iprot.readListBegin() + for _i278 in range(_size274): + _elem279 = TTableName() + _elem279.read(iprot) + self.success.append(_elem279) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getTableNamesByNamespace_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter280 in self.success: + iter280.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getTableNamesByNamespace_result) +getTableNamesByNamespace_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TTableName, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class createTable_args(object): + """ + Attributes: + - desc: table descriptor for table + - splitKeys: rray of split keys for the initial regions of the table + + """ + + + def __init__(self, desc=None, splitKeys=None,): + self.desc = desc + self.splitKeys = splitKeys + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.desc = TTableDescriptor() + self.desc.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.splitKeys = [] + (_etype284, _size281) = iprot.readListBegin() + for _i285 in range(_size281): + _elem286 = iprot.readBinary() + self.splitKeys.append(_elem286) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('createTable_args') + if self.desc is not None: + oprot.writeFieldBegin('desc', TType.STRUCT, 1) + self.desc.write(oprot) + oprot.writeFieldEnd() + if self.splitKeys is not None: + oprot.writeFieldBegin('splitKeys', TType.LIST, 2) + oprot.writeListBegin(TType.STRING, len(self.splitKeys)) + for iter287 in self.splitKeys: + oprot.writeBinary(iter287) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.desc is None: + raise TProtocolException(message='Required field desc is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(createTable_args) +createTable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'desc', [TTableDescriptor, None], None, ), # 1 + (2, TType.LIST, 'splitKeys', (TType.STRING, 'BINARY', False), None, ), # 2 +) + + +class createTable_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('createTable_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(createTable_result) +createTable_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class deleteTable_args(object): + """ + Attributes: + - tableName: the tablename to delete + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteTable_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteTable_args) +deleteTable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class deleteTable_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteTable_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteTable_result) +deleteTable_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class truncateTable_args(object): + """ + Attributes: + - tableName: the tablename to truncate + - preserveSplits: whether to preserve previous splits + + """ + + + def __init__(self, tableName=None, preserveSplits=None,): + self.tableName = tableName + self.preserveSplits = preserveSplits + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.preserveSplits = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('truncateTable_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.preserveSplits is not None: + oprot.writeFieldBegin('preserveSplits', TType.BOOL, 2) + oprot.writeBool(self.preserveSplits) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + if self.preserveSplits is None: + raise TProtocolException(message='Required field preserveSplits is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(truncateTable_args) +truncateTable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 + (2, TType.BOOL, 'preserveSplits', None, None, ), # 2 +) + + +class truncateTable_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('truncateTable_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(truncateTable_result) +truncateTable_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class enableTable_args(object): + """ + Attributes: + - tableName: the tablename to enable + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('enableTable_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(enableTable_args) +enableTable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class enableTable_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('enableTable_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(enableTable_result) +enableTable_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class disableTable_args(object): + """ + Attributes: + - tableName: the tablename to disable + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('disableTable_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(disableTable_args) +disableTable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class disableTable_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('disableTable_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(disableTable_result) +disableTable_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class isTableEnabled_args(object): + """ + Attributes: + - tableName: the tablename to check + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableEnabled_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableEnabled_args) +isTableEnabled_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class isTableEnabled_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableEnabled_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableEnabled_result) +isTableEnabled_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class isTableDisabled_args(object): + """ + Attributes: + - tableName: the tablename to check + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableDisabled_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableDisabled_args) +isTableDisabled_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class isTableDisabled_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableDisabled_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableDisabled_result) +isTableDisabled_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class isTableAvailable_args(object): + """ + Attributes: + - tableName: the tablename to check + + """ + + + def __init__(self, tableName=None,): + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableAvailable_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableAvailable_args) +isTableAvailable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 +) + + +class isTableAvailable_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableAvailable_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableAvailable_result) +isTableAvailable_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class isTableAvailableWithSplit_args(object): + """ + Attributes: + - tableName: the tablename to check + - splitKeys: keys to check if the table has been created with all split keys + + """ + + + def __init__(self, tableName=None, splitKeys=None,): + self.tableName = tableName + self.splitKeys = splitKeys + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.splitKeys = [] + (_etype291, _size288) = iprot.readListBegin() + for _i292 in range(_size288): + _elem293 = iprot.readBinary() + self.splitKeys.append(_elem293) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableAvailableWithSplit_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.splitKeys is not None: + oprot.writeFieldBegin('splitKeys', TType.LIST, 2) + oprot.writeListBegin(TType.STRING, len(self.splitKeys)) + for iter294 in self.splitKeys: + oprot.writeBinary(iter294) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableAvailableWithSplit_args) +isTableAvailableWithSplit_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 + (2, TType.LIST, 'splitKeys', (TType.STRING, 'BINARY', False), None, ), # 2 +) + + +class isTableAvailableWithSplit_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('isTableAvailableWithSplit_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(isTableAvailableWithSplit_result) +isTableAvailableWithSplit_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class addColumnFamily_args(object): + """ + Attributes: + - tableName: the tablename to add column family to + - column: column family descriptor of column family to be added + + """ + + + def __init__(self, tableName=None, column=None,): + self.tableName = tableName + self.column = column + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.column = TColumnFamilyDescriptor() + self.column.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('addColumnFamily_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.column is not None: + oprot.writeFieldBegin('column', TType.STRUCT, 2) + self.column.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + if self.column is None: + raise TProtocolException(message='Required field column is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(addColumnFamily_args) +addColumnFamily_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 + (2, TType.STRUCT, 'column', [TColumnFamilyDescriptor, None], None, ), # 2 +) + + +class addColumnFamily_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('addColumnFamily_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(addColumnFamily_result) +addColumnFamily_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class deleteColumnFamily_args(object): + """ + Attributes: + - tableName: the tablename to delete column family from + - column: name of column family to be deleted + + """ + + + def __init__(self, tableName=None, column=None,): + self.tableName = tableName + self.column = column + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.column = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteColumnFamily_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.column is not None: + oprot.writeFieldBegin('column', TType.STRING, 2) + oprot.writeBinary(self.column) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + if self.column is None: + raise TProtocolException(message='Required field column is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteColumnFamily_args) +deleteColumnFamily_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 + (2, TType.STRING, 'column', 'BINARY', None, ), # 2 +) + + +class deleteColumnFamily_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteColumnFamily_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteColumnFamily_result) +deleteColumnFamily_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class modifyColumnFamily_args(object): + """ + Attributes: + - tableName: the tablename to modify column family + - column: column family descriptor of column family to be modified + + """ + + + def __init__(self, tableName=None, column=None,): + self.tableName = tableName + self.column = column + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.column = TColumnFamilyDescriptor() + self.column.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('modifyColumnFamily_args') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.column is not None: + oprot.writeFieldBegin('column', TType.STRUCT, 2) + self.column.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + if self.column is None: + raise TProtocolException(message='Required field column is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(modifyColumnFamily_args) +modifyColumnFamily_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 + (2, TType.STRUCT, 'column', [TColumnFamilyDescriptor, None], None, ), # 2 +) + + +class modifyColumnFamily_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('modifyColumnFamily_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(modifyColumnFamily_result) +modifyColumnFamily_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class modifyTable_args(object): + """ + Attributes: + - desc: the descriptor of the table to modify + + """ + + + def __init__(self, desc=None,): + self.desc = desc + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.desc = TTableDescriptor() + self.desc.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('modifyTable_args') + if self.desc is not None: + oprot.writeFieldBegin('desc', TType.STRUCT, 1) + self.desc.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.desc is None: + raise TProtocolException(message='Required field desc is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(modifyTable_args) +modifyTable_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'desc', [TTableDescriptor, None], None, ), # 1 +) + + +class modifyTable_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('modifyTable_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(modifyTable_result) +modifyTable_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class createNamespace_args(object): + """ + Attributes: + - namespaceDesc: descriptor which describes the new namespace + + """ + + + def __init__(self, namespaceDesc=None,): + self.namespaceDesc = namespaceDesc + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.namespaceDesc = TNamespaceDescriptor() + self.namespaceDesc.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('createNamespace_args') + if self.namespaceDesc is not None: + oprot.writeFieldBegin('namespaceDesc', TType.STRUCT, 1) + self.namespaceDesc.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.namespaceDesc is None: + raise TProtocolException(message='Required field namespaceDesc is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(createNamespace_args) +createNamespace_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'namespaceDesc', [TNamespaceDescriptor, None], None, ), # 1 +) + + +class createNamespace_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('createNamespace_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(createNamespace_result) +createNamespace_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class modifyNamespace_args(object): + """ + Attributes: + - namespaceDesc: descriptor which describes the new namespace + + """ + + + def __init__(self, namespaceDesc=None,): + self.namespaceDesc = namespaceDesc + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.namespaceDesc = TNamespaceDescriptor() + self.namespaceDesc.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('modifyNamespace_args') + if self.namespaceDesc is not None: + oprot.writeFieldBegin('namespaceDesc', TType.STRUCT, 1) + self.namespaceDesc.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.namespaceDesc is None: + raise TProtocolException(message='Required field namespaceDesc is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(modifyNamespace_args) +modifyNamespace_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'namespaceDesc', [TNamespaceDescriptor, None], None, ), # 1 +) + + +class modifyNamespace_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('modifyNamespace_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(modifyNamespace_result) +modifyNamespace_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class deleteNamespace_args(object): + """ + Attributes: + - name: namespace name + + """ + + + def __init__(self, name=None,): + self.name = name + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteNamespace_args') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.name is None: + raise TProtocolException(message='Required field name is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteNamespace_args) +deleteNamespace_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'UTF8', None, ), # 1 +) + + +class deleteNamespace_result(object): + """ + Attributes: + - io + + """ + + + def __init__(self, io=None,): + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('deleteNamespace_result') + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(deleteNamespace_result) +deleteNamespace_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getNamespaceDescriptor_args(object): + """ + Attributes: + - name: name of namespace descriptor + + """ + + + def __init__(self, name=None,): + self.name = name + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getNamespaceDescriptor_args') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.name is None: + raise TProtocolException(message='Required field name is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getNamespaceDescriptor_args) +getNamespaceDescriptor_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'UTF8', None, ), # 1 +) + + +class getNamespaceDescriptor_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TNamespaceDescriptor() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getNamespaceDescriptor_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getNamespaceDescriptor_result) +getNamespaceDescriptor_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [TNamespaceDescriptor, None], None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class listNamespaceDescriptors_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('listNamespaceDescriptors_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(listNamespaceDescriptors_args) +listNamespaceDescriptors_args.thrift_spec = ( +) + + +class listNamespaceDescriptors_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype298, _size295) = iprot.readListBegin() + for _i299 in range(_size295): + _elem300 = TNamespaceDescriptor() + _elem300.read(iprot) + self.success.append(_elem300) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('listNamespaceDescriptors_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter301 in self.success: + iter301.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(listNamespaceDescriptors_result) +listNamespaceDescriptors_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TNamespaceDescriptor, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class listNamespaces_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('listNamespaces_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(listNamespaces_args) +listNamespaces_args.thrift_spec = ( +) + + +class listNamespaces_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype305, _size302) = iprot.readListBegin() + for _i306 in range(_size302): + _elem307 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success.append(_elem307) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('listNamespaces_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRING, len(self.success)) + for iter308 in self.success: + oprot.writeString(iter308.encode('utf-8') if sys.version_info[0] == 2 else iter308) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(listNamespaces_result) +listNamespaces_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRING, 'UTF8', False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getThriftServerType_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getThriftServerType_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getThriftServerType_args) +getThriftServerType_args.thrift_spec = ( +) + + +class getThriftServerType_result(object): + """ + Attributes: + - success + + """ + + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getThriftServerType_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getThriftServerType_result) +getThriftServerType_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 +) + + +class getSlowLogResponses_args(object): + """ + Attributes: + - serverNames: @param serverNames Server names to get slowlog responses from + - logQueryFilter: @param logQueryFilter filter to be used if provided + + """ + + + def __init__(self, serverNames=None, logQueryFilter=None,): + self.serverNames = serverNames + self.logQueryFilter = logQueryFilter + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.SET: + self.serverNames = set() + (_etype312, _size309) = iprot.readSetBegin() + for _i313 in range(_size309): + _elem314 = TServerName() + _elem314.read(iprot) + self.serverNames.add(_elem314) + iprot.readSetEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.logQueryFilter = TLogQueryFilter() + self.logQueryFilter.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getSlowLogResponses_args') + if self.serverNames is not None: + oprot.writeFieldBegin('serverNames', TType.SET, 1) + oprot.writeSetBegin(TType.STRUCT, len(self.serverNames)) + for iter315 in self.serverNames: + iter315.write(oprot) + oprot.writeSetEnd() + oprot.writeFieldEnd() + if self.logQueryFilter is not None: + oprot.writeFieldBegin('logQueryFilter', TType.STRUCT, 2) + self.logQueryFilter.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getSlowLogResponses_args) +getSlowLogResponses_args.thrift_spec = ( + None, # 0 + (1, TType.SET, 'serverNames', (TType.STRUCT, [TServerName, None], False), None, ), # 1 + (2, TType.STRUCT, 'logQueryFilter', [TLogQueryFilter, None], None, ), # 2 +) + + +class getSlowLogResponses_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype319, _size316) = iprot.readListBegin() + for _i320 in range(_size316): + _elem321 = TOnlineLogRecord() + _elem321.read(iprot) + self.success.append(_elem321) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getSlowLogResponses_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter322 in self.success: + iter322.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getSlowLogResponses_result) +getSlowLogResponses_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [TOnlineLogRecord, None], False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class clearSlowLogResponses_args(object): + """ + Attributes: + - serverNames: @param serverNames Set of Server names to clean slowlog responses from + + """ + + + def __init__(self, serverNames=None,): + self.serverNames = serverNames + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.SET: + self.serverNames = set() + (_etype326, _size323) = iprot.readSetBegin() + for _i327 in range(_size323): + _elem328 = TServerName() + _elem328.read(iprot) + self.serverNames.add(_elem328) + iprot.readSetEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('clearSlowLogResponses_args') + if self.serverNames is not None: + oprot.writeFieldBegin('serverNames', TType.SET, 1) + oprot.writeSetBegin(TType.STRUCT, len(self.serverNames)) + for iter329 in self.serverNames: + iter329.write(oprot) + oprot.writeSetEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(clearSlowLogResponses_args) +clearSlowLogResponses_args.thrift_spec = ( + None, # 0 + (1, TType.SET, 'serverNames', (TType.STRUCT, [TServerName, None], False), None, ), # 1 +) + + +class clearSlowLogResponses_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype333, _size330) = iprot.readListBegin() + for _i334 in range(_size330): + _elem335 = iprot.readBool() + self.success.append(_elem335) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('clearSlowLogResponses_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.BOOL, len(self.success)) + for iter336 in self.success: + oprot.writeBool(iter336) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(clearSlowLogResponses_result) +clearSlowLogResponses_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.BOOL, None, False), None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class grant_args(object): + """ + Attributes: + - info + + """ + + + def __init__(self, info=None,): + self.info = info + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.info = TAccessControlEntity() + self.info.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('grant_args') + if self.info is not None: + oprot.writeFieldBegin('info', TType.STRUCT, 1) + self.info.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.info is None: + raise TProtocolException(message='Required field info is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(grant_args) +grant_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'info', [TAccessControlEntity, None], None, ), # 1 +) + + +class grant_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('grant_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(grant_result) +grant_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class revoke_args(object): + """ + Attributes: + - info + + """ + + + def __init__(self, info=None,): + self.info = info + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.info = TAccessControlEntity() + self.info.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('revoke_args') + if self.info is not None: + oprot.writeFieldBegin('info', TType.STRUCT, 1) + self.info.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.info is None: + raise TProtocolException(message='Required field info is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(revoke_args) +revoke_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'info', [TAccessControlEntity, None], None, ), # 1 +) + + +class revoke_result(object): + """ + Attributes: + - success + - io + + """ + + + def __init__(self, success=None, io=None,): + self.success = success + self.io = io + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.io = TIOError() + self.io.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('revoke_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.io is not None: + oprot.writeFieldBegin('io', TType.STRUCT, 1) + self.io.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(revoke_result) +revoke_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'io', [TIOError, None], None, ), # 1 +) + + +class getUserPermission_args(object): + """ + Attributes: + - domainName + - scope + + """ + + + def __init__(self, domainName=None, scope=None,): + self.domainName = domainName + self.scope = scope + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.domainName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.scope = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getUserPermission_args') + if self.domainName is not None: + oprot.writeFieldBegin('domainName', TType.STRING, 1) + oprot.writeString(self.domainName.encode('utf-8') if sys.version_info[0] == 2 else self.domainName) + oprot.writeFieldEnd() + if self.scope is not None: + oprot.writeFieldBegin('scope', TType.I32, 2) + oprot.writeI32(self.scope) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getUserPermission_args) +getUserPermission_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'domainName', 'UTF8', None, ), # 1 + (2, TType.I32, 'scope', None, None, ), # 2 +) + + +class getUserPermission_result(object): + """ + Attributes: + - success + + """ + + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.MAP: + self.success = {} + (_ktype338, _vtype339, _size337) = iprot.readMapBegin() + for _i341 in range(_size337): + _key342 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val343 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success[_key342] = _val343 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('getUserPermission_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.MAP, 0) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) + for kiter344, viter345 in self.success.items(): + oprot.writeString(kiter344.encode('utf-8') if sys.version_info[0] == 2 else kiter344) + oprot.writeString(viter345.encode('utf-8') if sys.version_info[0] == 2 else viter345) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(getUserPermission_result) +getUserPermission_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 +) +fix_spec(all_structs) +del all_structs + diff --git a/thrift-python/hbase-client-thrift2/hbase/__init__.py b/thrift-python/hbase-client-thrift2/hbase/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/thrift-python/hbase-client-thrift2/hbase/constants.py b/thrift-python/hbase-client-thrift2/hbase/constants.py new file mode 100644 index 00000000..bbe41d88 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/hbase/constants.py @@ -0,0 +1,14 @@ +# +# Autogenerated by Thrift Compiler (0.13.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + +import sys +from .ttypes import * diff --git a/thrift-python/hbase-client-thrift2/hbase/ttypes.py b/thrift-python/hbase-client-thrift2/hbase/ttypes.py new file mode 100644 index 00000000..b3be69fa --- /dev/null +++ b/thrift-python/hbase-client-thrift2/hbase/ttypes.py @@ -0,0 +1,3915 @@ +# +# Autogenerated by Thrift Compiler (0.13.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + +import sys + +from thrift.transport import TTransport +all_structs = [] + + +class TDeleteType(object): + """ + Specify type of delete: + - DELETE_COLUMN means exactly one version will be removed, + - DELETE_COLUMNS means previous versions will also be removed. + + """ + DELETE_COLUMN = 0 + DELETE_COLUMNS = 1 + DELETE_FAMILY = 2 + DELETE_FAMILY_VERSION = 3 + + _VALUES_TO_NAMES = { + 0: "DELETE_COLUMN", + 1: "DELETE_COLUMNS", + 2: "DELETE_FAMILY", + 3: "DELETE_FAMILY_VERSION", + } + + _NAMES_TO_VALUES = { + "DELETE_COLUMN": 0, + "DELETE_COLUMNS": 1, + "DELETE_FAMILY": 2, + "DELETE_FAMILY_VERSION": 3, + } + + +class TDurability(object): + """ + Specify Durability: + - SKIP_WAL means do not write the Mutation to the WAL. + - ASYNC_WAL means write the Mutation to the WAL asynchronously, + - SYNC_WAL means write the Mutation to the WAL synchronously, + - FSYNC_WAL means Write the Mutation to the WAL synchronously and force the entries to disk. + + """ + USE_DEFAULT = 0 + SKIP_WAL = 1 + ASYNC_WAL = 2 + SYNC_WAL = 3 + FSYNC_WAL = 4 + + _VALUES_TO_NAMES = { + 0: "USE_DEFAULT", + 1: "SKIP_WAL", + 2: "ASYNC_WAL", + 3: "SYNC_WAL", + 4: "FSYNC_WAL", + } + + _NAMES_TO_VALUES = { + "USE_DEFAULT": 0, + "SKIP_WAL": 1, + "ASYNC_WAL": 2, + "SYNC_WAL": 3, + "FSYNC_WAL": 4, + } + + +class TConsistency(object): + """ + Specify Consistency: + - STRONG means reads only from primary region + - TIMELINE means reads might return values from secondary region replicas + + """ + STRONG = 1 + TIMELINE = 2 + + _VALUES_TO_NAMES = { + 1: "STRONG", + 2: "TIMELINE", + } + + _NAMES_TO_VALUES = { + "STRONG": 1, + "TIMELINE": 2, + } + + +class TReadType(object): + DEFAULT = 1 + STREAM = 2 + PREAD = 3 + + _VALUES_TO_NAMES = { + 1: "DEFAULT", + 2: "STREAM", + 3: "PREAD", + } + + _NAMES_TO_VALUES = { + "DEFAULT": 1, + "STREAM": 2, + "PREAD": 3, + } + + +class TCompareOp(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.filter.CompareFilter$CompareOp. + + """ + LESS = 0 + LESS_OR_EQUAL = 1 + EQUAL = 2 + NOT_EQUAL = 3 + GREATER_OR_EQUAL = 4 + GREATER = 5 + NO_OP = 6 + + _VALUES_TO_NAMES = { + 0: "LESS", + 1: "LESS_OR_EQUAL", + 2: "EQUAL", + 3: "NOT_EQUAL", + 4: "GREATER_OR_EQUAL", + 5: "GREATER", + 6: "NO_OP", + } + + _NAMES_TO_VALUES = { + "LESS": 0, + "LESS_OR_EQUAL": 1, + "EQUAL": 2, + "NOT_EQUAL": 3, + "GREATER_OR_EQUAL": 4, + "GREATER": 5, + "NO_OP": 6, + } + + +class TBloomFilterType(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.regionserver.BloomType + + """ + NONE = 0 + ROW = 1 + ROWCOL = 2 + ROWPREFIX_FIXED_LENGTH = 3 + + _VALUES_TO_NAMES = { + 0: "NONE", + 1: "ROW", + 2: "ROWCOL", + 3: "ROWPREFIX_FIXED_LENGTH", + } + + _NAMES_TO_VALUES = { + "NONE": 0, + "ROW": 1, + "ROWCOL": 2, + "ROWPREFIX_FIXED_LENGTH": 3, + } + + +class TCompressionAlgorithm(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.io.compress.Algorithm + + """ + LZO = 0 + GZ = 1 + NONE = 2 + SNAPPY = 3 + LZ4 = 4 + BZIP2 = 5 + ZSTD = 6 + + _VALUES_TO_NAMES = { + 0: "LZO", + 1: "GZ", + 2: "NONE", + 3: "SNAPPY", + 4: "LZ4", + 5: "BZIP2", + 6: "ZSTD", + } + + _NAMES_TO_VALUES = { + "LZO": 0, + "GZ": 1, + "NONE": 2, + "SNAPPY": 3, + "LZ4": 4, + "BZIP2": 5, + "ZSTD": 6, + } + + +class TDataBlockEncoding(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.io.encoding.DataBlockEncoding + + """ + NONE = 0 + PREFIX = 2 + DIFF = 3 + FAST_DIFF = 4 + ROW_INDEX_V1 = 7 + + _VALUES_TO_NAMES = { + 0: "NONE", + 2: "PREFIX", + 3: "DIFF", + 4: "FAST_DIFF", + 7: "ROW_INDEX_V1", + } + + _NAMES_TO_VALUES = { + "NONE": 0, + "PREFIX": 2, + "DIFF": 3, + "FAST_DIFF": 4, + "ROW_INDEX_V1": 7, + } + + +class TKeepDeletedCells(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.KeepDeletedCells + + """ + FALSE = 0 + TRUE = 1 + TTL = 2 + + _VALUES_TO_NAMES = { + 0: "FALSE", + 1: "TRUE", + 2: "TTL", + } + + _NAMES_TO_VALUES = { + "FALSE": 0, + "TRUE": 1, + "TTL": 2, + } + + +class TPermissionScope(object): + TABLE = 0 + NAMESPACE = 1 + + _VALUES_TO_NAMES = { + 0: "TABLE", + 1: "NAMESPACE", + } + + _NAMES_TO_VALUES = { + "TABLE": 0, + "NAMESPACE": 1, + } + + +class TPermissionOps(object): + GRANT = 0 + REVOKE = 1 + + _VALUES_TO_NAMES = { + 0: "GRANT", + 1: "REVOKE", + } + + _NAMES_TO_VALUES = { + "GRANT": 0, + "REVOKE": 1, + } + + +class TLogType(object): + SLOW_LOG = 1 + LARGE_LOG = 2 + + _VALUES_TO_NAMES = { + 1: "SLOW_LOG", + 2: "LARGE_LOG", + } + + _NAMES_TO_VALUES = { + "SLOW_LOG": 1, + "LARGE_LOG": 2, + } + + +class TFilterByOperator(object): + AND = 0 + OR = 1 + + _VALUES_TO_NAMES = { + 0: "AND", + 1: "OR", + } + + _NAMES_TO_VALUES = { + "AND": 0, + "OR": 1, + } + + +class TThriftServerType(object): + """ + Specify type of thrift server: thrift and thrift2 + + """ + ONE = 1 + TWO = 2 + + _VALUES_TO_NAMES = { + 1: "ONE", + 2: "TWO", + } + + _NAMES_TO_VALUES = { + "ONE": 1, + "TWO": 2, + } + + +class TTimeRange(object): + """ + Attributes: + - minStamp + - maxStamp + + """ + + + def __init__(self, minStamp=None, maxStamp=None,): + self.minStamp = minStamp + self.maxStamp = maxStamp + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I64: + self.minStamp = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I64: + self.maxStamp = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TTimeRange') + if self.minStamp is not None: + oprot.writeFieldBegin('minStamp', TType.I64, 1) + oprot.writeI64(self.minStamp) + oprot.writeFieldEnd() + if self.maxStamp is not None: + oprot.writeFieldBegin('maxStamp', TType.I64, 2) + oprot.writeI64(self.maxStamp) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.minStamp is None: + raise TProtocolException(message='Required field minStamp is unset!') + if self.maxStamp is None: + raise TProtocolException(message='Required field maxStamp is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumn(object): + """ + Addresses a single cell or multiple cells + in a HBase table by column family and optionally + a column qualifier and timestamp + + Attributes: + - family + - qualifier + - timestamp + + """ + + + def __init__(self, family=None, qualifier=None, timestamp=None,): + self.family = family + self.qualifier = qualifier + self.timestamp = timestamp + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.family = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.timestamp = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TColumn') + if self.family is not None: + oprot.writeFieldBegin('family', TType.STRING, 1) + oprot.writeBinary(self.family) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 2) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + if self.timestamp is not None: + oprot.writeFieldBegin('timestamp', TType.I64, 3) + oprot.writeI64(self.timestamp) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.family is None: + raise TProtocolException(message='Required field family is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumnValue(object): + """ + Represents a single cell and its value. + + Attributes: + - family + - qualifier + - value + - timestamp + - tags + - type + + """ + + + def __init__(self, family=None, qualifier=None, value=None, timestamp=None, tags=None, type=None,): + self.family = family + self.qualifier = qualifier + self.value = value + self.timestamp = timestamp + self.tags = tags + self.type = type + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.family = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.value = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I64: + self.timestamp = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.tags = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.BYTE: + self.type = iprot.readByte() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TColumnValue') + if self.family is not None: + oprot.writeFieldBegin('family', TType.STRING, 1) + oprot.writeBinary(self.family) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 2) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + if self.value is not None: + oprot.writeFieldBegin('value', TType.STRING, 3) + oprot.writeBinary(self.value) + oprot.writeFieldEnd() + if self.timestamp is not None: + oprot.writeFieldBegin('timestamp', TType.I64, 4) + oprot.writeI64(self.timestamp) + oprot.writeFieldEnd() + if self.tags is not None: + oprot.writeFieldBegin('tags', TType.STRING, 5) + oprot.writeBinary(self.tags) + oprot.writeFieldEnd() + if self.type is not None: + oprot.writeFieldBegin('type', TType.BYTE, 6) + oprot.writeByte(self.type) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.family is None: + raise TProtocolException(message='Required field family is unset!') + if self.qualifier is None: + raise TProtocolException(message='Required field qualifier is unset!') + if self.value is None: + raise TProtocolException(message='Required field value is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumnIncrement(object): + """ + Represents a single cell and the amount to increment it by + + Attributes: + - family + - qualifier + - amount + + """ + + + def __init__(self, family=None, qualifier=None, amount=1,): + self.family = family + self.qualifier = qualifier + self.amount = amount + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.family = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.amount = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TColumnIncrement') + if self.family is not None: + oprot.writeFieldBegin('family', TType.STRING, 1) + oprot.writeBinary(self.family) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 2) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + if self.amount is not None: + oprot.writeFieldBegin('amount', TType.I64, 3) + oprot.writeI64(self.amount) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.family is None: + raise TProtocolException(message='Required field family is unset!') + if self.qualifier is None: + raise TProtocolException(message='Required field qualifier is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TResult(object): + """ + if no Result is found, row and columnValues will not be set. + + Attributes: + - row + - columnValues + - stale + - partial + + """ + + + def __init__(self, row=None, columnValues=None, stale=False, partial=False,): + self.row = row + self.columnValues = columnValues + self.stale = stale + self.partial = partial + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columnValues = [] + (_etype3, _size0) = iprot.readListBegin() + for _i4 in range(_size0): + _elem5 = TColumnValue() + _elem5.read(iprot) + self.columnValues.append(_elem5) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.stale = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.BOOL: + self.partial = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TResult') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.columnValues is not None: + oprot.writeFieldBegin('columnValues', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columnValues)) + for iter6 in self.columnValues: + iter6.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.stale is not None: + oprot.writeFieldBegin('stale', TType.BOOL, 3) + oprot.writeBool(self.stale) + oprot.writeFieldEnd() + if self.partial is not None: + oprot.writeFieldBegin('partial', TType.BOOL, 4) + oprot.writeBool(self.partial) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.columnValues is None: + raise TProtocolException(message='Required field columnValues is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TAuthorization(object): + """ + Attributes: + - labels + + """ + + + def __init__(self, labels=None,): + self.labels = labels + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.labels = [] + (_etype10, _size7) = iprot.readListBegin() + for _i11 in range(_size7): + _elem12 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.labels.append(_elem12) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TAuthorization') + if self.labels is not None: + oprot.writeFieldBegin('labels', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.labels)) + for iter13 in self.labels: + oprot.writeString(iter13.encode('utf-8') if sys.version_info[0] == 2 else iter13) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCellVisibility(object): + """ + Attributes: + - expression + + """ + + + def __init__(self, expression=None,): + self.expression = expression + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.expression = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TCellVisibility') + if self.expression is not None: + oprot.writeFieldBegin('expression', TType.STRING, 1) + oprot.writeString(self.expression.encode('utf-8') if sys.version_info[0] == 2 else self.expression) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGet(object): + """ + Used to perform Get operations on a single row. + + The scope can be further narrowed down by specifying a list of + columns or column families. + + To get everything for a row, instantiate a Get object with just the row to get. + To further define the scope of what to get you can add a timestamp or time range + with an optional maximum number of versions to return. + + If you specify a time range and a timestamp the range is ignored. + Timestamps on TColumns are ignored. + + Attributes: + - row + - columns + - timestamp + - timeRange + - maxVersions + - filterString + - attributes + - authorizations + - consistency + - targetReplicaId + - cacheBlocks + - storeLimit + - storeOffset + - existence_only + - filterBytes + + """ + + + def __init__(self, row=None, columns=None, timestamp=None, timeRange=None, maxVersions=None, filterString=None, attributes=None, authorizations=None, consistency=None, targetReplicaId=None, cacheBlocks=None, storeLimit=None, storeOffset=None, existence_only=None, filterBytes=None,): + self.row = row + self.columns = columns + self.timestamp = timestamp + self.timeRange = timeRange + self.maxVersions = maxVersions + self.filterString = filterString + self.attributes = attributes + self.authorizations = authorizations + self.consistency = consistency + self.targetReplicaId = targetReplicaId + self.cacheBlocks = cacheBlocks + self.storeLimit = storeLimit + self.storeOffset = storeOffset + self.existence_only = existence_only + self.filterBytes = filterBytes + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columns = [] + (_etype17, _size14) = iprot.readListBegin() + for _i18 in range(_size14): + _elem19 = TColumn() + _elem19.read(iprot) + self.columns.append(_elem19) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.timestamp = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.timeRange = TTimeRange() + self.timeRange.read(iprot) + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.maxVersions = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.filterString = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.MAP: + self.attributes = {} + (_ktype21, _vtype22, _size20) = iprot.readMapBegin() + for _i24 in range(_size20): + _key25 = iprot.readBinary() + _val26 = iprot.readBinary() + self.attributes[_key25] = _val26 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.STRUCT: + self.authorizations = TAuthorization() + self.authorizations.read(iprot) + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.I32: + self.consistency = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 10: + if ftype == TType.I32: + self.targetReplicaId = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 11: + if ftype == TType.BOOL: + self.cacheBlocks = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 12: + if ftype == TType.I32: + self.storeLimit = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 13: + if ftype == TType.I32: + self.storeOffset = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 14: + if ftype == TType.BOOL: + self.existence_only = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 15: + if ftype == TType.STRING: + self.filterBytes = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TGet') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter27 in self.columns: + iter27.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.timestamp is not None: + oprot.writeFieldBegin('timestamp', TType.I64, 3) + oprot.writeI64(self.timestamp) + oprot.writeFieldEnd() + if self.timeRange is not None: + oprot.writeFieldBegin('timeRange', TType.STRUCT, 4) + self.timeRange.write(oprot) + oprot.writeFieldEnd() + if self.maxVersions is not None: + oprot.writeFieldBegin('maxVersions', TType.I32, 5) + oprot.writeI32(self.maxVersions) + oprot.writeFieldEnd() + if self.filterString is not None: + oprot.writeFieldBegin('filterString', TType.STRING, 6) + oprot.writeBinary(self.filterString) + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 7) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter28, viter29 in self.attributes.items(): + oprot.writeBinary(kiter28) + oprot.writeBinary(viter29) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.authorizations is not None: + oprot.writeFieldBegin('authorizations', TType.STRUCT, 8) + self.authorizations.write(oprot) + oprot.writeFieldEnd() + if self.consistency is not None: + oprot.writeFieldBegin('consistency', TType.I32, 9) + oprot.writeI32(self.consistency) + oprot.writeFieldEnd() + if self.targetReplicaId is not None: + oprot.writeFieldBegin('targetReplicaId', TType.I32, 10) + oprot.writeI32(self.targetReplicaId) + oprot.writeFieldEnd() + if self.cacheBlocks is not None: + oprot.writeFieldBegin('cacheBlocks', TType.BOOL, 11) + oprot.writeBool(self.cacheBlocks) + oprot.writeFieldEnd() + if self.storeLimit is not None: + oprot.writeFieldBegin('storeLimit', TType.I32, 12) + oprot.writeI32(self.storeLimit) + oprot.writeFieldEnd() + if self.storeOffset is not None: + oprot.writeFieldBegin('storeOffset', TType.I32, 13) + oprot.writeI32(self.storeOffset) + oprot.writeFieldEnd() + if self.existence_only is not None: + oprot.writeFieldBegin('existence_only', TType.BOOL, 14) + oprot.writeBool(self.existence_only) + oprot.writeFieldEnd() + if self.filterBytes is not None: + oprot.writeFieldBegin('filterBytes', TType.STRING, 15) + oprot.writeBinary(self.filterBytes) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TPut(object): + """ + Used to perform Put operations for a single row. + + Add column values to this object and they'll be added. + You can provide a default timestamp if the column values + don't have one. If you don't provide a default timestamp + the current time is inserted. + + You can specify how this Put should be written to the write-ahead Log (WAL) + by changing the durability. If you don't provide durability, it defaults to + column family's default setting for durability. + + Attributes: + - row + - columnValues + - timestamp + - attributes + - durability + - cellVisibility + + """ + + + def __init__(self, row=None, columnValues=None, timestamp=None, attributes=None, durability=None, cellVisibility=None,): + self.row = row + self.columnValues = columnValues + self.timestamp = timestamp + self.attributes = attributes + self.durability = durability + self.cellVisibility = cellVisibility + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columnValues = [] + (_etype33, _size30) = iprot.readListBegin() + for _i34 in range(_size30): + _elem35 = TColumnValue() + _elem35.read(iprot) + self.columnValues.append(_elem35) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.timestamp = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.MAP: + self.attributes = {} + (_ktype37, _vtype38, _size36) = iprot.readMapBegin() + for _i40 in range(_size36): + _key41 = iprot.readBinary() + _val42 = iprot.readBinary() + self.attributes[_key41] = _val42 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.durability = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRUCT: + self.cellVisibility = TCellVisibility() + self.cellVisibility.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TPut') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.columnValues is not None: + oprot.writeFieldBegin('columnValues', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columnValues)) + for iter43 in self.columnValues: + iter43.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.timestamp is not None: + oprot.writeFieldBegin('timestamp', TType.I64, 3) + oprot.writeI64(self.timestamp) + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 5) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter44, viter45 in self.attributes.items(): + oprot.writeBinary(kiter44) + oprot.writeBinary(viter45) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.durability is not None: + oprot.writeFieldBegin('durability', TType.I32, 6) + oprot.writeI32(self.durability) + oprot.writeFieldEnd() + if self.cellVisibility is not None: + oprot.writeFieldBegin('cellVisibility', TType.STRUCT, 7) + self.cellVisibility.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.columnValues is None: + raise TProtocolException(message='Required field columnValues is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TDelete(object): + """ + Used to perform Delete operations on a single row. + + The scope can be further narrowed down by specifying a list of + columns or column families as TColumns. + + Specifying only a family in a TColumn will delete the whole family. + If a timestamp is specified all versions with a timestamp less than + or equal to this will be deleted. If no timestamp is specified the + current time will be used. + + Specifying a family and a column qualifier in a TColumn will delete only + this qualifier. If a timestamp is specified only versions equal + to this timestamp will be deleted. If no timestamp is specified the + most recent version will be deleted. To delete all previous versions, + specify the DELETE_COLUMNS TDeleteType. + + The top level timestamp is only used if a complete row should be deleted + (i.e. no columns are passed) and if it is specified it works the same way + as if you had added a TColumn for every column family and this timestamp + (i.e. all versions older than or equal in all column families will be deleted) + + You can specify how this Delete should be written to the write-ahead Log (WAL) + by changing the durability. If you don't provide durability, it defaults to + column family's default setting for durability. + + Attributes: + - row + - columns + - timestamp + - deleteType + - attributes + - durability + + """ + + + def __init__(self, row=None, columns=None, timestamp=None, deleteType=1, attributes=None, durability=None,): + self.row = row + self.columns = columns + self.timestamp = timestamp + self.deleteType = deleteType + self.attributes = attributes + self.durability = durability + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columns = [] + (_etype49, _size46) = iprot.readListBegin() + for _i50 in range(_size46): + _elem51 = TColumn() + _elem51.read(iprot) + self.columns.append(_elem51) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.timestamp = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.deleteType = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.MAP: + self.attributes = {} + (_ktype53, _vtype54, _size52) = iprot.readMapBegin() + for _i56 in range(_size52): + _key57 = iprot.readBinary() + _val58 = iprot.readBinary() + self.attributes[_key57] = _val58 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I32: + self.durability = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TDelete') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter59 in self.columns: + iter59.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.timestamp is not None: + oprot.writeFieldBegin('timestamp', TType.I64, 3) + oprot.writeI64(self.timestamp) + oprot.writeFieldEnd() + if self.deleteType is not None: + oprot.writeFieldBegin('deleteType', TType.I32, 4) + oprot.writeI32(self.deleteType) + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 6) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter60, viter61 in self.attributes.items(): + oprot.writeBinary(kiter60) + oprot.writeBinary(viter61) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.durability is not None: + oprot.writeFieldBegin('durability', TType.I32, 7) + oprot.writeI32(self.durability) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TIncrement(object): + """ + Used to perform Increment operations for a single row. + + You can specify how this Increment should be written to the write-ahead Log (WAL) + by changing the durability. If you don't provide durability, it defaults to + column family's default setting for durability. + + Attributes: + - row + - columns + - attributes + - durability + - cellVisibility + - returnResults + + """ + + + def __init__(self, row=None, columns=None, attributes=None, durability=None, cellVisibility=None, returnResults=None,): + self.row = row + self.columns = columns + self.attributes = attributes + self.durability = durability + self.cellVisibility = cellVisibility + self.returnResults = returnResults + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columns = [] + (_etype65, _size62) = iprot.readListBegin() + for _i66 in range(_size62): + _elem67 = TColumnIncrement() + _elem67.read(iprot) + self.columns.append(_elem67) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.MAP: + self.attributes = {} + (_ktype69, _vtype70, _size68) = iprot.readMapBegin() + for _i72 in range(_size68): + _key73 = iprot.readBinary() + _val74 = iprot.readBinary() + self.attributes[_key73] = _val74 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.durability = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.cellVisibility = TCellVisibility() + self.cellVisibility.read(iprot) + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.BOOL: + self.returnResults = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TIncrement') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter75 in self.columns: + iter75.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 4) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter76, viter77 in self.attributes.items(): + oprot.writeBinary(kiter76) + oprot.writeBinary(viter77) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.durability is not None: + oprot.writeFieldBegin('durability', TType.I32, 5) + oprot.writeI32(self.durability) + oprot.writeFieldEnd() + if self.cellVisibility is not None: + oprot.writeFieldBegin('cellVisibility', TType.STRUCT, 6) + self.cellVisibility.write(oprot) + oprot.writeFieldEnd() + if self.returnResults is not None: + oprot.writeFieldBegin('returnResults', TType.BOOL, 7) + oprot.writeBool(self.returnResults) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.columns is None: + raise TProtocolException(message='Required field columns is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TAppend(object): + """ + Attributes: + - row + - columns + - attributes + - durability + - cellVisibility + - returnResults + + """ + + + def __init__(self, row=None, columns=None, attributes=None, durability=None, cellVisibility=None, returnResults=None,): + self.row = row + self.columns = columns + self.attributes = attributes + self.durability = durability + self.cellVisibility = cellVisibility + self.returnResults = returnResults + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columns = [] + (_etype81, _size78) = iprot.readListBegin() + for _i82 in range(_size78): + _elem83 = TColumnValue() + _elem83.read(iprot) + self.columns.append(_elem83) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.MAP: + self.attributes = {} + (_ktype85, _vtype86, _size84) = iprot.readMapBegin() + for _i88 in range(_size84): + _key89 = iprot.readBinary() + _val90 = iprot.readBinary() + self.attributes[_key89] = _val90 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.durability = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.cellVisibility = TCellVisibility() + self.cellVisibility.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.BOOL: + self.returnResults = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TAppend') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter91 in self.columns: + iter91.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 3) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter92, viter93 in self.attributes.items(): + oprot.writeBinary(kiter92) + oprot.writeBinary(viter93) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.durability is not None: + oprot.writeFieldBegin('durability', TType.I32, 4) + oprot.writeI32(self.durability) + oprot.writeFieldEnd() + if self.cellVisibility is not None: + oprot.writeFieldBegin('cellVisibility', TType.STRUCT, 5) + self.cellVisibility.write(oprot) + oprot.writeFieldEnd() + if self.returnResults is not None: + oprot.writeFieldBegin('returnResults', TType.BOOL, 6) + oprot.writeBool(self.returnResults) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.columns is None: + raise TProtocolException(message='Required field columns is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TScan(object): + """ + Any timestamps in the columns are ignored but the colFamTimeRangeMap included, use timeRange to select by timestamp. + Max versions defaults to 1. + + Attributes: + - startRow + - stopRow + - columns + - caching + - maxVersions + - timeRange + - filterString + - batchSize + - attributes + - authorizations + - reversed + - cacheBlocks + - colFamTimeRangeMap + - readType + - limit + - consistency + - targetReplicaId + - filterBytes + + """ + + + def __init__(self, startRow=None, stopRow=None, columns=None, caching=None, maxVersions=1, timeRange=None, filterString=None, batchSize=None, attributes=None, authorizations=None, reversed=None, cacheBlocks=None, colFamTimeRangeMap=None, readType=None, limit=None, consistency=None, targetReplicaId=None, filterBytes=None,): + self.startRow = startRow + self.stopRow = stopRow + self.columns = columns + self.caching = caching + self.maxVersions = maxVersions + self.timeRange = timeRange + self.filterString = filterString + self.batchSize = batchSize + self.attributes = attributes + self.authorizations = authorizations + self.reversed = reversed + self.cacheBlocks = cacheBlocks + self.colFamTimeRangeMap = colFamTimeRangeMap + self.readType = readType + self.limit = limit + self.consistency = consistency + self.targetReplicaId = targetReplicaId + self.filterBytes = filterBytes + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.startRow = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.stopRow = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.columns = [] + (_etype97, _size94) = iprot.readListBegin() + for _i98 in range(_size94): + _elem99 = TColumn() + _elem99.read(iprot) + self.columns.append(_elem99) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.caching = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.maxVersions = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.timeRange = TTimeRange() + self.timeRange.read(iprot) + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRING: + self.filterString = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.I32: + self.batchSize = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.MAP: + self.attributes = {} + (_ktype101, _vtype102, _size100) = iprot.readMapBegin() + for _i104 in range(_size100): + _key105 = iprot.readBinary() + _val106 = iprot.readBinary() + self.attributes[_key105] = _val106 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 10: + if ftype == TType.STRUCT: + self.authorizations = TAuthorization() + self.authorizations.read(iprot) + else: + iprot.skip(ftype) + elif fid == 11: + if ftype == TType.BOOL: + self.reversed = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 12: + if ftype == TType.BOOL: + self.cacheBlocks = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 13: + if ftype == TType.MAP: + self.colFamTimeRangeMap = {} + (_ktype108, _vtype109, _size107) = iprot.readMapBegin() + for _i111 in range(_size107): + _key112 = iprot.readBinary() + _val113 = TTimeRange() + _val113.read(iprot) + self.colFamTimeRangeMap[_key112] = _val113 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 14: + if ftype == TType.I32: + self.readType = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 15: + if ftype == TType.I32: + self.limit = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 16: + if ftype == TType.I32: + self.consistency = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 17: + if ftype == TType.I32: + self.targetReplicaId = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 18: + if ftype == TType.STRING: + self.filterBytes = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TScan') + if self.startRow is not None: + oprot.writeFieldBegin('startRow', TType.STRING, 1) + oprot.writeBinary(self.startRow) + oprot.writeFieldEnd() + if self.stopRow is not None: + oprot.writeFieldBegin('stopRow', TType.STRING, 2) + oprot.writeBinary(self.stopRow) + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 3) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter114 in self.columns: + iter114.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.caching is not None: + oprot.writeFieldBegin('caching', TType.I32, 4) + oprot.writeI32(self.caching) + oprot.writeFieldEnd() + if self.maxVersions is not None: + oprot.writeFieldBegin('maxVersions', TType.I32, 5) + oprot.writeI32(self.maxVersions) + oprot.writeFieldEnd() + if self.timeRange is not None: + oprot.writeFieldBegin('timeRange', TType.STRUCT, 6) + self.timeRange.write(oprot) + oprot.writeFieldEnd() + if self.filterString is not None: + oprot.writeFieldBegin('filterString', TType.STRING, 7) + oprot.writeBinary(self.filterString) + oprot.writeFieldEnd() + if self.batchSize is not None: + oprot.writeFieldBegin('batchSize', TType.I32, 8) + oprot.writeI32(self.batchSize) + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 9) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter115, viter116 in self.attributes.items(): + oprot.writeBinary(kiter115) + oprot.writeBinary(viter116) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.authorizations is not None: + oprot.writeFieldBegin('authorizations', TType.STRUCT, 10) + self.authorizations.write(oprot) + oprot.writeFieldEnd() + if self.reversed is not None: + oprot.writeFieldBegin('reversed', TType.BOOL, 11) + oprot.writeBool(self.reversed) + oprot.writeFieldEnd() + if self.cacheBlocks is not None: + oprot.writeFieldBegin('cacheBlocks', TType.BOOL, 12) + oprot.writeBool(self.cacheBlocks) + oprot.writeFieldEnd() + if self.colFamTimeRangeMap is not None: + oprot.writeFieldBegin('colFamTimeRangeMap', TType.MAP, 13) + oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(self.colFamTimeRangeMap)) + for kiter117, viter118 in self.colFamTimeRangeMap.items(): + oprot.writeBinary(kiter117) + viter118.write(oprot) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.readType is not None: + oprot.writeFieldBegin('readType', TType.I32, 14) + oprot.writeI32(self.readType) + oprot.writeFieldEnd() + if self.limit is not None: + oprot.writeFieldBegin('limit', TType.I32, 15) + oprot.writeI32(self.limit) + oprot.writeFieldEnd() + if self.consistency is not None: + oprot.writeFieldBegin('consistency', TType.I32, 16) + oprot.writeI32(self.consistency) + oprot.writeFieldEnd() + if self.targetReplicaId is not None: + oprot.writeFieldBegin('targetReplicaId', TType.I32, 17) + oprot.writeI32(self.targetReplicaId) + oprot.writeFieldEnd() + if self.filterBytes is not None: + oprot.writeFieldBegin('filterBytes', TType.STRING, 18) + oprot.writeBinary(self.filterBytes) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TMutation(object): + """ + Atomic mutation for the specified row. It can be either Put or Delete. + + Attributes: + - put + - deleteSingle + + """ + + + def __init__(self, put=None, deleteSingle=None,): + self.put = put + self.deleteSingle = deleteSingle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.put = TPut() + self.put.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.deleteSingle = TDelete() + self.deleteSingle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TMutation') + if self.put is not None: + oprot.writeFieldBegin('put', TType.STRUCT, 1) + self.put.write(oprot) + oprot.writeFieldEnd() + if self.deleteSingle is not None: + oprot.writeFieldBegin('deleteSingle', TType.STRUCT, 2) + self.deleteSingle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TRowMutations(object): + """ + A TRowMutations object is used to apply a number of Mutations to a single row. + + Attributes: + - row + - mutations + + """ + + + def __init__(self, row=None, mutations=None,): + self.row = row + self.mutations = mutations + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.row = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.mutations = [] + (_etype122, _size119) = iprot.readListBegin() + for _i123 in range(_size119): + _elem124 = TMutation() + _elem124.read(iprot) + self.mutations.append(_elem124) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TRowMutations') + if self.row is not None: + oprot.writeFieldBegin('row', TType.STRING, 1) + oprot.writeBinary(self.row) + oprot.writeFieldEnd() + if self.mutations is not None: + oprot.writeFieldBegin('mutations', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.mutations)) + for iter125 in self.mutations: + iter125.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.row is None: + raise TProtocolException(message='Required field row is unset!') + if self.mutations is None: + raise TProtocolException(message='Required field mutations is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class THRegionInfo(object): + """ + Attributes: + - regionId + - tableName + - startKey + - endKey + - offline + - split + - replicaId + + """ + + + def __init__(self, regionId=None, tableName=None, startKey=None, endKey=None, offline=None, split=None, replicaId=None,): + self.regionId = regionId + self.tableName = tableName + self.startKey = startKey + self.endKey = endKey + self.offline = offline + self.split = split + self.replicaId = replicaId + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I64: + self.regionId = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.tableName = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.startKey = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.endKey = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.BOOL: + self.offline = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.BOOL: + self.split = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I32: + self.replicaId = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('THRegionInfo') + if self.regionId is not None: + oprot.writeFieldBegin('regionId', TType.I64, 1) + oprot.writeI64(self.regionId) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRING, 2) + oprot.writeBinary(self.tableName) + oprot.writeFieldEnd() + if self.startKey is not None: + oprot.writeFieldBegin('startKey', TType.STRING, 3) + oprot.writeBinary(self.startKey) + oprot.writeFieldEnd() + if self.endKey is not None: + oprot.writeFieldBegin('endKey', TType.STRING, 4) + oprot.writeBinary(self.endKey) + oprot.writeFieldEnd() + if self.offline is not None: + oprot.writeFieldBegin('offline', TType.BOOL, 5) + oprot.writeBool(self.offline) + oprot.writeFieldEnd() + if self.split is not None: + oprot.writeFieldBegin('split', TType.BOOL, 6) + oprot.writeBool(self.split) + oprot.writeFieldEnd() + if self.replicaId is not None: + oprot.writeFieldBegin('replicaId', TType.I32, 7) + oprot.writeI32(self.replicaId) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.regionId is None: + raise TProtocolException(message='Required field regionId is unset!') + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TServerName(object): + """ + Attributes: + - hostName + - port + - startCode + + """ + + + def __init__(self, hostName=None, port=None, startCode=None,): + self.hostName = hostName + self.port = port + self.startCode = startCode + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.hostName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.port = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.startCode = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TServerName') + if self.hostName is not None: + oprot.writeFieldBegin('hostName', TType.STRING, 1) + oprot.writeString(self.hostName.encode('utf-8') if sys.version_info[0] == 2 else self.hostName) + oprot.writeFieldEnd() + if self.port is not None: + oprot.writeFieldBegin('port', TType.I32, 2) + oprot.writeI32(self.port) + oprot.writeFieldEnd() + if self.startCode is not None: + oprot.writeFieldBegin('startCode', TType.I64, 3) + oprot.writeI64(self.startCode) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.hostName is None: + raise TProtocolException(message='Required field hostName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class THRegionLocation(object): + """ + Attributes: + - serverName + - regionInfo + + """ + + + def __init__(self, serverName=None, regionInfo=None,): + self.serverName = serverName + self.regionInfo = regionInfo + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.serverName = TServerName() + self.serverName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.regionInfo = THRegionInfo() + self.regionInfo.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('THRegionLocation') + if self.serverName is not None: + oprot.writeFieldBegin('serverName', TType.STRUCT, 1) + self.serverName.write(oprot) + oprot.writeFieldEnd() + if self.regionInfo is not None: + oprot.writeFieldBegin('regionInfo', TType.STRUCT, 2) + self.regionInfo.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.serverName is None: + raise TProtocolException(message='Required field serverName is unset!') + if self.regionInfo is None: + raise TProtocolException(message='Required field regionInfo is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TTableName(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.TableName + + Attributes: + - ns: namespace name + - qualifier: tablename + + """ + + + def __init__(self, ns=None, qualifier=None,): + self.ns = ns + self.qualifier = qualifier + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.ns = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.qualifier = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TTableName') + if self.ns is not None: + oprot.writeFieldBegin('ns', TType.STRING, 1) + oprot.writeBinary(self.ns) + oprot.writeFieldEnd() + if self.qualifier is not None: + oprot.writeFieldBegin('qualifier', TType.STRING, 2) + oprot.writeBinary(self.qualifier) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.qualifier is None: + raise TProtocolException(message='Required field qualifier is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumnFamilyDescriptor(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.client.ColumnFamilyDescriptor + + Attributes: + - name + - attributes + - configuration + - blockSize + - bloomnFilterType + - compressionType + - dfsReplication + - dataBlockEncoding + - keepDeletedCells + - maxVersions + - minVersions + - scope + - timeToLive + - blockCacheEnabled + - cacheBloomsOnWrite + - cacheDataOnWrite + - cacheIndexesOnWrite + - compressTags + - evictBlocksOnClose + - inMemory + + """ + + + def __init__(self, name=None, attributes=None, configuration=None, blockSize=None, bloomnFilterType=None, compressionType=None, dfsReplication=None, dataBlockEncoding=None, keepDeletedCells=None, maxVersions=None, minVersions=None, scope=None, timeToLive=None, blockCacheEnabled=None, cacheBloomsOnWrite=None, cacheDataOnWrite=None, cacheIndexesOnWrite=None, compressTags=None, evictBlocksOnClose=None, inMemory=None,): + self.name = name + self.attributes = attributes + self.configuration = configuration + self.blockSize = blockSize + self.bloomnFilterType = bloomnFilterType + self.compressionType = compressionType + self.dfsReplication = dfsReplication + self.dataBlockEncoding = dataBlockEncoding + self.keepDeletedCells = keepDeletedCells + self.maxVersions = maxVersions + self.minVersions = minVersions + self.scope = scope + self.timeToLive = timeToLive + self.blockCacheEnabled = blockCacheEnabled + self.cacheBloomsOnWrite = cacheBloomsOnWrite + self.cacheDataOnWrite = cacheDataOnWrite + self.cacheIndexesOnWrite = cacheIndexesOnWrite + self.compressTags = compressTags + self.evictBlocksOnClose = evictBlocksOnClose + self.inMemory = inMemory + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.MAP: + self.attributes = {} + (_ktype127, _vtype128, _size126) = iprot.readMapBegin() + for _i130 in range(_size126): + _key131 = iprot.readBinary() + _val132 = iprot.readBinary() + self.attributes[_key131] = _val132 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.MAP: + self.configuration = {} + (_ktype134, _vtype135, _size133) = iprot.readMapBegin() + for _i137 in range(_size133): + _key138 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val139 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.configuration[_key138] = _val139 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.blockSize = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.bloomnFilterType = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.compressionType = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I16: + self.dfsReplication = iprot.readI16() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.I32: + self.dataBlockEncoding = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.I32: + self.keepDeletedCells = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 10: + if ftype == TType.I32: + self.maxVersions = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 11: + if ftype == TType.I32: + self.minVersions = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 12: + if ftype == TType.I32: + self.scope = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 13: + if ftype == TType.I32: + self.timeToLive = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 14: + if ftype == TType.BOOL: + self.blockCacheEnabled = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 15: + if ftype == TType.BOOL: + self.cacheBloomsOnWrite = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 16: + if ftype == TType.BOOL: + self.cacheDataOnWrite = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 17: + if ftype == TType.BOOL: + self.cacheIndexesOnWrite = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 18: + if ftype == TType.BOOL: + self.compressTags = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 19: + if ftype == TType.BOOL: + self.evictBlocksOnClose = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 20: + if ftype == TType.BOOL: + self.inMemory = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TColumnFamilyDescriptor') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeBinary(self.name) + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 2) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter140, viter141 in self.attributes.items(): + oprot.writeBinary(kiter140) + oprot.writeBinary(viter141) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.configuration is not None: + oprot.writeFieldBegin('configuration', TType.MAP, 3) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) + for kiter142, viter143 in self.configuration.items(): + oprot.writeString(kiter142.encode('utf-8') if sys.version_info[0] == 2 else kiter142) + oprot.writeString(viter143.encode('utf-8') if sys.version_info[0] == 2 else viter143) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.blockSize is not None: + oprot.writeFieldBegin('blockSize', TType.I32, 4) + oprot.writeI32(self.blockSize) + oprot.writeFieldEnd() + if self.bloomnFilterType is not None: + oprot.writeFieldBegin('bloomnFilterType', TType.I32, 5) + oprot.writeI32(self.bloomnFilterType) + oprot.writeFieldEnd() + if self.compressionType is not None: + oprot.writeFieldBegin('compressionType', TType.I32, 6) + oprot.writeI32(self.compressionType) + oprot.writeFieldEnd() + if self.dfsReplication is not None: + oprot.writeFieldBegin('dfsReplication', TType.I16, 7) + oprot.writeI16(self.dfsReplication) + oprot.writeFieldEnd() + if self.dataBlockEncoding is not None: + oprot.writeFieldBegin('dataBlockEncoding', TType.I32, 8) + oprot.writeI32(self.dataBlockEncoding) + oprot.writeFieldEnd() + if self.keepDeletedCells is not None: + oprot.writeFieldBegin('keepDeletedCells', TType.I32, 9) + oprot.writeI32(self.keepDeletedCells) + oprot.writeFieldEnd() + if self.maxVersions is not None: + oprot.writeFieldBegin('maxVersions', TType.I32, 10) + oprot.writeI32(self.maxVersions) + oprot.writeFieldEnd() + if self.minVersions is not None: + oprot.writeFieldBegin('minVersions', TType.I32, 11) + oprot.writeI32(self.minVersions) + oprot.writeFieldEnd() + if self.scope is not None: + oprot.writeFieldBegin('scope', TType.I32, 12) + oprot.writeI32(self.scope) + oprot.writeFieldEnd() + if self.timeToLive is not None: + oprot.writeFieldBegin('timeToLive', TType.I32, 13) + oprot.writeI32(self.timeToLive) + oprot.writeFieldEnd() + if self.blockCacheEnabled is not None: + oprot.writeFieldBegin('blockCacheEnabled', TType.BOOL, 14) + oprot.writeBool(self.blockCacheEnabled) + oprot.writeFieldEnd() + if self.cacheBloomsOnWrite is not None: + oprot.writeFieldBegin('cacheBloomsOnWrite', TType.BOOL, 15) + oprot.writeBool(self.cacheBloomsOnWrite) + oprot.writeFieldEnd() + if self.cacheDataOnWrite is not None: + oprot.writeFieldBegin('cacheDataOnWrite', TType.BOOL, 16) + oprot.writeBool(self.cacheDataOnWrite) + oprot.writeFieldEnd() + if self.cacheIndexesOnWrite is not None: + oprot.writeFieldBegin('cacheIndexesOnWrite', TType.BOOL, 17) + oprot.writeBool(self.cacheIndexesOnWrite) + oprot.writeFieldEnd() + if self.compressTags is not None: + oprot.writeFieldBegin('compressTags', TType.BOOL, 18) + oprot.writeBool(self.compressTags) + oprot.writeFieldEnd() + if self.evictBlocksOnClose is not None: + oprot.writeFieldBegin('evictBlocksOnClose', TType.BOOL, 19) + oprot.writeBool(self.evictBlocksOnClose) + oprot.writeFieldEnd() + if self.inMemory is not None: + oprot.writeFieldBegin('inMemory', TType.BOOL, 20) + oprot.writeBool(self.inMemory) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.name is None: + raise TProtocolException(message='Required field name is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TAccessControlEntity(object): + """ + TAccessControlEntity + + Attributes: + - username + - scope + - op + - actions + - tableName + - nsName + + """ + + + def __init__(self, username=None, scope=None, op=None, actions=None, tableName=None, nsName=None,): + self.username = username + self.scope = scope + self.op = op + self.actions = actions + self.tableName = tableName + self.nsName = nsName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.scope = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.op = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.actions = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.nsName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TAccessControlEntity') + if self.username is not None: + oprot.writeFieldBegin('username', TType.STRING, 1) + oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username) + oprot.writeFieldEnd() + if self.scope is not None: + oprot.writeFieldBegin('scope', TType.I32, 2) + oprot.writeI32(self.scope) + oprot.writeFieldEnd() + if self.op is not None: + oprot.writeFieldBegin('op', TType.I32, 3) + oprot.writeI32(self.op) + oprot.writeFieldEnd() + if self.actions is not None: + oprot.writeFieldBegin('actions', TType.STRING, 4) + oprot.writeString(self.actions.encode('utf-8') if sys.version_info[0] == 2 else self.actions) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 5) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.nsName is not None: + oprot.writeFieldBegin('nsName', TType.STRING, 6) + oprot.writeString(self.nsName.encode('utf-8') if sys.version_info[0] == 2 else self.nsName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.username is None: + raise TProtocolException(message='Required field username is unset!') + if self.scope is None: + raise TProtocolException(message='Required field scope is unset!') + if self.op is None: + raise TProtocolException(message='Required field op is unset!') + if self.actions is None: + raise TProtocolException(message='Required field actions is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TTableDescriptor(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.client.TableDescriptor + + Attributes: + - tableName + - columns + - attributes + - durability + + """ + + + def __init__(self, tableName=None, columns=None, attributes=None, durability=None,): + self.tableName = tableName + self.columns = columns + self.attributes = attributes + self.durability = durability + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.tableName = TTableName() + self.tableName.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.columns = [] + (_etype147, _size144) = iprot.readListBegin() + for _i148 in range(_size144): + _elem149 = TColumnFamilyDescriptor() + _elem149.read(iprot) + self.columns.append(_elem149) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.MAP: + self.attributes = {} + (_ktype151, _vtype152, _size150) = iprot.readMapBegin() + for _i154 in range(_size150): + _key155 = iprot.readBinary() + _val156 = iprot.readBinary() + self.attributes[_key155] = _val156 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.durability = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TTableDescriptor') + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRUCT, 1) + self.tableName.write(oprot) + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter157 in self.columns: + iter157.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.attributes is not None: + oprot.writeFieldBegin('attributes', TType.MAP, 3) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.attributes)) + for kiter158, viter159 in self.attributes.items(): + oprot.writeBinary(kiter158) + oprot.writeBinary(viter159) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.durability is not None: + oprot.writeFieldBegin('durability', TType.I32, 4) + oprot.writeI32(self.durability) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.tableName is None: + raise TProtocolException(message='Required field tableName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TNamespaceDescriptor(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.NamespaceDescriptor + + Attributes: + - name + - configuration + + """ + + + def __init__(self, name=None, configuration=None,): + self.name = name + self.configuration = configuration + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.MAP: + self.configuration = {} + (_ktype161, _vtype162, _size160) = iprot.readMapBegin() + for _i164 in range(_size160): + _key165 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val166 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.configuration[_key165] = _val166 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TNamespaceDescriptor') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) + oprot.writeFieldEnd() + if self.configuration is not None: + oprot.writeFieldBegin('configuration', TType.MAP, 2) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) + for kiter167, viter168 in self.configuration.items(): + oprot.writeString(kiter167.encode('utf-8') if sys.version_info[0] == 2 else kiter167) + oprot.writeString(viter168.encode('utf-8') if sys.version_info[0] == 2 else viter168) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.name is None: + raise TProtocolException(message='Required field name is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TLogQueryFilter(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.client.LogQueryFilter + + Attributes: + - regionName + - clientAddress + - tableName + - userName + - limit + - logType + - filterByOperator + + """ + + + def __init__(self, regionName=None, clientAddress=None, tableName=None, userName=None, limit=10, logType=1, filterByOperator=1,): + self.regionName = regionName + self.clientAddress = clientAddress + self.tableName = tableName + self.userName = userName + self.limit = limit + self.logType = logType + self.filterByOperator = filterByOperator + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.regionName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.clientAddress = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.tableName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.userName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.limit = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.logType = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I32: + self.filterByOperator = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TLogQueryFilter') + if self.regionName is not None: + oprot.writeFieldBegin('regionName', TType.STRING, 1) + oprot.writeString(self.regionName.encode('utf-8') if sys.version_info[0] == 2 else self.regionName) + oprot.writeFieldEnd() + if self.clientAddress is not None: + oprot.writeFieldBegin('clientAddress', TType.STRING, 2) + oprot.writeString(self.clientAddress.encode('utf-8') if sys.version_info[0] == 2 else self.clientAddress) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRING, 3) + oprot.writeString(self.tableName.encode('utf-8') if sys.version_info[0] == 2 else self.tableName) + oprot.writeFieldEnd() + if self.userName is not None: + oprot.writeFieldBegin('userName', TType.STRING, 4) + oprot.writeString(self.userName.encode('utf-8') if sys.version_info[0] == 2 else self.userName) + oprot.writeFieldEnd() + if self.limit is not None: + oprot.writeFieldBegin('limit', TType.I32, 5) + oprot.writeI32(self.limit) + oprot.writeFieldEnd() + if self.logType is not None: + oprot.writeFieldBegin('logType', TType.I32, 6) + oprot.writeI32(self.logType) + oprot.writeFieldEnd() + if self.filterByOperator is not None: + oprot.writeFieldBegin('filterByOperator', TType.I32, 7) + oprot.writeI32(self.filterByOperator) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TOnlineLogRecord(object): + """ + Thrift wrapper around + org.apache.hadoop.hbase.client.OnlineLogRecordrd + + Attributes: + - startTime + - processingTime + - queueTime + - responseSize + - clientAddress + - serverClass + - methodName + - callDetails + - param + - userName + - multiGetsCount + - multiMutationsCount + - multiServiceCalls + - regionName + + """ + + + def __init__(self, startTime=None, processingTime=None, queueTime=None, responseSize=None, clientAddress=None, serverClass=None, methodName=None, callDetails=None, param=None, userName=None, multiGetsCount=None, multiMutationsCount=None, multiServiceCalls=None, regionName=None,): + self.startTime = startTime + self.processingTime = processingTime + self.queueTime = queueTime + self.responseSize = responseSize + self.clientAddress = clientAddress + self.serverClass = serverClass + self.methodName = methodName + self.callDetails = callDetails + self.param = param + self.userName = userName + self.multiGetsCount = multiGetsCount + self.multiMutationsCount = multiMutationsCount + self.multiServiceCalls = multiServiceCalls + self.regionName = regionName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I64: + self.startTime = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.processingTime = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.queueTime = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I64: + self.responseSize = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.clientAddress = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.serverClass = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRING: + self.methodName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.STRING: + self.callDetails = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.STRING: + self.param = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 10: + if ftype == TType.STRING: + self.userName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 11: + if ftype == TType.I32: + self.multiGetsCount = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 12: + if ftype == TType.I32: + self.multiMutationsCount = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 13: + if ftype == TType.I32: + self.multiServiceCalls = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 14: + if ftype == TType.STRING: + self.regionName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TOnlineLogRecord') + if self.startTime is not None: + oprot.writeFieldBegin('startTime', TType.I64, 1) + oprot.writeI64(self.startTime) + oprot.writeFieldEnd() + if self.processingTime is not None: + oprot.writeFieldBegin('processingTime', TType.I32, 2) + oprot.writeI32(self.processingTime) + oprot.writeFieldEnd() + if self.queueTime is not None: + oprot.writeFieldBegin('queueTime', TType.I32, 3) + oprot.writeI32(self.queueTime) + oprot.writeFieldEnd() + if self.responseSize is not None: + oprot.writeFieldBegin('responseSize', TType.I64, 4) + oprot.writeI64(self.responseSize) + oprot.writeFieldEnd() + if self.clientAddress is not None: + oprot.writeFieldBegin('clientAddress', TType.STRING, 5) + oprot.writeString(self.clientAddress.encode('utf-8') if sys.version_info[0] == 2 else self.clientAddress) + oprot.writeFieldEnd() + if self.serverClass is not None: + oprot.writeFieldBegin('serverClass', TType.STRING, 6) + oprot.writeString(self.serverClass.encode('utf-8') if sys.version_info[0] == 2 else self.serverClass) + oprot.writeFieldEnd() + if self.methodName is not None: + oprot.writeFieldBegin('methodName', TType.STRING, 7) + oprot.writeString(self.methodName.encode('utf-8') if sys.version_info[0] == 2 else self.methodName) + oprot.writeFieldEnd() + if self.callDetails is not None: + oprot.writeFieldBegin('callDetails', TType.STRING, 8) + oprot.writeString(self.callDetails.encode('utf-8') if sys.version_info[0] == 2 else self.callDetails) + oprot.writeFieldEnd() + if self.param is not None: + oprot.writeFieldBegin('param', TType.STRING, 9) + oprot.writeString(self.param.encode('utf-8') if sys.version_info[0] == 2 else self.param) + oprot.writeFieldEnd() + if self.userName is not None: + oprot.writeFieldBegin('userName', TType.STRING, 10) + oprot.writeString(self.userName.encode('utf-8') if sys.version_info[0] == 2 else self.userName) + oprot.writeFieldEnd() + if self.multiGetsCount is not None: + oprot.writeFieldBegin('multiGetsCount', TType.I32, 11) + oprot.writeI32(self.multiGetsCount) + oprot.writeFieldEnd() + if self.multiMutationsCount is not None: + oprot.writeFieldBegin('multiMutationsCount', TType.I32, 12) + oprot.writeI32(self.multiMutationsCount) + oprot.writeFieldEnd() + if self.multiServiceCalls is not None: + oprot.writeFieldBegin('multiServiceCalls', TType.I32, 13) + oprot.writeI32(self.multiServiceCalls) + oprot.writeFieldEnd() + if self.regionName is not None: + oprot.writeFieldBegin('regionName', TType.STRING, 14) + oprot.writeString(self.regionName.encode('utf-8') if sys.version_info[0] == 2 else self.regionName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.startTime is None: + raise TProtocolException(message='Required field startTime is unset!') + if self.processingTime is None: + raise TProtocolException(message='Required field processingTime is unset!') + if self.queueTime is None: + raise TProtocolException(message='Required field queueTime is unset!') + if self.responseSize is None: + raise TProtocolException(message='Required field responseSize is unset!') + if self.clientAddress is None: + raise TProtocolException(message='Required field clientAddress is unset!') + if self.serverClass is None: + raise TProtocolException(message='Required field serverClass is unset!') + if self.methodName is None: + raise TProtocolException(message='Required field methodName is unset!') + if self.callDetails is None: + raise TProtocolException(message='Required field callDetails is unset!') + if self.param is None: + raise TProtocolException(message='Required field param is unset!') + if self.userName is None: + raise TProtocolException(message='Required field userName is unset!') + if self.multiGetsCount is None: + raise TProtocolException(message='Required field multiGetsCount is unset!') + if self.multiMutationsCount is None: + raise TProtocolException(message='Required field multiMutationsCount is unset!') + if self.multiServiceCalls is None: + raise TProtocolException(message='Required field multiServiceCalls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TIOError(TException): + """ + A TIOError exception signals that an error occurred communicating + to the HBase master or a HBase region server. Also used to return + more general HBase error conditions. + + Attributes: + - message + - canRetry + + """ + + + def __init__(self, message=None, canRetry=None,): + self.message = message + self.canRetry = canRetry + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.canRetry = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TIOError') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message) + oprot.writeFieldEnd() + if self.canRetry is not None: + oprot.writeFieldBegin('canRetry', TType.BOOL, 2) + oprot.writeBool(self.canRetry) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TIllegalArgument(TException): + """ + A TIllegalArgument exception indicates an illegal or invalid + argument was passed into a procedure. + + Attributes: + - message + + """ + + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('TIllegalArgument') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(TTimeRange) +TTimeRange.thrift_spec = ( + None, # 0 + (1, TType.I64, 'minStamp', None, None, ), # 1 + (2, TType.I64, 'maxStamp', None, None, ), # 2 +) +all_structs.append(TColumn) +TColumn.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'family', 'BINARY', None, ), # 1 + (2, TType.STRING, 'qualifier', 'BINARY', None, ), # 2 + (3, TType.I64, 'timestamp', None, None, ), # 3 +) +all_structs.append(TColumnValue) +TColumnValue.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'family', 'BINARY', None, ), # 1 + (2, TType.STRING, 'qualifier', 'BINARY', None, ), # 2 + (3, TType.STRING, 'value', 'BINARY', None, ), # 3 + (4, TType.I64, 'timestamp', None, None, ), # 4 + (5, TType.STRING, 'tags', 'BINARY', None, ), # 5 + (6, TType.BYTE, 'type', None, None, ), # 6 +) +all_structs.append(TColumnIncrement) +TColumnIncrement.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'family', 'BINARY', None, ), # 1 + (2, TType.STRING, 'qualifier', 'BINARY', None, ), # 2 + (3, TType.I64, 'amount', None, 1, ), # 3 +) +all_structs.append(TResult) +TResult.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'columnValues', (TType.STRUCT, [TColumnValue, None], False), None, ), # 2 + (3, TType.BOOL, 'stale', None, False, ), # 3 + (4, TType.BOOL, 'partial', None, False, ), # 4 +) +all_structs.append(TAuthorization) +TAuthorization.thrift_spec = ( + None, # 0 + (1, TType.LIST, 'labels', (TType.STRING, 'UTF8', False), None, ), # 1 +) +all_structs.append(TCellVisibility) +TCellVisibility.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'expression', 'UTF8', None, ), # 1 +) +all_structs.append(TGet) +TGet.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'columns', (TType.STRUCT, [TColumn, None], False), None, ), # 2 + (3, TType.I64, 'timestamp', None, None, ), # 3 + (4, TType.STRUCT, 'timeRange', [TTimeRange, None], None, ), # 4 + (5, TType.I32, 'maxVersions', None, None, ), # 5 + (6, TType.STRING, 'filterString', 'BINARY', None, ), # 6 + (7, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 7 + (8, TType.STRUCT, 'authorizations', [TAuthorization, None], None, ), # 8 + (9, TType.I32, 'consistency', None, None, ), # 9 + (10, TType.I32, 'targetReplicaId', None, None, ), # 10 + (11, TType.BOOL, 'cacheBlocks', None, None, ), # 11 + (12, TType.I32, 'storeLimit', None, None, ), # 12 + (13, TType.I32, 'storeOffset', None, None, ), # 13 + (14, TType.BOOL, 'existence_only', None, None, ), # 14 + (15, TType.STRING, 'filterBytes', 'BINARY', None, ), # 15 +) +all_structs.append(TPut) +TPut.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'columnValues', (TType.STRUCT, [TColumnValue, None], False), None, ), # 2 + (3, TType.I64, 'timestamp', None, None, ), # 3 + None, # 4 + (5, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 5 + (6, TType.I32, 'durability', None, None, ), # 6 + (7, TType.STRUCT, 'cellVisibility', [TCellVisibility, None], None, ), # 7 +) +all_structs.append(TDelete) +TDelete.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'columns', (TType.STRUCT, [TColumn, None], False), None, ), # 2 + (3, TType.I64, 'timestamp', None, None, ), # 3 + (4, TType.I32, 'deleteType', None, 1, ), # 4 + None, # 5 + (6, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 6 + (7, TType.I32, 'durability', None, None, ), # 7 +) +all_structs.append(TIncrement) +TIncrement.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'columns', (TType.STRUCT, [TColumnIncrement, None], False), None, ), # 2 + None, # 3 + (4, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 4 + (5, TType.I32, 'durability', None, None, ), # 5 + (6, TType.STRUCT, 'cellVisibility', [TCellVisibility, None], None, ), # 6 + (7, TType.BOOL, 'returnResults', None, None, ), # 7 +) +all_structs.append(TAppend) +TAppend.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'columns', (TType.STRUCT, [TColumnValue, None], False), None, ), # 2 + (3, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 3 + (4, TType.I32, 'durability', None, None, ), # 4 + (5, TType.STRUCT, 'cellVisibility', [TCellVisibility, None], None, ), # 5 + (6, TType.BOOL, 'returnResults', None, None, ), # 6 +) +all_structs.append(TScan) +TScan.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'startRow', 'BINARY', None, ), # 1 + (2, TType.STRING, 'stopRow', 'BINARY', None, ), # 2 + (3, TType.LIST, 'columns', (TType.STRUCT, [TColumn, None], False), None, ), # 3 + (4, TType.I32, 'caching', None, None, ), # 4 + (5, TType.I32, 'maxVersions', None, 1, ), # 5 + (6, TType.STRUCT, 'timeRange', [TTimeRange, None], None, ), # 6 + (7, TType.STRING, 'filterString', 'BINARY', None, ), # 7 + (8, TType.I32, 'batchSize', None, None, ), # 8 + (9, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 9 + (10, TType.STRUCT, 'authorizations', [TAuthorization, None], None, ), # 10 + (11, TType.BOOL, 'reversed', None, None, ), # 11 + (12, TType.BOOL, 'cacheBlocks', None, None, ), # 12 + (13, TType.MAP, 'colFamTimeRangeMap', (TType.STRING, 'BINARY', TType.STRUCT, [TTimeRange, None], False), None, ), # 13 + (14, TType.I32, 'readType', None, None, ), # 14 + (15, TType.I32, 'limit', None, None, ), # 15 + (16, TType.I32, 'consistency', None, None, ), # 16 + (17, TType.I32, 'targetReplicaId', None, None, ), # 17 + (18, TType.STRING, 'filterBytes', 'BINARY', None, ), # 18 +) +all_structs.append(TMutation) +TMutation.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'put', [TPut, None], None, ), # 1 + (2, TType.STRUCT, 'deleteSingle', [TDelete, None], None, ), # 2 +) +all_structs.append(TRowMutations) +TRowMutations.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'row', 'BINARY', None, ), # 1 + (2, TType.LIST, 'mutations', (TType.STRUCT, [TMutation, None], False), None, ), # 2 +) +all_structs.append(THRegionInfo) +THRegionInfo.thrift_spec = ( + None, # 0 + (1, TType.I64, 'regionId', None, None, ), # 1 + (2, TType.STRING, 'tableName', 'BINARY', None, ), # 2 + (3, TType.STRING, 'startKey', 'BINARY', None, ), # 3 + (4, TType.STRING, 'endKey', 'BINARY', None, ), # 4 + (5, TType.BOOL, 'offline', None, None, ), # 5 + (6, TType.BOOL, 'split', None, None, ), # 6 + (7, TType.I32, 'replicaId', None, None, ), # 7 +) +all_structs.append(TServerName) +TServerName.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'hostName', 'UTF8', None, ), # 1 + (2, TType.I32, 'port', None, None, ), # 2 + (3, TType.I64, 'startCode', None, None, ), # 3 +) +all_structs.append(THRegionLocation) +THRegionLocation.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'serverName', [TServerName, None], None, ), # 1 + (2, TType.STRUCT, 'regionInfo', [THRegionInfo, None], None, ), # 2 +) +all_structs.append(TTableName) +TTableName.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'ns', 'BINARY', None, ), # 1 + (2, TType.STRING, 'qualifier', 'BINARY', None, ), # 2 +) +all_structs.append(TColumnFamilyDescriptor) +TColumnFamilyDescriptor.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'BINARY', None, ), # 1 + (2, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 2 + (3, TType.MAP, 'configuration', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 3 + (4, TType.I32, 'blockSize', None, None, ), # 4 + (5, TType.I32, 'bloomnFilterType', None, None, ), # 5 + (6, TType.I32, 'compressionType', None, None, ), # 6 + (7, TType.I16, 'dfsReplication', None, None, ), # 7 + (8, TType.I32, 'dataBlockEncoding', None, None, ), # 8 + (9, TType.I32, 'keepDeletedCells', None, None, ), # 9 + (10, TType.I32, 'maxVersions', None, None, ), # 10 + (11, TType.I32, 'minVersions', None, None, ), # 11 + (12, TType.I32, 'scope', None, None, ), # 12 + (13, TType.I32, 'timeToLive', None, None, ), # 13 + (14, TType.BOOL, 'blockCacheEnabled', None, None, ), # 14 + (15, TType.BOOL, 'cacheBloomsOnWrite', None, None, ), # 15 + (16, TType.BOOL, 'cacheDataOnWrite', None, None, ), # 16 + (17, TType.BOOL, 'cacheIndexesOnWrite', None, None, ), # 17 + (18, TType.BOOL, 'compressTags', None, None, ), # 18 + (19, TType.BOOL, 'evictBlocksOnClose', None, None, ), # 19 + (20, TType.BOOL, 'inMemory', None, None, ), # 20 +) +all_structs.append(TAccessControlEntity) +TAccessControlEntity.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'username', 'UTF8', None, ), # 1 + (2, TType.I32, 'scope', None, None, ), # 2 + (3, TType.I32, 'op', None, None, ), # 3 + (4, TType.STRING, 'actions', 'UTF8', None, ), # 4 + (5, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 5 + (6, TType.STRING, 'nsName', 'UTF8', None, ), # 6 +) +all_structs.append(TTableDescriptor) +TTableDescriptor.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'tableName', [TTableName, None], None, ), # 1 + (2, TType.LIST, 'columns', (TType.STRUCT, [TColumnFamilyDescriptor, None], False), None, ), # 2 + (3, TType.MAP, 'attributes', (TType.STRING, 'BINARY', TType.STRING, 'BINARY', False), None, ), # 3 + (4, TType.I32, 'durability', None, None, ), # 4 +) +all_structs.append(TNamespaceDescriptor) +TNamespaceDescriptor.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'UTF8', None, ), # 1 + (2, TType.MAP, 'configuration', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 2 +) +all_structs.append(TLogQueryFilter) +TLogQueryFilter.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'regionName', 'UTF8', None, ), # 1 + (2, TType.STRING, 'clientAddress', 'UTF8', None, ), # 2 + (3, TType.STRING, 'tableName', 'UTF8', None, ), # 3 + (4, TType.STRING, 'userName', 'UTF8', None, ), # 4 + (5, TType.I32, 'limit', None, 10, ), # 5 + (6, TType.I32, 'logType', None, 1, ), # 6 + (7, TType.I32, 'filterByOperator', None, 1, ), # 7 +) +all_structs.append(TOnlineLogRecord) +TOnlineLogRecord.thrift_spec = ( + None, # 0 + (1, TType.I64, 'startTime', None, None, ), # 1 + (2, TType.I32, 'processingTime', None, None, ), # 2 + (3, TType.I32, 'queueTime', None, None, ), # 3 + (4, TType.I64, 'responseSize', None, None, ), # 4 + (5, TType.STRING, 'clientAddress', 'UTF8', None, ), # 5 + (6, TType.STRING, 'serverClass', 'UTF8', None, ), # 6 + (7, TType.STRING, 'methodName', 'UTF8', None, ), # 7 + (8, TType.STRING, 'callDetails', 'UTF8', None, ), # 8 + (9, TType.STRING, 'param', 'UTF8', None, ), # 9 + (10, TType.STRING, 'userName', 'UTF8', None, ), # 10 + (11, TType.I32, 'multiGetsCount', None, None, ), # 11 + (12, TType.I32, 'multiMutationsCount', None, None, ), # 12 + (13, TType.I32, 'multiServiceCalls', None, None, ), # 13 + (14, TType.STRING, 'regionName', 'UTF8', None, ), # 14 +) +all_structs.append(TIOError) +TIOError.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', 'UTF8', None, ), # 1 + (2, TType.BOOL, 'canRetry', None, None, ), # 2 +) +all_structs.append(TIllegalArgument) +TIllegalArgument.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', 'UTF8', None, ), # 1 +) +fix_spec(all_structs) +del all_structs diff --git a/thrift-python/hbase-client-thrift2/thrift2/__init__.py b/thrift-python/hbase-client-thrift2/thrift2/__init__.py new file mode 100644 index 00000000..56d29a78 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/thrift2/__init__.py @@ -0,0 +1,14 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +__all__ = ['cell', 'client', 'table', 'operation'] diff --git a/thrift-python/hbase-client-thrift2/thrift2/cell.py b/thrift-python/hbase-client-thrift2/thrift2/cell.py new file mode 100644 index 00000000..aff58bae --- /dev/null +++ b/thrift-python/hbase-client-thrift2/thrift2/cell.py @@ -0,0 +1,71 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from typing import Union +from thbase.util.bytes import to_str + + +class Cell(object): + + def __init__(self, table_name, # type: Union[None, bytes] + row, # type: Union[None, bytes] + family, # type: Union[None, bytes] + qualifier, # type: Union[None, bytes] + value, # type: Union[None, bytes] + timestamp, # type: Union[None, int] + ): + """ + Data structure to load data from hbase. If there is no matched cell or some errors occur at hbase server, + all the attributes could be None. In python2, bytes are represented by str, so the type of value is str. + Args: + table_name: name of the table. + row: the row key. + family: the column family. + qualifier: the column qualifier. + value: the bytes stored in the cell. + timestamp: a long int. + """ + self._table_name = table_name + self._row = row + self._family = family + self._qualifier = qualifier + self._value = value + self._timestamp = timestamp + + @property + def table_name(self): + return self._table_name + + @property + def row(self): + return self._row + + @property + def family(self): + return self._family + + @property + def qualifier(self): + return self._qualifier + + @property + def value(self): + return self._value + + @property + def timestamp(self): + return self._timestamp + + def __str__(self): + return ":".join([to_str(self.table_name), to_str(self.row), to_str(self.family), to_str(self.qualifier)]) + \ + ' => ' + to_str(self.value) diff --git a/thrift-python/hbase-client-thrift2/thrift2/client.py b/thrift-python/hbase-client-thrift2/thrift2/client.py new file mode 100644 index 00000000..5277620e --- /dev/null +++ b/thrift-python/hbase-client-thrift2/thrift2/client.py @@ -0,0 +1,354 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from thbase.hbase import THBaseService +from thbase.hbase.ttypes import TTableDescriptor, TPermissionScope +from thbase.hbase.ttypes import TColumnFamilyDescriptor +from thbase.hbase.ttypes import TAccessControlEntity +from thbase.clientbase import ClientBase +from thbase.thrift2.table import Table +from thbase.util.executor import Executor +from thbase.util.bytes import to_str +from thbase.util.builder import ColumnDescriptorBuilder +from thbase.util.builder import TableDescriptorBuilder +from thbase.util import type_check +from thbase.util import check_none +from thbase.util import str_to_tablename +import logging + +logger = logging.getLogger(__name__) + + +class Client(ClientBase): + """ + Client implemented by thrift2 API. + User should not invoke methods of a Client object directly. + This class does not provide retry mechanism, reconnection mechanism and exception handling. + Please not use it directly. + """ + def __init__(self, conf): + super(Client, self).__init__(conf=conf) + self.client = THBaseService.Client(self.connection.protocol) + self.executor = Executor(self.conf.retry_times, self.conf.retry_timeout, master=self) + + def _put_row(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + put = kwargs['put'] + return self.executor.call(lambda: self.client.put(table_name, put.core)) + + def _put_rows(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + puts = kwargs['puts'] + return self.executor.call(lambda: self.client.putMultiple(table_name, [put.core for put in puts])) + + def _get_row(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + get = kwargs['get'] + result = self.executor.call(lambda: self.client.get(table_name, get.core)) + return [result] + + def _get_rows(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + gets = kwargs['gets'] + return self.executor.call(lambda: self.client.getMultiple(table_name, [get.core for get in gets])) + + def _scan(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + scan = kwargs['scan'] + return self.executor.call(lambda: self.client.getScannerResults(table_name, scan.core, scan.num_rows)) + + def _delete_row(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + delete = kwargs['delete'] + return self.executor.call(lambda: self.client.deleteSingle(table_name, delete.core)) + + def _delete_batch(self, **kwargs): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + table_name = kwargs['table_name'] + deletes = kwargs['deletes'] + return self.executor.call(lambda: self.client.deleteMultiple(table_name, [delete.core for delete in deletes])) + + def _refresh_client(self): + """ + Private method, should not be used by users. + Args: + **kwargs: + + Returns: + + """ + self.client = THBaseService.Client(self.connection.protocol) + + def get_table(self, table_name): + """ + Acquire a table object to use functional methods. + Args: + **kwargs: + + Returns: + + """ + return Table(table_name=table_name, client=self) + + def create_table(self, desc, split_keys): + """ + + Args: + desc: TTableDescriptor, which contains the meta information of the table to create. + split_keys: split keys for table pre-split. + + Returns: True if success, else False. + + """ + type_check(desc, TTableDescriptor) + type_check(split_keys, list) + return self.executor.call(lambda: self.client.createTable(desc, split_keys)) + + def delete_table(self, table_name): + """ + + Args: + table_name: The name of the table that need to be removed. + + Returns: True if success, else False. + + """ + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.deleteTable(tn)) + + def enable_table(self, table_name): + """ + + Args: + table_name: The name of the table that need to be enabled. + If the table is already enabled, it will raise an Error. + Returns: True if success, else False. + + """ + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.enableTable(tn)) + + def disable_table(self, table_name): + """ + + Args: + table_name: The name of the table that need to be disabled. + If the table is already enabled, it will raise an Error. + Returns: True if success, else False. + + """ + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.disableTable(tn)) + + def truncate_table(self, table_name, preserve_splits): + """ + + Args: + table_name: + preserve_splits: + + Returns: + + """ + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.truncateTable(tn, preserve_splits)) + + def is_enabled(self, table_name): + """ + Check if the table is enabled. + Args: + table_name: + + Returns: + + """ + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.isTableEnabled(tn)) + + def get_tableDescriptor(self, table_name): + """ + + Args: + table_name: + + Returns: + + """ + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.getTableDescriptor(tn)) + + def get_columnDescriptor(self, table_name, cf): + """ + Return a column descriptor for specific table with the given cf name. + Args: + table_name: + cf: + + Returns: + + """ + type_check(cf, str) + td = self.get_tableDescriptor(table_name) + check_none(td, "Unknown table.") + for col in td.columns: + if to_str(col.name) == cf: + return col + raise RuntimeError("The table does not contain a column family with name {}".format(cf)) + + def get_columnBuilder(self, table_name, cf): + """ + Acquire a column descriptor of a specific cf. + Args: + table_name: + cf: + + Returns: + + """ + desc = self.get_columnDescriptor(table_name, cf) + builder = ColumnDescriptorBuilder('') + builder.copy_from_exist(desc) + return builder + + def modify_columnFamily(self, table_name, desc): + """ + + Args: + table_name: + desc: + + Returns: + + """ + type_check(desc, TColumnFamilyDescriptor) + tn = str_to_tablename(table_name) + return self.executor.call(lambda: self.client.modifyColumnFamily(tn, desc)) + + def get_tableBuilder(self, table_name): + """ + + Args: + table_name: + + Returns: + + """ + builder = TableDescriptorBuilder(table_name) + desc = self.get_tableDescriptor(table_name) + builder.copy_from_exist(desc) + return builder + + def modify_table(self, table_descriptor): + """ + + Args: + table_descriptor: + + Returns: + + """ + type_check(table_descriptor, TTableDescriptor) + return self.executor.call(lambda: self.client.modifyTable(table_descriptor)) + + def grant(self, info): + """ + + Args: + info: + + Returns: + + """ + type_check(info, TAccessControlEntity) + return self.executor.call(lambda: self.client.grant(info)) + + def revoke(self, info): + """ + + Args: + info: + + Returns: + + """ + type_check(info, TAccessControlEntity) + return self.executor.call(lambda: self.client.revoke(info)) + + def get_user_permissions(self, domain_name): + """ + + Args: + domain_name: + scope: + + Returns: + + """ + type_check(domain_name, str) + scope = TPermissionScope.TABLE if domain_name[0] != '@' else TPermissionScope.NAMESPACE + return self.executor.call(lambda: self.client.getUserPermission(domain_name, scope)) diff --git a/thrift-python/hbase-client-thrift2/thrift2/hbase.thrift b/thrift-python/hbase-client-thrift2/thrift2/hbase.thrift new file mode 100644 index 00000000..22ef5e38 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/thrift2/hbase.thrift @@ -0,0 +1,1175 @@ +/* + * 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. + */ + +// NOTE: The "required" and "optional" keywords for the service methods are purely for documentation + +namespace java org.apache.hadoop.hbase.thrift2.generated +namespace cpp apache.hadoop.hbase.thrift2 +namespace rb Apache.Hadoop.Hbase.Thrift2 +namespace py hbase +namespace perl Hbase + +struct TTimeRange { + 1: required i64 minStamp, + 2: required i64 maxStamp +} + +/** + * Addresses a single cell or multiple cells + * in a HBase table by column family and optionally + * a column qualifier and timestamp + */ +struct TColumn { + 1: required binary family, + 2: optional binary qualifier, + 3: optional i64 timestamp +} + +/** + * Represents a single cell and its value. + */ +struct TColumnValue { + 1: required binary family, + 2: required binary qualifier, + 3: required binary value, + 4: optional i64 timestamp, + 5: optional binary tags, + 6: optional byte type +} + +/** + * Represents a single cell and the amount to increment it by + */ +struct TColumnIncrement { + 1: required binary family, + 2: required binary qualifier, + 3: optional i64 amount = 1 +} + +/** + * if no Result is found, row and columnValues will not be set. + */ +struct TResult { + 1: optional binary row, + 2: required list columnValues, + 3: optional bool stale = false + 4: optional bool partial = false +} + +/** + * Specify type of delete: + * - DELETE_COLUMN means exactly one version will be removed, + * - DELETE_COLUMNS means previous versions will also be removed. + */ +enum TDeleteType { + DELETE_COLUMN = 0, + DELETE_COLUMNS = 1, + DELETE_FAMILY = 2, + DELETE_FAMILY_VERSION = 3 +} + +/** + * Specify Durability: + * - SKIP_WAL means do not write the Mutation to the WAL. + * - ASYNC_WAL means write the Mutation to the WAL asynchronously, + * - SYNC_WAL means write the Mutation to the WAL synchronously, + * - FSYNC_WAL means Write the Mutation to the WAL synchronously and force the entries to disk. + */ + +enum TDurability { + USE_DEFAULT = 0, + SKIP_WAL = 1, + ASYNC_WAL = 2, + SYNC_WAL = 3, + FSYNC_WAL = 4 +} +struct TAuthorization { + 1: optional list labels +} + +struct TCellVisibility { + 1: optional string expression +} + +/** + * Specify Consistency: + * - STRONG means reads only from primary region + * - TIMELINE means reads might return values from secondary region replicas + */ +enum TConsistency { + STRONG = 1, + TIMELINE = 2 +} + +/** + * Used to perform Get operations on a single row. + * + * The scope can be further narrowed down by specifying a list of + * columns or column families. + * + * To get everything for a row, instantiate a Get object with just the row to get. + * To further define the scope of what to get you can add a timestamp or time range + * with an optional maximum number of versions to return. + * + * If you specify a time range and a timestamp the range is ignored. + * Timestamps on TColumns are ignored. + */ +struct TGet { + 1: required binary row, + 2: optional list columns, + + 3: optional i64 timestamp, + 4: optional TTimeRange timeRange, + + 5: optional i32 maxVersions, + 6: optional binary filterString, + 7: optional map attributes + 8: optional TAuthorization authorizations + 9: optional TConsistency consistency + 10: optional i32 targetReplicaId + 11: optional bool cacheBlocks + 12: optional i32 storeLimit + 13: optional i32 storeOffset + 14: optional bool existence_only + 15: optional binary filterBytes + +} + +/** + * Used to perform Put operations for a single row. + * + * Add column values to this object and they'll be added. + * You can provide a default timestamp if the column values + * don't have one. If you don't provide a default timestamp + * the current time is inserted. + * + * You can specify how this Put should be written to the write-ahead Log (WAL) + * by changing the durability. If you don't provide durability, it defaults to + * column family's default setting for durability. + */ +struct TPut { + 1: required binary row, + 2: required list columnValues + 3: optional i64 timestamp, + 5: optional map attributes, + 6: optional TDurability durability, + 7: optional TCellVisibility cellVisibility +} + +/** + * Used to perform Delete operations on a single row. + * + * The scope can be further narrowed down by specifying a list of + * columns or column families as TColumns. + * + * Specifying only a family in a TColumn will delete the whole family. + * If a timestamp is specified all versions with a timestamp less than + * or equal to this will be deleted. If no timestamp is specified the + * current time will be used. + * + * Specifying a family and a column qualifier in a TColumn will delete only + * this qualifier. If a timestamp is specified only versions equal + * to this timestamp will be deleted. If no timestamp is specified the + * most recent version will be deleted. To delete all previous versions, + * specify the DELETE_COLUMNS TDeleteType. + * + * The top level timestamp is only used if a complete row should be deleted + * (i.e. no columns are passed) and if it is specified it works the same way + * as if you had added a TColumn for every column family and this timestamp + * (i.e. all versions older than or equal in all column families will be deleted) + * + * You can specify how this Delete should be written to the write-ahead Log (WAL) + * by changing the durability. If you don't provide durability, it defaults to + * column family's default setting for durability. + */ +struct TDelete { + 1: required binary row, + 2: optional list columns, + 3: optional i64 timestamp, + 4: optional TDeleteType deleteType = 1, + 6: optional map attributes, + 7: optional TDurability durability + +} + +/** + * Used to perform Increment operations for a single row. + * + * You can specify how this Increment should be written to the write-ahead Log (WAL) + * by changing the durability. If you don't provide durability, it defaults to + * column family's default setting for durability. + */ +struct TIncrement { + 1: required binary row, + 2: required list columns, + 4: optional map attributes, + 5: optional TDurability durability + 6: optional TCellVisibility cellVisibility + 7: optional bool returnResults +} + +/* + * Used to perform append operation + */ +struct TAppend { + 1: required binary row, + 2: required list columns, + 3: optional map attributes, + 4: optional TDurability durability + 5: optional TCellVisibility cellVisibility + 6: optional bool returnResults +} + +enum TReadType { + DEFAULT = 1, + STREAM = 2, + PREAD = 3 +} + +/** + * Any timestamps in the columns are ignored but the colFamTimeRangeMap included, use timeRange to select by timestamp. + * Max versions defaults to 1. + */ +struct TScan { + 1: optional binary startRow, + 2: optional binary stopRow, + 3: optional list columns + 4: optional i32 caching, + 5: optional i32 maxVersions=1, + 6: optional TTimeRange timeRange, + 7: optional binary filterString, + 8: optional i32 batchSize, + 9: optional map attributes + 10: optional TAuthorization authorizations + 11: optional bool reversed + 12: optional bool cacheBlocks + 13: optional map colFamTimeRangeMap + 14: optional TReadType readType + 15: optional i32 limit + 16: optional TConsistency consistency + 17: optional i32 targetReplicaId + 18: optional binary filterBytes + +} + +/** + * Atomic mutation for the specified row. It can be either Put or Delete. + */ +union TMutation { + 1: TPut put + 2: TDelete deleteSingle +} + +/** + * A TRowMutations object is used to apply a number of Mutations to a single row. + */ +struct TRowMutations { + 1: required binary row + 2: required list mutations +} + +struct THRegionInfo { + 1: required i64 regionId + 2: required binary tableName + 3: optional binary startKey + 4: optional binary endKey + 5: optional bool offline + 6: optional bool split + 7: optional i32 replicaId +} + +struct TServerName { + 1: required string hostName + 2: optional i32 port + 3: optional i64 startCode +} + +struct THRegionLocation { + 1: required TServerName serverName + 2: required THRegionInfo regionInfo +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.filter.CompareFilter$CompareOp. + */ +enum TCompareOp { + LESS = 0, + LESS_OR_EQUAL = 1, + EQUAL = 2, + NOT_EQUAL = 3, + GREATER_OR_EQUAL = 4, + GREATER = 5, + NO_OP = 6 +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.regionserver.BloomType + */ +enum TBloomFilterType { +/** + * Bloomfilters disabled + */ + NONE = 0, + /** + * Bloom enabled with Table row as Key + */ + ROW = 1, + /** + * Bloom enabled with Table row & column (family+qualifier) as Key + */ + ROWCOL = 2, + /** + * Bloom enabled with Table row prefix as Key, specify the length of the prefix + */ + ROWPREFIX_FIXED_LENGTH = 3, +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.io.compress.Algorithm + */ +enum TCompressionAlgorithm { + LZO = 0, + GZ = 1, + NONE = 2, + SNAPPY = 3, + LZ4 = 4, + BZIP2 = 5, + ZSTD = 6 +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.io.encoding.DataBlockEncoding + */ +enum TDataBlockEncoding { +/** Disable data block encoding. */ + NONE = 0, + // id 1 is reserved for the BITSET algorithm to be added later + PREFIX = 2, + DIFF = 3, + FAST_DIFF = 4, + // id 5 is reserved for the COPY_KEY algorithm for benchmarking + // COPY_KEY(5, "org.apache.hadoop.hbase.io.encoding.CopyKeyDataBlockEncoder"), + // PREFIX_TREE(6, "org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeCodec"), + ROW_INDEX_V1 = 7 +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.KeepDeletedCells + */ +enum TKeepDeletedCells { + /** Deleted Cells are not retained. */ + FALSE = 0, + /** + * Deleted Cells are retained until they are removed by other means + * such TTL or VERSIONS. + * If no TTL is specified or no new versions of delete cells are + * written, they are retained forever. + */ + TRUE = 1, + /** + * Deleted Cells are retained until the delete marker expires due to TTL. + * This is useful when TTL is combined with MIN_VERSIONS and one + * wants to keep a minimum number of versions around but at the same + * time remove deleted cells after the TTL. + */ + TTL = 2 +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.TableName + */ +struct TTableName { + /** namespace name */ + 1: optional binary ns + /** tablename */ + 2: required binary qualifier +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.client.ColumnFamilyDescriptor + */ +struct TColumnFamilyDescriptor { + 1: required binary name + 2: optional map attributes + 3: optional map configuration + 4: optional i32 blockSize + 5: optional TBloomFilterType bloomnFilterType + 6: optional TCompressionAlgorithm compressionType + 7: optional i16 dfsReplication + 8: optional TDataBlockEncoding dataBlockEncoding + 9: optional TKeepDeletedCells keepDeletedCells + 10: optional i32 maxVersions + 11: optional i32 minVersions + 12: optional i32 scope + 13: optional i32 timeToLive + 14: optional bool blockCacheEnabled + 15: optional bool cacheBloomsOnWrite + 16: optional bool cacheDataOnWrite + 17: optional bool cacheIndexesOnWrite + 18: optional bool compressTags + 19: optional bool evictBlocksOnClose + 20: optional bool inMemory + +} + + +enum TPermissionScope { + TABLE = 0, + NAMESPACE = 1 +} + +enum TPermissionOps { + GRANT = 0, + REVOKE = 1 +} + +/** + * TAccessControlEntity + */ +struct TAccessControlEntity { + 1: required string username + 2: required TPermissionScope scope + 3: required TPermissionOps op + 4: required string actions + 5: optional TTableName tableName + 6: optional string nsName +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.client.TableDescriptor + */ +struct TTableDescriptor { + 1: required TTableName tableName + 2: optional list columns + 3: optional map attributes + 4: optional TDurability durability +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.NamespaceDescriptor + */ +struct TNamespaceDescriptor { +1: required string name +2: optional map configuration +} + +enum TLogType { + SLOW_LOG = 1, + LARGE_LOG = 2 +} + +enum TFilterByOperator { + AND, + OR +} + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.client.LogQueryFilter + */ +struct TLogQueryFilter { + 1: optional string regionName + 2: optional string clientAddress + 3: optional string tableName + 4: optional string userName + 5: optional i32 limit = 10 + 6: optional TLogType logType = 1 + 7: optional TFilterByOperator filterByOperator = TFilterByOperator.OR +} + + +/** + * Thrift wrapper around + * org.apache.hadoop.hbase.client.OnlineLogRecordrd + */ +struct TOnlineLogRecord { + 1: required i64 startTime + 2: required i32 processingTime + 3: required i32 queueTime + 4: required i64 responseSize + 5: required string clientAddress + 6: required string serverClass + 7: required string methodName + 8: required string callDetails + 9: required string param + 10: required string userName + 11: required i32 multiGetsCount + 12: required i32 multiMutationsCount + 13: required i32 multiServiceCalls + 14: optional string regionName +} + +// +// Exceptions +// + +/** + * A TIOError exception signals that an error occurred communicating + * to the HBase master or a HBase region server. Also used to return + * more general HBase error conditions. + */ +exception TIOError { + 1: optional string message + 2: optional bool canRetry +} + +/** + * A TIllegalArgument exception indicates an illegal or invalid + * argument was passed into a procedure. + */ +exception TIllegalArgument { + 1: optional string message +} + +/** + * Specify type of thrift server: thrift and thrift2 + */ +enum TThriftServerType { + ONE = 1, + TWO = 2 +} + +service THBaseService { + + /** + * Test for the existence of columns in the table, as specified in the TGet. + * + * @return true if the specified TGet matches one or more keys, false if not + */ + bool exists( + /** the table to check on */ + 1: required binary table, + + /** the TGet to check for */ + 2: required TGet tget + ) throws (1:TIOError io) + + + /** + * Test for the existence of columns in the table, as specified by the TGets. + * + * This will return an array of booleans. Each value will be true if the related Get matches + * one or more keys, false if not. + */ + list existsAll( + /** the table to check on */ + 1: required binary table, + + /** a list of TGets to check for */ + 2: required list tgets + ) throws (1:TIOError io) + + /** + * Method for getting data from a row. + * + * If the row cannot be found an empty Result is returned. + * This can be checked by the empty field of the TResult + * + * @return the result + */ + TResult get( + /** the table to get from */ + 1: required binary table, + + /** the TGet to fetch */ + 2: required TGet tget + ) throws (1: TIOError io) + + /** + * Method for getting multiple rows. + * + * If a row cannot be found there will be a null + * value in the result list for that TGet at the + * same position. + * + * So the Results are in the same order as the TGets. + */ + list getMultiple( + /** the table to get from */ + 1: required binary table, + + /** a list of TGets to fetch, the Result list + will have the Results at corresponding positions + or null if there was an error */ + 2: required list tgets + ) throws (1: TIOError io) + + /** + * Commit a TPut to a table. + */ + void put( + /** the table to put data in */ + 1: required binary table, + + /** the TPut to put */ + 2: required TPut tput + ) throws (1: TIOError io) + + /** + * Atomically checks if a row/family/qualifier value matches the expected + * value. If it does, it adds the TPut. + * + * @return true if the new put was executed, false otherwise + */ + bool checkAndPut( + /** to check in and put to */ + 1: required binary table, + + /** row to check */ + 2: required binary row, + + /** column family to check */ + 3: required binary family, + + /** column qualifier to check */ + 4: required binary qualifier, + + /** the expected value, if not provided the + check is for the non-existence of the + column in question */ + 5: binary value, + + /** the TPut to put if the check succeeds */ + 6: required TPut tput + ) throws (1: TIOError io) + + /** + * Commit a List of Puts to the table. + */ + void putMultiple( + /** the table to put data in */ + 1: required binary table, + + /** a list of TPuts to commit */ + 2: required list tputs + ) throws (1: TIOError io) + + /** + * Deletes as specified by the TDelete. + * + * Note: "delete" is a reserved keyword and cannot be used in Thrift + * thus the inconsistent naming scheme from the other functions. + */ + void deleteSingle( + /** the table to delete from */ + 1: required binary table, + + /** the TDelete to delete */ + 2: required TDelete tdelete + ) throws (1: TIOError io) + + /** + * Bulk commit a List of TDeletes to the table. + * + * Throws a TIOError if any of the deletes fail. + * + * Always returns an empty list for backwards compatibility. + */ + list deleteMultiple( + /** the table to delete from */ + 1: required binary table, + + /** list of TDeletes to delete */ + 2: required list tdeletes + ) throws (1: TIOError io) + + /** + * Atomically checks if a row/family/qualifier value matches the expected + * value. If it does, it adds the delete. + * + * @return true if the new delete was executed, false otherwise + */ + bool checkAndDelete( + /** to check in and delete from */ + 1: required binary table, + + /** row to check */ + 2: required binary row, + + /** column family to check */ + 3: required binary family, + + /** column qualifier to check */ + 4: required binary qualifier, + + /** the expected value, if not provided the + check is for the non-existence of the + column in question */ + 5: binary value, + + /** the TDelete to execute if the check succeeds */ + 6: required TDelete tdelete + ) throws (1: TIOError io) + + TResult increment( + /** the table to increment the value on */ + 1: required binary table, + + /** the TIncrement to increment */ + 2: required TIncrement tincrement + ) throws (1: TIOError io) + + TResult append( + /** the table to append the value on */ + 1: required binary table, + + /** the TAppend to append */ + 2: required TAppend tappend + ) throws (1: TIOError io) + + /** + * Get a Scanner for the provided TScan object. + * + * @return Scanner Id to be used with other scanner procedures + */ + i32 openScanner( + /** the table to get the Scanner for */ + 1: required binary table, + + /** the scan object to get a Scanner for */ + 2: required TScan tscan, + ) throws (1: TIOError io) + + /** + * Grabs multiple rows from a Scanner. + * + * @return Between zero and numRows TResults + */ + list getScannerRows( + /** the Id of the Scanner to return rows from. This is an Id returned from the openScanner function. */ + 1: required i32 scannerId, + + /** number of rows to return */ + 2: i32 numRows = 1 + ) throws ( + 1: TIOError io, + + /** if the scannerId is invalid */ + 2: TIllegalArgument ia + ) + + /** + * Closes the scanner. Should be called to free server side resources timely. + * Typically close once the scanner is not needed anymore, i.e. after looping + * over it to get all the required rows. + */ + void closeScanner( + /** the Id of the Scanner to close **/ + 1: required i32 scannerId + ) throws ( + 1: TIOError io, + + /** if the scannerId is invalid */ + 2: TIllegalArgument ia + ) + + /** + * mutateRow performs multiple mutations atomically on a single row. + */ + void mutateRow( + /** table to apply the mutations */ + 1: required binary table, + + /** mutations to apply */ + 2: required TRowMutations trowMutations + ) throws (1: TIOError io) + + /** + * Get results for the provided TScan object. + * This helper function opens a scanner, get the results and close the scanner. + * + * @return between zero and numRows TResults + */ + list getScannerResults( + /** the table to get the Scanner for */ + 1: required binary table, + + /** the scan object to get a Scanner for */ + 2: required TScan tscan, + + /** number of rows to return */ + 3: i32 numRows = 1 + ) throws ( + 1: TIOError io + ) + + /** + * Given a table and a row get the location of the region that + * would contain the given row key. + * + * reload = true means the cache will be cleared and the location + * will be fetched from meta. + */ + THRegionLocation getRegionLocation( + 1: required binary table, + 2: required binary row, + 3: bool reload, + ) throws ( + 1: TIOError io + ) + + /** + * Get all of the region locations for a given table. + **/ + list getAllRegionLocations( + 1: required binary table, + ) throws ( + 1: TIOError io + ) + + /** + * Atomically checks if a row/family/qualifier value matches the expected + * value. If it does, it mutates the row. + * + * @return true if the row was mutated, false otherwise + */ + bool checkAndMutate( + /** to check in and delete from */ + 1: required binary table, + + /** row to check */ + 2: required binary row, + + /** column family to check */ + 3: required binary family, + + /** column qualifier to check */ + 4: required binary qualifier, + + /** comparison to make on the value */ + 5: required TCompareOp compareOp, + + /** the expected value to be compared against, if not provided the + check is for the non-existence of the column in question */ + 6: binary value, + + /** row mutations to execute if the value matches */ + 7: required TRowMutations rowMutations + ) throws (1: TIOError io) + + /** + * Get a table descriptor. + * @return the TableDescriptor of the giving tablename + **/ + TTableDescriptor getTableDescriptor( + /** the tablename of the table to get tableDescriptor*/ + 1: required TTableName table + ) throws (1: TIOError io) + + /** + * Get table descriptors of tables. + * @return the TableDescriptor of the giving tablename + **/ + list getTableDescriptors( + /** the tablename list of the tables to get tableDescriptor*/ + 1: required list tables + ) throws (1: TIOError io) + + /** + * + * @return true if table exists already, false if not + **/ + bool tableExists( + /** the tablename of the tables to check*/ + 1: TTableName tableName + ) throws (1: TIOError io) + + /** + * Get table descriptors of tables that match the given pattern + * @return the tableDescriptors of the matching table + **/ + list getTableDescriptorsByPattern( + /** The regular expression to match against */ + 1: optional string regex + /** set to false if match only against userspace tables */ + 2: required bool includeSysTables + ) throws (1: TIOError io) + + /** + * Get table descriptors of tables in the given namespace + * @return the tableDescriptors in the namespce + **/ + list getTableDescriptorsByNamespace( + /** The namesapce's name */ + 1: required string name + ) throws (1: TIOError io) + + /** + * Get table names of tables that match the given pattern + * @return the table names of the matching table + **/ + list getTableNamesByPattern( + /** The regular expression to match against */ + 1: optional string regex + /** set to false if match only against userspace tables */ + 2: required bool includeSysTables + ) throws (1: TIOError io) + + /** + * Get table names of tables in the given namespace + * @return the table names of the matching table + **/ + list getTableNamesByNamespace( + /** The namesapce's name */ + 1: required string name + ) throws (1: TIOError io) + + /** + * Creates a new table with an initial set of empty regions defined by the specified split keys. + * The total number of regions created will be the number of split keys plus one. Synchronous + * operation. + **/ + void createTable( + /** table descriptor for table */ + 1: required TTableDescriptor desc + /** rray of split keys for the initial regions of the table */ + 2: optional list splitKeys + ) throws (1: TIOError io) + + /** + * Deletes a table. Synchronous operation. + **/ + void deleteTable( + /** the tablename to delete */ + 1: required TTableName tableName + ) throws (1: TIOError io) + + /** + * Truncate a table. Synchronous operation. + **/ + void truncateTable( + /** the tablename to truncate */ + 1: required TTableName tableName + /** whether to preserve previous splits*/ + 2: required bool preserveSplits + ) throws (1: TIOError io) + + /** + * Enalbe a table + **/ + void enableTable( + /** the tablename to enable */ + 1: required TTableName tableName + ) throws (1: TIOError io) + + /** + * Disable a table + **/ + void disableTable( + /** the tablename to disable */ + 1: required TTableName tableName + ) throws (1: TIOError io) + + /** + * + * @return true if table is enabled, false if not + **/ + bool isTableEnabled( + /** the tablename to check */ + 1: required TTableName tableName + ) throws (1: TIOError io) + + /** + * + * @return true if table is disabled, false if not + **/ + bool isTableDisabled( + /** the tablename to check */ + 1: required TTableName tableName + ) throws (1: TIOError io) + + /** + * + * @return true if table is available, false if not + **/ + bool isTableAvailable( + /** the tablename to check */ + 1: required TTableName tableName + ) throws (1: TIOError io) + + /** + * Use this api to check if the table has been created with the specified number of splitkeys + * which was used while creating the given table. Note : If this api is used after a table's + * region gets splitted, the api may return false. + * + * @return true if table is available, false if not + * + * @deprecated Since 2.2.0. Because the same method in Table interface has been deprecated + * since 2.0.0, we will remove it in 3.0.0 release. + * Use {@link #isTableAvailable(TTableName tableName)} instead + **/ + bool isTableAvailableWithSplit( + /** the tablename to check */ + 1: required TTableName tableName + /** keys to check if the table has been created with all split keys */ + 2: optional list splitKeys + ) throws (1: TIOError io) + + /** + * Add a column family to an existing table. Synchronous operation. + **/ + void addColumnFamily( + /** the tablename to add column family to */ + 1: required TTableName tableName + /** column family descriptor of column family to be added */ + 2: required TColumnFamilyDescriptor column + ) throws (1: TIOError io) + + /** + * Delete a column family from a table. Synchronous operation. + **/ + void deleteColumnFamily( + /** the tablename to delete column family from */ + 1: required TTableName tableName + /** name of column family to be deleted */ + 2: required binary column + ) throws (1: TIOError io) + + /** + * Modify an existing column family on a table. Synchronous operation. + **/ + void modifyColumnFamily( + /** the tablename to modify column family */ + 1: required TTableName tableName + /** column family descriptor of column family to be modified */ + 2: required TColumnFamilyDescriptor column + ) throws (1: TIOError io) + + /** + * Modify an existing table + **/ + void modifyTable( + /** the descriptor of the table to modify */ + 1: required TTableDescriptor desc + ) throws (1: TIOError io) + + /** + * Create a new namespace. Blocks until namespace has been successfully created or an exception is + * thrown + **/ + void createNamespace( + /** descriptor which describes the new namespace */ + 1: required TNamespaceDescriptor namespaceDesc + ) throws (1: TIOError io) + + /** + * Modify an existing namespace. Blocks until namespace has been successfully modified or an + * exception is thrown + **/ + void modifyNamespace( + /** descriptor which describes the new namespace */ + 1: required TNamespaceDescriptor namespaceDesc + ) throws (1: TIOError io) + + /** + * Delete an existing namespace. Only empty namespaces (no tables) can be removed. + * Blocks until namespace has been successfully deleted or an + * exception is thrown. + **/ + void deleteNamespace( + /** namespace name */ + 1: required string name + ) throws (1: TIOError io) + + /** + * Get a namespace descriptor by name. + * @retrun the descriptor + **/ + TNamespaceDescriptor getNamespaceDescriptor( + /** name of namespace descriptor */ + 1: required string name + ) throws (1: TIOError io) + + /** + * @return all namespaces + **/ + list listNamespaceDescriptors( + ) throws (1: TIOError io) + + /** + * @return all namespace names + **/ + list listNamespaces( + ) throws (1: TIOError io) + + /** + * Get the type of this thrift server. + * + * @return the type of this thrift server + */ + TThriftServerType getThriftServerType() + + /** + * Retrieves online slow RPC logs from the provided list of + * RegionServers + * + * @return online slowlog response list + * @throws TIOError if a remote or network exception occurs + */ + list getSlowLogResponses( + /** @param serverNames Server names to get slowlog responses from */ + 1: set serverNames + /** @param logQueryFilter filter to be used if provided */ + 2: TLogQueryFilter logQueryFilter + ) throws (1: TIOError io) + + /** + * Clears online slow/large RPC logs from the provided list of + * RegionServers + * + * @return List of booleans representing if online slowlog response buffer is cleaned + * from each RegionServer + * @throws TIOError if a remote or network exception occurs + */ + list clearSlowLogResponses( + /** @param serverNames Set of Server names to clean slowlog responses from */ + 1: set serverNames + ) throws (1: TIOError io) + + /** + * Grant permissions in table or namespace level. + */ + bool grant( + 1: required TAccessControlEntity info + ) throws (1: TIOError io) + + /** + * Revoke permissions in table or namespace level. + */ + bool revoke( + 1: required TAccessControlEntity info + ) throws (1: TIOError io) + + /** + * Get the user permissions in table or namespace level. + * Return a string representing the permissions. + */ + map getUserPermission( + 1: string domainName + 2: TPermissionScope scope + ) +} diff --git a/thrift-python/hbase-client-thrift2/thrift2/operation.py b/thrift-python/hbase-client-thrift2/thrift2/operation.py new file mode 100644 index 00000000..be3b8cfe --- /dev/null +++ b/thrift-python/hbase-client-thrift2/thrift2/operation.py @@ -0,0 +1,153 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from thbase.util import check_none +from thbase.util.bytes import to_bytes +from typing import List, Union +from thbase.hbase.ttypes import TGet, TDelete, TScan, TPut, TColumnValue, TColumn + + +class Operation(object): + """ + Basic object represent a single HBase operation. + """ + def __init__(self, row, # type: Union[None, str] + family, # type: Union[None, str] + qualifier, # type: Union[None, str] + value, # type: Union[None, str] + ): + self.row = to_bytes(row) + self.family = to_bytes(family) + self.qualifier = to_bytes(qualifier) + self.value = to_bytes(value) + + +class Get(Operation): + + def __init__(self, row=None, # type: Union[str] + family=None, # type: Union[None, str] + qualifier=None, # type: Union[None, str, List[str]] + value=None, # type: Union[None, str] + max_versions=None # type: Union[None, int] + ): + super(Get, self).__init__(row, family, qualifier, value) + check_none(self.row, "Row cannot be none for Get operation.") + self.maxVersions = max_versions + self.core = TGet(row=self.row, + columns=_column_format(family, qualifier), + timestamp=None, + timeRange=None, maxVersions=self.maxVersions) + + +class Delete(Operation): + + def __init__(self, row=None, # type: Union[str] + family=None, # type: Union[None, str] + qualifier=None, # type: Union[None, str] + value=None, # type: Union[None, str] + ): + super(Delete, self).__init__(row, family, qualifier, value) + check_none(self.row, "Row cannot be none for Delete operation.") + self.core = TDelete( + row=self.row, + columns=_column_format(self.family, self.qualifier), + ) + + +class Scan(Operation): + + def __init__(self, start_row=None, # type: Union[None, str] + family=None, # type: Union[None, str] + qualifier=None, # type: Union[None, str, List[str]] + stop_row=None, # type: Union[None, str] + num_rows=5000, # type: int + max_versions=None, # type: Union[None, int] + reversed=False, # type: Union[bool] + ): + super(Scan, self).__init__(start_row, family, qualifier, None) + self.reversed = reversed + self.stop_row = to_bytes(stop_row) + self.num_rows = num_rows + self.core = TScan( + startRow=self.row, + stopRow=self.stop_row, + columns=_column_format(self.family, self.qualifier), + maxVersions=max_versions, + reversed=self.reversed, + ) + + +class Put(Operation): + + def __init__(self, + row=None, # type: Union[str] + family=None, # type: Union[None, str] + qualifier=None, # type: Union[None, str, List[str]] + value=None, # type: Union[str, List[str]] + ): + super(Put, self).__init__(row, family, qualifier, value) + check_none(self.row, "Row cannot be none for Put operation.") + check_none(self.value, "Value cannot be none for Put operation.") + column_values = [] + columns = _column_format(family, qualifier) + if isinstance(value, str): + for col in columns: + column_values.append(TColumnValue( + family=to_bytes(col.family), + qualifier=to_bytes(col.qualifier), + value=self.value + )) + elif isinstance(value, list) or isinstance(value, tuple): + if len(columns) != len(value): + raise ValueError("The number of columns mismatches the number of value list.") + for i, col in enumerate(columns): + column_values.append(TColumnValue( + family=col.family, + qualifier=col.qualifier, + value=to_bytes(value[i]) + )) + self.core = TPut( + row=self.row, + columnValues=column_values + ) + + +def _column_format(family, qualifier): + # type: (str, Union[None, str, List[str]]) -> Union[None, List[TColumn]] + """ + Util method to get columns from given column family and qualifier. + If the family is None, this method will return None. + Args: + family: name of column family. + qualifier: name of column qualifier, it can be a str, None or a list of strs. + + Returns: a list of combined columns. + + """ + if family is None: + return None + if not isinstance(family, str) and not isinstance(family, bytes): + raise ValueError("A family name must be a str object, but got {}".format(type(family))) + family_bytes = to_bytes(family) + if qualifier is None: + return [TColumn(family=family_bytes)] + if isinstance(qualifier, str): + return [TColumn(family=family_bytes, qualifier=to_bytes(qualifier))] + if isinstance(qualifier, list) or isinstance(qualifier, tuple): + cols = [] + for cq in qualifier: + if isinstance(cq, str) or cq is None: + cols.append(TColumn(family=family_bytes, qualifier=to_bytes(cq))) + else: + raise ValueError("Qualifier should be None, str or a list (tuple) of str") + return cols \ No newline at end of file diff --git a/thrift-python/hbase-client-thrift2/thrift2/table.py b/thrift-python/hbase-client-thrift2/thrift2/table.py new file mode 100644 index 00000000..48cd3ad9 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/thrift2/table.py @@ -0,0 +1,196 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from typing import List +from thbase.thrift2.operation import Get, Put, Delete, Scan +from thbase.thrift2.cell import Cell +from thbase.hbase.ttypes import TResult +from thbase.util import type_check +from thbase.util.executor import Executor +from thbase.util.bytes import to_bytes +import logging + +logger = logging.getLogger(__name__) + + +class Table(object): + """ + This is a class for doing operations on a specific table. + The object is deprecated to be created by users. + Use Client.get_table(table_name) method to create a table object. + """ + def __init__(self, table_name, client): + self._name = to_bytes(table_name) + self._client = client + self.conf = client.conf + self.executor = Executor(self.conf.retry_times, self.conf.retry_timeout, master=self._client) + + @property + def name(self): + # type: () -> str + return self._name + + def put(self, put): + # type: (Put) -> bool + """ + Send a single Put operation to the thrift server. + Args: + put: A customized Get object. + + Returns: True if successes, False otherwise. + + """ + type_check(put, Put) + return self.executor.call(lambda: self._client._put_row(table_name=self.name, put=put)) + + def put_batch(self, puts): + # type: (List[Put]) -> bool + """ + Send multiple Put requests to the server at one time. + The requests will be sent batch by batch. + The logger will log the failed position if one batch of requests failed. + Args: + puts: A list of Put objects + + Returns: True if successes, False otherwise. + + """ + type_check(puts, list) + for put in puts: + type_check(put, Put) + for i in range(0, len(puts), self.conf.batch_size): + result = self._client._put_rows(table_name=self.name, puts=puts[i: i + self.conf.batch_size]) + if not result: + logger.error("An error occurs at index {}, the Put requests after {} (inclusive) failed.".format(i, i)) + return False + return True + + def get(self, get): + # type: (Get) -> List[Cell] + """ + Send a single Get operation to the thrift server. + Args: + get: A customized Get object. + + Returns: If success: a list of cells. + If success but not matched data: an empty list. + If get failed: False. + + """ + type_check(get, Get) + result = self._client._get_row(table_name=self.name, get=get) + # if result is False, that means the operation failed after retry N times. + # if result is [], that means there is no matched cell in hbase. + if not result: + return [] + return self._results_format(result) + + def get_batch(self, gets): + # type: (List[Get]) -> List[Cell] + """ + Send multiple Get requests to the server at one time. + The requests will be sent batch by batch. + The logger will log the failed position if one batch of requests failed. + Args: + gets: A list of Get objects. + + Returns: If success: a list of cells. + If success but not matched data: an empty list. + If get failed: False. + If partly success, a part result will be returned. + + """ + type_check(gets, (list, tuple)) + for get in gets: + type_check(get, Get) + result_list = [] + for i in range(0, len(gets), self.conf.batch_size): + result = self._client._get_rows(table_name=self.name, gets=gets[i: i + self.conf.batch_size]) + # if result == False, it shows that the operation failed. + # The task should stop and return the successful part. + if result is False: + return self._results_format(result_list) + elif len(result) > 0: + result_list += result + return self._results_format(result_list) + + def scan(self, scan): + # type: (Scan) -> List[Cell] + """ + Send a Scan request to the thrift server. + Args: + scan: A single Scan object. + + Returns:If success: a list of cells. + If success but not matched data: an empty list. + If the start row do not exists, it will raise an IllegalArgument error. + If scan failed: False. + + """ + type_check(scan, Scan) + return self._results_format(self._client._scan(table_name=self.name, scan=scan)) + + def delete(self, delete): + # type: (Delete) -> bool + """ + Send a Delete request to the thrift server. + Args: + delete: a single Delete object + + Returns: True if successes, False otherwise. + + """ + type_check(delete, Delete) + return self._client._delete_row(table_name=self.name, delete=delete) + + def delete_batch(self, batch): + # type: (List[Delete]) -> bool + """ + Send a list of Delete requests to the thrift server. + The requests will be sent batch by batch. + The logger will log the failed position if one batch of requests failed. + Args: + batch: a list of Delete objects. + + Returns: True if successes, False otherwise. + + """ + type_check(batch, (list, tuple)) + for delete in batch: + type_check(delete, Delete) + for i in range(0, len(batch), self.conf.batch_size): + if not [] == self._client._delete_batch(table_name=self.name, + deletes=batch[i: i + self.conf.batch_size]): + logger.error("Delete_batch failed at index {}, the delete requests after {} (inclusive) are not sent.".format(i, i)) + return False + return True + + def _results_format(self, results): + # type: (List[TResult]) -> List[Cell] + """ + @Deprecated + Inner util method. Should not be used by user. + Transform the thrift result to a series of Cell objects. + Args: + results: a list of TResult. + + Returns: an empty list if there is no results or a list of Cell objects. + + """ + result_list = [] # type: List[Cell] + if not results or len(results) == 0: + return [] + for result in results: + for cv in iter(result.columnValues): + result_list.append(Cell(self._name, result.row, cv.family, cv.qualifier, cv.value, cv.timestamp)) + return result_list diff --git a/thrift-python/hbase-client-thrift2/util/__init__.py b/thrift-python/hbase-client-thrift2/util/__init__.py new file mode 100644 index 00000000..08ff2f84 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/util/__init__.py @@ -0,0 +1,47 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from thbase.hbase.ttypes import TTableName +from thbase.util.bytes import to_bytes + +__all__ = ['executor', 'handlers', 'type_check', 'check_none', 'str_to_tablename'] + +DELIMITER = ':' + + +def type_check(var, t): + if not isinstance(var, t): + raise TypeError("A {} object is needed, but got a {}.".format(t.__class, type(var))) + + +def check_none(var, ms): + if var is None: + raise ValueError(ms) + + +def str_to_tablename(name): + check_none(name, "") + type_check(name, str) + names = name.split(DELIMITER) + if len(names) == 1: + return TTableName(ns=to_bytes('default'), qualifier=to_bytes(names[0])) + elif len(names) == 2: + return TTableName(ns=to_bytes(names[0]), qualifier=to_bytes(names[1])) + else: + raise RuntimeError("Get table name with wrong format.") + + +def tablename_to_str(table): + type_check(table, TTableName) + name = DELIMITER.join() + diff --git a/thrift-python/hbase-client-thrift2/util/builder.py b/thrift-python/hbase-client-thrift2/util/builder.py new file mode 100644 index 00000000..92439905 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/util/builder.py @@ -0,0 +1,279 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from thbase.hbase.ttypes import TTableDescriptor +from thbase.hbase.ttypes import TColumnFamilyDescriptor +from thbase.hbase.ttypes import TCompressionAlgorithm +from thbase.hbase.ttypes import TBloomFilterType +from thbase.hbase.ttypes import TDataBlockEncoding +from thbase.hbase.ttypes import TDurability +from thbase.util.bytes import to_bytes +from thbase.util.bytes import to_str +from thbase.util import type_check +from thbase.util import check_none +from thbase.util import str_to_tablename + +COMPRESSION_TYPES = [ + TCompressionAlgorithm.NONE, + TCompressionAlgorithm.GZ, + TCompressionAlgorithm.LZ4, + TCompressionAlgorithm.LZO, + TCompressionAlgorithm.BZIP2, + TCompressionAlgorithm.SNAPPY, + TCompressionAlgorithm.ZSTD, +] + +BLOOMFILTER_TYPES = [ + TBloomFilterType.NONE, + TBloomFilterType.ROW, + TBloomFilterType.ROWCOL, + TBloomFilterType.ROWPREFIX_FIXED_LENGTH +] + +ENCODING_TYPES = [ + TDataBlockEncoding.NONE, + TDataBlockEncoding.DIFF, + TDataBlockEncoding.FAST_DIFF, + TDataBlockEncoding.PREFIX, + TDataBlockEncoding.ROW_INDEX_V1 +] + + +class ColumnDescriptorBuilder(object): + + def __init__(self, name=None): + type_check(name, str) + self.name = name + self.attributes = {} + self.configuration = {} + self.blockSize = None + self.bloomnFilterType = None + self.compressionType = None + self.dfsReplication = None + self.dataBlockEncoding = None + self.keepDeletedCells = None + self.maxVersions = None + self.minVersions = None + self.scope = None + self.timeToLive = None + self.blockCacheEnabled = None + self.cacheBloomsOnWrite = None + self.cacheDataOnWrite = None + self.cacheIndexesOnWrite = None + self.compressTags = None + self.evictBlocksOnClose = None + self.inMemory = None + + def build(self): + return TColumnFamilyDescriptor(name=to_bytes(self.name), attributes=self.attributes, + configuration=self.configuration, + blockSize=self.blockSize, bloomnFilterType=self.bloomnFilterType, + compressionType=self.compressionType, dfsReplication=self.dfsReplication, + dataBlockEncoding=self.dataBlockEncoding, keepDeletedCells=self.keepDeletedCells, + maxVersions=self.maxVersions, minVersions=self.minVersions, scope=self.scope, + timeToLive=self.timeToLive, blockCacheEnabled=self.blockCacheEnabled, + cacheBloomsOnWrite=self.cacheBloomsOnWrite, + cacheDataOnWrite=self.cacheDataOnWrite, + cacheIndexesOnWrite=self.cacheIndexesOnWrite, compressTags=self.compressTags, + evictBlocksOnClose=self.evictBlocksOnClose, inMemory=self.inMemory) + + def copy_from_exist(self, desc): + type_check(desc, TColumnFamilyDescriptor) + self.name = desc.name + self.attributes = desc.attributes + self.configuration = desc.configuration + self.blockSize = desc.blockSize + self.bloomnFilterType = desc.bloomnFilterType + self.compressionType = desc.compressionType + self.dfsReplication = desc.dfsReplication + self.dataBlockEncoding = desc.dataBlockEncoding + self.keepDeletedCells = desc.keepDeletedCells + self.maxVersions = desc.maxVersions + self.minVersions = desc.minVersions + self.scope = desc.scope + self.timeToLive = desc.timeToLive + self.blockCacheEnabled = desc.blockCacheEnabled if desc.blockCacheEnabled else None + self.cacheBloomsOnWrite = desc.cacheBloomsOnWrite if desc.cacheBloomsOnWrite else None + self.cacheDataOnWrite = desc.cacheDataOnWrite if desc.cacheDataOnWrite else None + self.cacheIndexesOnWrite = desc.cacheIndexesOnWrite if desc.cacheIndexesOnWrite else None + self.compressTags = desc.compressTags if desc.compressTags else None + self.evictBlocksOnClose = desc.evictBlocksOnClose + self.inMemory = desc.inMemory if desc.inMemory else None + + def add_attribute(self, key, value): + check_none(key, "Attribute name is None.") + if value is None and key in self.attributes: + self.attributes.pop(key) + else: + self.attributes[to_bytes(key)] = to_bytes(value) + return self + + def add_configuration(self, key, value): + check_none(key, "Configuration key is None.") + if value is None and key in self.configuration: + self.configuration.pop(key) + else: + self.configuration[to_bytes(key)] = to_bytes(value) + return self + + def set_compressionType(self, compress_type): + if compress_type not in COMPRESSION_TYPES: + raise RuntimeError("Unknown compression algorithm {}".format(compress_type)) + self.compressionType = compress_type + return self + + def set_blockSize(self, bs): + type_check(bs, int) + if bs < 1: + raise RuntimeError("Illegal block size " + bs) + self.blockSize = bs + return self + + def set_bloomnFilterType(self, bf): + if bf not in BLOOMFILTER_TYPES: + raise RuntimeError("Unknown bloom filter type {}".format(bf)) + self.bloomnFilterType = bf + return self + + def set_dfsReplication(self, hr): + type_check(hr, int) + if hr < 1: + raise RuntimeError("Illegal number of dfs replication {}".format(hr)) + self.dfsReplication = hr + + def set_dataBlockEncoding(self, encoding_type): + if encoding_type not in ENCODING_TYPES: + raise RuntimeError("Illegal data block encoding type {}".format(encoding_type)) + self.dataBlockEncoding = encoding_type + return self + + def set_keepDeletedCells(self, kdc): + type_check(kdc, bool) + self.keepDeletedCells = kdc + return self + + def set_maxVersions(self, mv): + type_check(mv, int) + if mv < 1: + raise RuntimeError("Illegal max versions number {}".format(mv)) + self.maxVersions = mv + return self + + def set_minVersions(self, mv): + type_check(mv, int) + if mv < 0: + raise RuntimeError("Illegal min versions number {}".format(mv)) + self.minVersions = mv + return self + + def set_scope(self, scope): + type_check(scope, int) + if scope < 0: + raise RuntimeError("Illegal replication scope value {}".format(scope)) + self.scope = scope + return self + + def set_timeToLive(self, ttl): + type_check(ttl, int) + if ttl < 1: + raise RuntimeError("Illegal TTL value {}".format(ttl)) + self.timeToLive = ttl + return self + + def set_blockCacheEnabled(self, enabled): + type_check(enabled, bool) + self.blockCacheEnabled = enabled + return self + + def set_cacheBloomsOnWrite(self, value): + type_check(value, bool) + self.cacheBloomsOnWrite = value + return self + + def set_cacheDataOnWrite(self, value): + type_check(value, bool) + self.cacheBloomsOnWrite = value + return self + + def set_cacheIndexesOnWrite(self, value): + type_check(value, bool) + self.cacheIndexesOnWrite = value + return self + + def set_compressTags(self, value): + type_check(value, bool) + self.compressTags = value + return self + + def set_evictBlocksOnClose(self, value): + type_check(value, bool) + self.evictBlocksOnClose = value + return self + + def set_inMemory(self, value): + type_check(value, bool) + self.inMemory = value + return self + + +DURABILITY_TYPES = [ + TDurability.SKIP_WAL, + TDurability.SYNC_WAL, + TDurability.ASYNC_WAL, + TDurability.FSYNC_WAL, + TDurability.USE_DEFAULT +] + + +class TableDescriptorBuilder(object): + + def __init__(self, name): + self.name = name + self.columns = [] + self.attributes = {} + self.durability = None + + def build(self): + return TTableDescriptor(tableName=str_to_tablename(self.name), + columns=self.columns, + attributes=self.attributes, + durability=self.durability) + + def copy_from_exist(self, desc): + type_check(desc, TTableDescriptor) + self.name = ':'.join([to_str(desc.tableName.ns), to_str(desc.tableName.qualifier)]) + self.columns = desc.columns + + def add_column(self, col): + type_check(col, TColumnFamilyDescriptor) + for i in range(len(self.columns)): + if col.name == self.columns[i].name: + self.columns[i] = col + return self + self.columns.append(col) + return self + + def add_attributes(self, key, value): + check_none(key, "None key found.") + if value is None: + if key in self.attributes: + self.attributes.pop(key) + else: + self.attributes[to_bytes(key)] = to_bytes(value) + return self + + def set_durability(self, value): + if value not in DURABILITY_TYPES: + raise RuntimeError("Illegal durability type {}".format(value)) + self.durability = value + return self diff --git a/thrift-python/hbase-client-thrift2/util/bytes.py b/thrift-python/hbase-client-thrift2/util/bytes.py new file mode 100644 index 00000000..6faa3152 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/util/bytes.py @@ -0,0 +1,26 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from sys import version_info + + +def to_bytes(origin): + if version_info.major == 3: + return bytes(origin, 'utf-8') if isinstance(origin, str) else origin + return bytes(origin) if isinstance(origin, str) else origin + + +def to_str(origin): + if version_info.major == 3: + return origin.decode('utf-8') if isinstance(origin, bytes) else origin + return str(origin) if isinstance(origin, bytes) else origin diff --git a/thrift-python/hbase-client-thrift2/util/executor.py b/thrift-python/hbase-client-thrift2/util/executor.py new file mode 100644 index 00000000..66d9ac71 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/util/executor.py @@ -0,0 +1,67 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from thbase.util.handlers import ExceptionHandler, MessageType +from thbase.hbase.ttypes import TException + +import logging +import time + +logger = logging.getLogger(__name__) + + +class Executor(object): + def __init__(self, retry_times, retry_timeout, master): + self._retry_times = retry_times + self._retry_timeout = retry_timeout + self._master = master + self.handler = ExceptionHandler(self._master) + + def call(self, func): + """ + Execute a specific function with given parameters. + If the system meets an exception the exception handler will try to handle it. + If the exception is critical and can not be handled, it will be raised and interrupt the system. + If the exception is acceptable, the system will retry the operation for several times (set in config). + After retrying, if the system still cannot get a valid value, + the function will be marked as failed and return a False. + Args: + func: A callable function. + + Returns: + For Put, Delete operations: True if success, False otherwise. + For Get, Scan operations: A list of results, False otherwise. + """ + if not callable(func): + raise ValueError("A callable function needed here but got {}.".format(type(func))) + for i in range(self._retry_times + 1): + try: + result = func() + # if result is None, the func is Put, or Delete, + # so should return a bool to represent if the operation successes. + if result is None: + return True + # when result is not None, it contains a list of TResult objects with Get and Scan operation. + # so here return the list directly. + return result + except TException as e: + if not self.handler.handle(MessageType.ERROR, value=e): + logger.error("There occurs an error that can not be handled. {}. " + "System is shutdown.".format(e.message)) + raise e + else: + logger.warn("An error occurs, {}. Redo the operation after {} seconds.". + format(e.message, self._retry_timeout)) + time.sleep(self._retry_timeout) + # this False means the operation failed after retry N times. + return False diff --git a/thrift-python/hbase-client-thrift2/util/handlers.py b/thrift-python/hbase-client-thrift2/util/handlers.py new file mode 100644 index 00000000..411d9667 --- /dev/null +++ b/thrift-python/hbase-client-thrift2/util/handlers.py @@ -0,0 +1,123 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from enum import Enum +from thbase.hbase.ttypes import TApplicationException, TIOError, TIllegalArgument +from thrift.transport.TTransport import TTransportException +import abc +import logging +logger = logging.getLogger(__name__) + + +class Observer(object): + """ + Abstract class for Observer design pattern. + """ + def __init__(self, target): + self.target = target + + @abc.abstractmethod + def handle(self, **kwargs): + pass + + +MessageType = Enum('MessageType', ["ERROR"]) + + +class ExceptionHandler(Observer): + """ + This class responses to all exceptions that caught in the client operations, + including network exceptions, thrift exceptions and HBase exceptions. + """ + def __init__(self, target): + super(ExceptionHandler, self).__init__(target) + + def handle(self, message_type, value): + """ + The main method to deal with Exceptions. + TODO:Support more kinds of Exceptions. + Args: + message_type: Defined by the enum MessageType. + value: The message should be scoped with. + + Returns:True if the exception fixed. If not, the exception will be raised further. + + """ + if message_type not in MessageType: + raise ValueError("Unknown message type.") + if message_type == MessageType.ERROR: + if isinstance(value, TIOError): + error_str = "Connection errors occurred between thrift server and hbase server." \ + "The error message is: {}".format(value.message) + try: + if value.canRetry: + logger.warning(error_str + " The error may be solved by retrying." + " Client will resend the request.") + return True + else: + logger.error(error_str + " The error cannot be solved by resend the request, client will shutdown.") + raise value + except AttributeError: + raise AttributeError("The IOError does not contain the canRetry mark. The error will be raised. " + "Please check if the client version is too old.") + if isinstance(value, TTransportException): + if value.type == TTransportException.NOT_OPEN or value.type == TTransportException.TIMED_OUT: + logger.warning("A transport error occurs, the message is: {}".format(value.message)) + logger.warning("System will try to rebuild the connection to solve it.") + self.target.connection._reconnect() + self.target._refresh_client() + return True + if value.type == TTransportException.ALREADY_OPEN: + logger.error("A transport error occurs. The message is: {}".format(value.message)) + if value.type == TTransportException.INVALID_CLIENT_TYPE: + logger.error("A transport error occurs. The message is: {}".format(value.message)) + if value.type == TTransportException.NEGATIVE_SIZE: + logger.error("The server read a frame with negative length. " + + "Please check your encoding charset and data format.\n" + + "Detailed information is {}.".format(value.message)) + if value.type == TTransportException.SIZE_LIMIT: + logger.error("A transport error occurs. The message is: {}".format(value.message)) + if value.type == TTransportException.END_OF_FILE: + logger.error("A transport error occurs. The message is: {}".format(value.message)) + if value.type == TTransportException.UNKNOWN: + messages = ["Unknown error occurs with tcp transport. ", + "This may occur with the following reasons:\n", + "1. There is a transport or protocol mismatch between the server and the client.\n", + "2. The queue of the server is full.\n", + "3. The volume of the sent requests exceed the volume limit of the server.\n"] + logger.error("".join(messages)) + raise value + elif isinstance(value, TApplicationException): + if value.type == TApplicationException.INVALID_MESSAGE_TYPE: + logger.error("An thrift internal error occurs. The message is: {}".format(value.message)) + if value.type == TApplicationException.BAD_SEQUENCE_ID: + logger.error("An thrift internal error occurs. The message is: {}".format(value.message)) + if value.type == TApplicationException.INVALID_PROTOCOL: + logger.error("An thrift internal error occurs. The message is: {}".format(value.message)) + if value.type == TApplicationException.INVALID_TRANSFORM: + logger.error("An thrift internal error occurs. The message is: {}".format(value.message)) + if value.type == TApplicationException.INTERNAL_ERROR: + logger.error("An thrift internal error occurs. The message is: {}".format(value.message)) + if value.type == TApplicationException.UNKNOWN_METHOD: + logger.error("{}. \n" + + "This error happens when the client code outdated. Please update the client code " + "first.\n" + + "If the problem still exists, please contact with the responsive person.\n") + raise value + elif isinstance(value, TIllegalArgument): + logger.error(value.message) + logger.error("This error is usually caused by invalid arguments. " + "For example, in the Scan operation the start row does not exist. " + "Please check the attributes of your Operation object and try again.") + raise value + diff --git a/thrift-python/hbase-client-thrift2/util/login.py b/thrift-python/hbase-client-thrift2/util/login.py new file mode 100644 index 00000000..79255eee --- /dev/null +++ b/thrift-python/hbase-client-thrift2/util/login.py @@ -0,0 +1,36 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +class LoginEntry(object): + + def __init__(self, username=None, password=None, service='tcp', mechanism='PLAIN'): + self._username = username + self._password = password + self._service = service + self._mechanism = mechanism + + @property + def username(self): + return self._username + + @property + def password(self): + return self._password + + @property + def service(self): + return self._service + + @property + def mechanism(self): + return self._mechanism diff --git a/thrift-python/setup.py b/thrift-python/setup.py new file mode 100644 index 00000000..512222a2 --- /dev/null +++ b/thrift-python/setup.py @@ -0,0 +1,44 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from setuptools import setup, find_packages +from os import path +from sys import version_info +here = path.abspath(path.dirname(__file__)) +if version_info.major == 3: + with open(path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = f.read() +else: + with open(path.join(here, 'README.md')) as f: + long_description = f.read() + +setup( + name='hbase-client-thrift2', + version='2.0', + description='Apache HBase thrift2 client.', + long_description=long_description, + long_description_content_type='text/markdown', + # Author details + author='Apache HBase Community', + author_email='dev@hbase.apache.org', + url='', + classifiers=[ + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3" + ], + packages=find_packages(), + py_modules=["thbase"], + install_requires=["thrift==0.13.0", "enum34", "typing", "pure-sasl"] +) \ No newline at end of file