#!/usr/bin/env python
#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#  @generated
#

from __future__ import print_function
from __future__ import absolute_import

import os
import sys

if (not sys.argv[0].endswith("par") and
    not sys.argv[0].endswith("xar") and
    os.getenv('PAR_UNPACK_TMP') == None):

    f = open(sys.argv[0], "r")

    f.readline() # This will be #!/bin/bash
    line = f.readline()
    f.close()

    # The par generator tool always has '# This par was made' as the
    # second line. See fbcode/tools/make_par/make_par.py
    if (not line.startswith('# This par was made')):
        print("""WARNING
        You are trying to run *-remote.py which is
        incorrect as the paths are not set up correctly.
        Instead, you should generate your thrift file with
        thrift_library and then run the resulting
        *-remote.par.
        For more information, please read
        http://fburl.com/python-remotes""")
        exit()

from . import StorageAdminService
from . import ttypes

from nebula3.fbthrift.util.remote import Function
from nebula3.fbthrift.remote import Remote

FUNCTIONS = {
    'transLeader': Function('transLeader', 'StorageAdminService', 'AdminExecResp', [('TransLeaderReq', 'req', 'TransLeaderReq')]),
    'addPart': Function('addPart', 'StorageAdminService', 'AdminExecResp', [('AddPartReq', 'req', 'AddPartReq')]),
    'addLearner': Function('addLearner', 'StorageAdminService', 'AdminExecResp', [('AddLearnerReq', 'req', 'AddLearnerReq')]),
    'removePart': Function('removePart', 'StorageAdminService', 'AdminExecResp', [('RemovePartReq', 'req', 'RemovePartReq')]),
    'memberChange': Function('memberChange', 'StorageAdminService', 'AdminExecResp', [('MemberChangeReq', 'req', 'MemberChangeReq')]),
    'waitingForCatchUpData': Function('waitingForCatchUpData', 'StorageAdminService', 'AdminExecResp', [('CatchUpDataReq', 'req', 'CatchUpDataReq')]),
    'createCheckpoint': Function('createCheckpoint', 'StorageAdminService', 'CreateCPResp', [('CreateCPRequest', 'req', 'CreateCPRequest')]),
    'dropCheckpoint': Function('dropCheckpoint', 'StorageAdminService', 'DropCPResp', [('DropCPRequest', 'req', 'DropCPRequest')]),
    'blockingWrites': Function('blockingWrites', 'StorageAdminService', 'BlockingSignResp', [('BlockingSignRequest', 'req', 'BlockingSignRequest')]),
    'getLeaderParts': Function('getLeaderParts', 'StorageAdminService', 'GetLeaderPartsResp', [('GetLeaderReq', 'req', 'GetLeaderReq')]),
    'checkPeers': Function('checkPeers', 'StorageAdminService', 'AdminExecResp', [('CheckPeersReq', 'req', 'CheckPeersReq')]),
    'addAdminTask': Function('addAdminTask', 'StorageAdminService', 'AddTaskResp', [('AddTaskRequest', 'req', 'AddTaskRequest')]),
    'stopAdminTask': Function('stopAdminTask', 'StorageAdminService', 'StopTaskResp', [('StopTaskRequest', 'req', 'StopTaskRequest')]),
    'clearSpace': Function('clearSpace', 'StorageAdminService', 'ClearSpaceResp', [('ClearSpaceReq', 'req', 'ClearSpaceReq')]),
}

SERVICE_NAMES = ['StorageAdminService', ]

if __name__ == '__main__':
    Remote.run(FUNCTIONS, SERVICE_NAMES, StorageAdminService, ttypes, sys.argv, default_port=9090)
