All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iotdb.thrift.cluster.TSDataService-remote Maven / Gradle / Ivy

There is a newer version: 0.13.4
Show newest version
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.14.1)
#
# 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 iotdb.thrift.cluster import TSDataService
from iotdb.thrift.cluster.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('  long querySingleSeries(SingleSeriesQueryRequest request)')
    print('  long queryMultSeries(MultSeriesQueryRequest request)')
    print('  string fetchSingleSeries(RaftNode header, long readerId)')
    print('   fetchMultSeries(RaftNode header, long readerId,  paths)')
    print('  long querySingleSeriesByTimestamp(SingleSeriesQueryRequest request)')
    print('  string fetchSingleSeriesByTimestamps(RaftNode header, long readerId,  timestamps)')
    print('  void endQuery(RaftNode header, Node thisNode, long queryId)')
    print('  GetAllPathsResult getAllPaths(RaftNode header,  paths, bool withAlias)')
    print('   getAllDevices(RaftNode header,  path, bool isPrefixMatch)')
    print('  string getDevices(RaftNode header, string planBinary)')
    print('   getNodeList(RaftNode header, string path, int nodeLevel)')
    print('   getChildNodeInNextLevel(RaftNode header, string path)')
    print('   getChildNodePathInNextLevel(RaftNode header, string path)')
    print('  string getAllMeasurementSchema(MeasurementSchemaRequest request)')
    print('   getAggrResult(GetAggrResultRequest request)')
    print('   getUnregisteredTimeseries(RaftNode header,  timeseriesList)')
    print('  PullSnapshotResp pullSnapshot(PullSnapshotRequest request)')
    print('  long getGroupByExecutor(GroupByRequest request)')
    print('   getGroupByResult(RaftNode header, long executorId, long startTime, long endTime)')
    print('  PullSchemaResp pullTimeSeriesSchema(PullSchemaRequest request)')
    print('  PullSchemaResp pullMeasurementSchema(PullSchemaRequest request)')
    print('  string previousFill(PreviousFillRequest request)')
    print('  string last(LastQueryRequest request)')
    print('  int getPathCount(RaftNode header,  pathsToQuery, int level)')
    print('  int getDeviceCount(RaftNode header,  pathsToQuery)')
    print('  bool onSnapshotApplied(RaftNode header,  slots)')
    print('  string peekNextNotNullValue(RaftNode header, long executorId, long startTime, long endTime)')
    print('  HeartBeatResponse sendHeartbeat(HeartBeatRequest request)')
    print('  long startElection(ElectionRequest request)')
    print('  long appendEntries(AppendEntriesRequest request)')
    print('  long appendEntry(AppendEntryRequest request)')
    print('  void sendSnapshot(SendSnapshotRequest request)')
    print('  TSStatus executeNonQueryPlan(ExecutNonQueryReq request)')
    print('  RequestCommitIndexResponse requestCommitIndex(RaftNode header)')
    print('  string readFile(string filePath, long offset, int length)')
    print('  bool matchTerm(long index, long term, RaftNode header)')
    print('  void removeHardLink(string hardLinkPath)')
    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 = TSDataService.Client(protocol)
transport.open()

if cmd == 'querySingleSeries':
    if len(args) != 1:
        print('querySingleSeries requires 1 args')
        sys.exit(1)
    pp.pprint(client.querySingleSeries(eval(args[0]),))

elif cmd == 'queryMultSeries':
    if len(args) != 1:
        print('queryMultSeries requires 1 args')
        sys.exit(1)
    pp.pprint(client.queryMultSeries(eval(args[0]),))

elif cmd == 'fetchSingleSeries':
    if len(args) != 2:
        print('fetchSingleSeries requires 2 args')
        sys.exit(1)
    pp.pprint(client.fetchSingleSeries(eval(args[0]), eval(args[1]),))

elif cmd == 'fetchMultSeries':
    if len(args) != 3:
        print('fetchMultSeries requires 3 args')
        sys.exit(1)
    pp.pprint(client.fetchMultSeries(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'querySingleSeriesByTimestamp':
    if len(args) != 1:
        print('querySingleSeriesByTimestamp requires 1 args')
        sys.exit(1)
    pp.pprint(client.querySingleSeriesByTimestamp(eval(args[0]),))

elif cmd == 'fetchSingleSeriesByTimestamps':
    if len(args) != 3:
        print('fetchSingleSeriesByTimestamps requires 3 args')
        sys.exit(1)
    pp.pprint(client.fetchSingleSeriesByTimestamps(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'endQuery':
    if len(args) != 3:
        print('endQuery requires 3 args')
        sys.exit(1)
    pp.pprint(client.endQuery(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'getAllPaths':
    if len(args) != 3:
        print('getAllPaths requires 3 args')
        sys.exit(1)
    pp.pprint(client.getAllPaths(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'getAllDevices':
    if len(args) != 3:
        print('getAllDevices requires 3 args')
        sys.exit(1)
    pp.pprint(client.getAllDevices(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'getDevices':
    if len(args) != 2:
        print('getDevices requires 2 args')
        sys.exit(1)
    pp.pprint(client.getDevices(eval(args[0]), args[1],))

elif cmd == 'getNodeList':
    if len(args) != 3:
        print('getNodeList requires 3 args')
        sys.exit(1)
    pp.pprint(client.getNodeList(eval(args[0]), args[1], eval(args[2]),))

elif cmd == 'getChildNodeInNextLevel':
    if len(args) != 2:
        print('getChildNodeInNextLevel requires 2 args')
        sys.exit(1)
    pp.pprint(client.getChildNodeInNextLevel(eval(args[0]), args[1],))

elif cmd == 'getChildNodePathInNextLevel':
    if len(args) != 2:
        print('getChildNodePathInNextLevel requires 2 args')
        sys.exit(1)
    pp.pprint(client.getChildNodePathInNextLevel(eval(args[0]), args[1],))

elif cmd == 'getAllMeasurementSchema':
    if len(args) != 1:
        print('getAllMeasurementSchema requires 1 args')
        sys.exit(1)
    pp.pprint(client.getAllMeasurementSchema(eval(args[0]),))

elif cmd == 'getAggrResult':
    if len(args) != 1:
        print('getAggrResult requires 1 args')
        sys.exit(1)
    pp.pprint(client.getAggrResult(eval(args[0]),))

elif cmd == 'getUnregisteredTimeseries':
    if len(args) != 2:
        print('getUnregisteredTimeseries requires 2 args')
        sys.exit(1)
    pp.pprint(client.getUnregisteredTimeseries(eval(args[0]), eval(args[1]),))

elif cmd == 'pullSnapshot':
    if len(args) != 1:
        print('pullSnapshot requires 1 args')
        sys.exit(1)
    pp.pprint(client.pullSnapshot(eval(args[0]),))

elif cmd == 'getGroupByExecutor':
    if len(args) != 1:
        print('getGroupByExecutor requires 1 args')
        sys.exit(1)
    pp.pprint(client.getGroupByExecutor(eval(args[0]),))

elif cmd == 'getGroupByResult':
    if len(args) != 4:
        print('getGroupByResult requires 4 args')
        sys.exit(1)
    pp.pprint(client.getGroupByResult(eval(args[0]), eval(args[1]), eval(args[2]), eval(args[3]),))

elif cmd == 'pullTimeSeriesSchema':
    if len(args) != 1:
        print('pullTimeSeriesSchema requires 1 args')
        sys.exit(1)
    pp.pprint(client.pullTimeSeriesSchema(eval(args[0]),))

elif cmd == 'pullMeasurementSchema':
    if len(args) != 1:
        print('pullMeasurementSchema requires 1 args')
        sys.exit(1)
    pp.pprint(client.pullMeasurementSchema(eval(args[0]),))

elif cmd == 'previousFill':
    if len(args) != 1:
        print('previousFill requires 1 args')
        sys.exit(1)
    pp.pprint(client.previousFill(eval(args[0]),))

elif cmd == 'last':
    if len(args) != 1:
        print('last requires 1 args')
        sys.exit(1)
    pp.pprint(client.last(eval(args[0]),))

elif cmd == 'getPathCount':
    if len(args) != 3:
        print('getPathCount requires 3 args')
        sys.exit(1)
    pp.pprint(client.getPathCount(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'getDeviceCount':
    if len(args) != 2:
        print('getDeviceCount requires 2 args')
        sys.exit(1)
    pp.pprint(client.getDeviceCount(eval(args[0]), eval(args[1]),))

elif cmd == 'onSnapshotApplied':
    if len(args) != 2:
        print('onSnapshotApplied requires 2 args')
        sys.exit(1)
    pp.pprint(client.onSnapshotApplied(eval(args[0]), eval(args[1]),))

elif cmd == 'peekNextNotNullValue':
    if len(args) != 4:
        print('peekNextNotNullValue requires 4 args')
        sys.exit(1)
    pp.pprint(client.peekNextNotNullValue(eval(args[0]), eval(args[1]), eval(args[2]), eval(args[3]),))

elif cmd == 'sendHeartbeat':
    if len(args) != 1:
        print('sendHeartbeat requires 1 args')
        sys.exit(1)
    pp.pprint(client.sendHeartbeat(eval(args[0]),))

elif cmd == 'startElection':
    if len(args) != 1:
        print('startElection requires 1 args')
        sys.exit(1)
    pp.pprint(client.startElection(eval(args[0]),))

elif cmd == 'appendEntries':
    if len(args) != 1:
        print('appendEntries requires 1 args')
        sys.exit(1)
    pp.pprint(client.appendEntries(eval(args[0]),))

elif cmd == 'appendEntry':
    if len(args) != 1:
        print('appendEntry requires 1 args')
        sys.exit(1)
    pp.pprint(client.appendEntry(eval(args[0]),))

elif cmd == 'sendSnapshot':
    if len(args) != 1:
        print('sendSnapshot requires 1 args')
        sys.exit(1)
    pp.pprint(client.sendSnapshot(eval(args[0]),))

elif cmd == 'executeNonQueryPlan':
    if len(args) != 1:
        print('executeNonQueryPlan requires 1 args')
        sys.exit(1)
    pp.pprint(client.executeNonQueryPlan(eval(args[0]),))

elif cmd == 'requestCommitIndex':
    if len(args) != 1:
        print('requestCommitIndex requires 1 args')
        sys.exit(1)
    pp.pprint(client.requestCommitIndex(eval(args[0]),))

elif cmd == 'readFile':
    if len(args) != 3:
        print('readFile requires 3 args')
        sys.exit(1)
    pp.pprint(client.readFile(args[0], eval(args[1]), eval(args[2]),))

elif cmd == 'matchTerm':
    if len(args) != 3:
        print('matchTerm requires 3 args')
        sys.exit(1)
    pp.pprint(client.matchTerm(eval(args[0]), eval(args[1]), eval(args[2]),))

elif cmd == 'removeHardLink':
    if len(args) != 1:
        print('removeHardLink requires 1 args')
        sys.exit(1)
    pp.pprint(client.removeHardLink(args[0],))

else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)

transport.close()




© 2015 - 2025 Weber Informatics LLC | Privacy Policy