add fb303 to thrift contrib
Summary: Add clean version of fb303 to thrift contrib readying for open sourcing scribe
Reviewed By: dreiss
Test Plan: bootstrap.sh, make, make install on a fresh machine and then try compiling and running scribe open source version.
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 10841
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665634 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/contrib/fb303/COPYING b/contrib/fb303/COPYING
new file mode 100644
index 0000000..039f21e
--- /dev/null
+++ b/contrib/fb303/COPYING
@@ -0,0 +1,24 @@
+Thrift Software License
+Copyright (c) 2006- Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/fb303/LICENSE b/contrib/fb303/LICENSE
new file mode 100644
index 0000000..039f21e
--- /dev/null
+++ b/contrib/fb303/LICENSE
@@ -0,0 +1,24 @@
+Thrift Software License
+Copyright (c) 2006- Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/fb303/Makefile.am b/contrib/fb303/Makefile.am
new file mode 100644
index 0000000..1fa2bec
--- /dev/null
+++ b/contrib/fb303/Makefile.am
@@ -0,0 +1,12 @@
+@GLOBAL_HEADER_MK@
+
+@PRODUCT_MK@
+
+SUBDIRS = . cpp py
+
+BUILT_SOURCES =
+
+
+clean-local: clean-common
+
+@GLOBAL_FOOTER_MK@
diff --git a/contrib/fb303/README b/contrib/fb303/README
new file mode 100644
index 0000000..ee0d0b2
--- /dev/null
+++ b/contrib/fb303/README
@@ -0,0 +1,33 @@
+Project FB303: The Facebook Bassline
+------------------------------------
+
+* Curious about the 303? *
+http://en.wikipedia.org/wiki/Roland_TB-303
+
+* Why the name? *
+The TB303 makes bass lines.
+.Bass is what lies underneath any strong tune.
+..fb303 is the shared root of all thrift services.
+...fb303 => FacebookBase303.
+
+* How do I use this? *
+Take a look at the examples to see how your backend project can
+and should inherit from this service.
+
+* What does it provide? *
+A standard interface to monitoring, dynamic options and configuration,
+uptime reports, activity, etc.
+
+* I want more. *
+Think carefully first about whether the functionality you are going to add
+belongs here or in your application. If it can be abstracted and is generally
+useful, then it probably belongs somewhere in the fb303 tree. Keep in mind,
+not every product has to use ALL the functionality of fb303, but every product
+CANNOT use functionality that is NOT in fb303.
+
+* Is this open source? *
+Yes. fb303 is distributed under the Thrift Software License. See the
+LICENSE file for more details.
+
+* Who wrote this README? *
+mcslee@facebook.com
diff --git a/contrib/fb303/acinclude.m4 b/contrib/fb303/acinclude.m4
new file mode 100644
index 0000000..5f882ba
--- /dev/null
+++ b/contrib/fb303/acinclude.m4
@@ -0,0 +1,253 @@
+AC_DEFUN([FB_INITIALIZE],
+[
+AM_INIT_AUTOMAKE([ foreign 1.9.5 no-define ])
+if test "x$1" = "xlocalinstall"; then
+wdir=`pwd`
+# To use $wdir undef quote.
+#
+##########
+AC_PREFIX_DEFAULT([`pwd`/install])
+echo
+fi
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_RANLIB(RANLIB, ranlib)
+AC_PATH_PROGS(BASH, bash)
+AC_PATH_PROGS(PERL, perl)
+AC_PATH_PROGS(PYTHON, python)
+AC_PATH_PROGS(AR, ar)
+AC_PATH_PROGS(ANT, ant)
+PRODUCT_MK=""
+])
+
+AC_DEFUN([FB_WITH_EXTERNAL_PATH],
+[
+cdir=`pwd`
+AC_MSG_CHECKING([Checking EXTERNAL_PATH set to])
+AC_ARG_WITH([externalpath],
+ [ --with-externalpath=DIR User specified path to external facebook components.],
+ [
+ if test "x${EXTERNAL_PATH}" != "x"; then
+ echo ""
+ echo "ERROR: You have already set EXTERNAL_PATH in your environment"
+ echo "Cannot override it using --with-externalpath. Unset EXTERNAL_PATH to use this option"
+ exit 1
+ fi
+ EXTERNAL_PATH=$withval
+ ],
+ [
+ if test "x${EXTERNAL_PATH}" = "x"; then
+ EXTERNAL_PATH=$1
+ fi
+ ]
+)
+if test "x${EXTERNAL_PATH}" = "x"; then
+ export EXTERNAL_PATH="$cdir/external"
+ GLOBAL_HEADER_MK="include ${EXTERNAL_PATH}/global_header.mk"
+ GLOBAL_FOOTER_MK="include ${EXTERNAL_PATH}/global_footer.mk"
+else
+ export EXTERNAL_PATH
+ GLOBAL_HEADER_MK="include ${EXTERNAL_PATH}/global_header.mk"
+ GLOBAL_FOOTER_MK="include ${EXTERNAL_PATH}/global_footer.mk"
+fi
+AC_MSG_RESULT($EXTERNAL_PATH)
+if test ! -d ${EXTERNAL_PATH}; then
+ echo ""
+ echo "ERROR: EXTERNAL_PATH set to an nonexistent directory ${EXTERNAL_PATH}"
+ exit 1
+fi
+AC_SUBST(EXTERNAL_PATH)
+AC_SUBST(GLOBAL_HEADER_MK)
+AC_SUBST(GLOBAL_FOOTER_MK)
+])
+
+# Set option to enable shared mode. Set DEBUG and OPT for use in Makefile.am.
+AC_DEFUN([FB_ENABLE_DEFAULT_OPT_BUILD],
+[
+AC_MSG_CHECKING([whether to enable optimized build])
+AC_ARG_ENABLE([opt],
+ [ --disable-opt Set up debug mode.],
+ [
+ ENABLED_OPT=$enableval
+ ],
+ [
+ ENABLED_OPT="yes"
+ ]
+)
+if test "$ENABLED_OPT" = "yes"
+then
+ CFLAGS="-Wall -O3"
+ CXXFLAGS="-Wall -O3"
+else
+ CFLAGS="-Wall -g"
+ CXXFLAGS="-Wall -g"
+fi
+AC_MSG_RESULT($ENABLED_OPT)
+AM_CONDITIONAL([OPT], [test "$ENABLED_OPT" = yes])
+AM_CONDITIONAL([DEBUG], [test "$ENABLED_OPT" = no])
+])
+
+# Set option to enable debug mode. Set DEBUG and OPT for use in Makefile.am.
+AC_DEFUN([FB_ENABLE_DEFAULT_DEBUG_BUILD],
+[
+AC_MSG_CHECKING([whether to enable debug build])
+AC_ARG_ENABLE([debug],
+ [ --disable-debug Set up opt mode.],
+ [
+ ENABLED_DEBUG=$enableval
+ ],
+ [
+ ENABLED_DEBUG="yes"
+ ]
+)
+if test "$ENABLED_DEBUG" = "yes"
+then
+ CFLAGS="-Wall -g"
+ CXXFLAGS="-Wall -g"
+else
+ CFLAGS="-Wall -O3"
+ CXXFLAGS="-Wall -O3"
+fi
+AC_MSG_RESULT($ENABLED_DEBUG)
+AM_CONDITIONAL([DEBUG], [test "$ENABLED_DEBUG" = yes])
+AM_CONDITIONAL([OPT], [test "$ENABLED_DEBUG" = no])
+])
+
+# Set option to enable static libs.
+AC_DEFUN([FB_ENABLE_DEFAULT_STATIC],
+[
+SHARED=""
+STATIC=""
+AC_MSG_CHECKING([whether to enable static mode])
+AC_ARG_ENABLE([static],
+ [ --disable-static Set up shared mode.],
+ [
+ ENABLED_STATIC=$enableval
+ ],
+ [
+ ENABLED_STATIC="yes"
+ ]
+)
+if test "$ENABLED_STATIC" = "yes"
+then
+ LTYPE=".a"
+else
+ LTYPE=".so"
+ SHARED_CXXFLAGS="-fPIC"
+ SHARED_CFLAGS="-fPIC"
+ SHARED_LDFLAGS="-shared -fPIC"
+ AC_SUBST(SHARED_CXXFLAGS)
+ AC_SUBST(SHARED_CFLAGS)
+ AC_SUBST(SHARED_LDFLAGS)
+fi
+AC_MSG_RESULT($ENABLED_STATIC)
+AC_SUBST(LTYPE)
+AM_CONDITIONAL([STATIC], [test "$ENABLED_STATIC" = yes])
+AM_CONDITIONAL([SHARED], [test "$ENABLED_STATIC" = no])
+])
+
+# Set option to enable shared libs.
+AC_DEFUN([FB_ENABLE_DEFAULT_SHARED],
+[
+SHARED=""
+STATIC=""
+AC_MSG_CHECKING([whether to enable shared mode])
+AC_ARG_ENABLE([shared],
+ [ --disable-shared Set up static mode.],
+ [
+ ENABLED_SHARED=$enableval
+ ],
+ [
+ ENABLED_SHARED="yes"
+ ]
+)
+if test "$ENABLED_SHARED" = "yes"
+then
+ LTYPE=".so"
+ SHARED_CXXFLAGS="-fPIC"
+ SHARED_CFLAGS="-fPIC"
+ SHARED_LDFLAGS="-shared -fPIC"
+ AC_SUBST(SHARED_CXXFLAGS)
+ AC_SUBST(SHARED_CFLAGS)
+ AC_SUBST(SHARED_LDFLAGS)
+else
+ LTYPE=".a"
+fi
+AC_MSG_RESULT($ENABLED_SHARED)
+AC_SUBST(LTYPE)
+AM_CONDITIONAL([SHARED], [test "$ENABLED_SHARED" = yes])
+AM_CONDITIONAL([STATIC], [test "$ENABLED_SHARED" = no])
+])
+
+# Generates define flags and conditionals as specified by user.
+# This gets enabled *only* if user selects --enable-<FEATURE> otion.
+AC_DEFUN([FB_ENABLE_FEATURE],
+[
+ENABLE=""
+flag="$1"
+value="$3"
+AC_MSG_CHECKING([whether to enable $1])
+AC_ARG_ENABLE([$2],
+ [ --enable-$2 Enable $2.],
+ [
+ ENABLE=$enableval
+ ],
+ [
+ ENABLE="no"
+ ]
+)
+AM_CONDITIONAL([$1], [test "$ENABLE" = yes])
+if test "$ENABLE" = "yes"
+then
+ if test "x${value}" = "x"
+ then
+ AC_DEFINE([$1])
+ else
+ AC_DEFINE_UNQUOTED([$1], [$value])
+ fi
+fi
+AC_MSG_RESULT($ENABLE)
+])
+
+
+# can also use eval $2=$withval;AC_SUBST($2)
+AC_DEFUN([FB_WITH_PATH],
+[
+USRFLAG=""
+USRFLAG=$1
+AC_MSG_CHECKING([Checking $1 set to])
+AC_ARG_WITH([$2],
+ [ --with-$2=DIR User specified path.],
+ [
+ LOC=$withval
+ eval $USRFLAG=$withval
+ ],
+ [
+ LOC=$3
+ eval $USRFLAG=$3
+ ]
+)
+AC_SUBST([$1])
+AC_MSG_RESULT($LOC)
+])
+
+AC_DEFUN([FB_SET_FLAG_VALUE],
+[
+SETFLAG=""
+AC_MSG_CHECKING([Checking $1 set to])
+SETFLAG=$1
+eval $SETFLAG=\"$2\"
+AC_SUBST([$SETFLAG])
+AC_MSG_RESULT($2)
+])
+
+# NOTES
+# if using if else bourne stmt you must have more than a macro in it.
+# EX1 is not correct. EX2 is correct
+# EX1: if test "$XX" = "yes"; then
+# AC_SUBST(xx)
+# fi
+# EX2: if test "$XX" = "yes"; then
+# xx="foo"
+# AC_SUBST(xx)
+# fi
diff --git a/contrib/fb303/aclocal.m4 b/contrib/fb303/aclocal.m4
new file mode 100644
index 0000000..d23c95c
--- /dev/null
+++ b/contrib/fb303/aclocal.m4
@@ -0,0 +1,851 @@
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.5])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([acinclude.m4])
diff --git a/contrib/fb303/bootstrap.sh b/contrib/fb303/bootstrap.sh
new file mode 100755
index 0000000..cd282b1
--- /dev/null
+++ b/contrib/fb303/bootstrap.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+
+# To be safe include -I flag
+aclocal
+automake -a
+autoconf
+./configure --config-cache $*
diff --git a/contrib/fb303/configure.ac b/contrib/fb303/configure.ac
new file mode 100644
index 0000000..924ea4f
--- /dev/null
+++ b/contrib/fb303/configure.ac
@@ -0,0 +1,89 @@
+# Autoconf input file
+# $Id$
+
+# AC - autoconf
+# FB - facebook
+
+#########################################################################
+# DO NOT TOUCH EXCEPT TO CHANGE REV# IN AC_INIT
+
+AC_PREREQ(2.52)
+AC_INIT([libfb303],[20080209])
+#AC_CONFIG_AUX_DIR([/usr/share/automake-1.9])
+# To install locally
+FB_INITIALIZE([localinstall])
+AC_PREFIX_DEFAULT([/usr/local])
+
+############################################################################
+# User Configurable. Change With CAUTION!
+# User can include custom makefile rules. Uncomment and update only <name> in PRODUCT_MK.
+# Include where appropriate in any Makefile.am as @PRODUCT_MK@
+
+#PRODUCT_MK="include ${EXTERNAL_PATH}/shared/build/<name>.mk"
+
+# Default path to external Facebook components and shared build toools I.e fb303 etc.
+# To point to other locations set environment variable EXTERNAL_PATH.
+# To change the current default you must change bootstrap.sh.
+FB_WITH_EXTERNAL_PATH([`pwd`])
+
+
+##########################################################################
+# User Configurable
+
+# Pre-defined macro to set opt build mode. Run with --disable-shared option to turn off optimization.
+FB_ENABLE_DEFAULT_OPT_BUILD
+
+# Predefined macro to set static library mode. Run with --disable-static option to turn off static lib mode.
+FB_ENABLE_DEFAULT_STATIC
+
+# Personalized feature generator. Creates defines/conditionals and --enable --disable command line options.
+# FB_ENABLE_FEATURE([FEATURE], [feature]) OR FB_ENABLE_FEATURE([FEATURE], [feature], [\"<value>\"])
+
+# Example: Macro supplies -DFACEBOOK at compile time and "if FACEBOOK endif" capabilities.
+
+# Personalized path generator Sets default paths. Provides --with-xx=DIR options.
+# FB_WITH_PATH([<var>_home], [<var>path], [<default location>]
+
+# Example: sets $(thrift_home) variable with default path set to /usr/local.
+FB_WITH_PATH([thrift_home], [thriftpath], [/usr/local])
+FB_WITH_PATH([boost_home], [boostpath], [/usr/local/boost])
+
+# Generates Makefile from Makefile.am. Modify when new subdirs are added.
+# Change Makefile.am also to add subdirectly.
+AC_CONFIG_FILES(Makefile cpp/Makefile py/Makefile)
+
+############################################################################
+# DO NOT TOUCH.
+
+AC_SUBST(PRODUCT_MK)
+AC_OUTPUT
+
+#############################################################################
+######### FINISH ############################################################
+
+echo "EXTERNAL_PATH $EXTERNAL_PATH"
+
+
+#
+# NOTES FOR USER
+# Short cut to create conditional flags.
+#enable_facebook="yes"
+#AM_CONDITIONAL([FACEBOOK], [test "$enable_facebook" = yes])
+#enable_hdfs="yes"
+#AM_CONDITIONAL([HDFS], [test "$enable_hdfs" = yes])
+
+# Enable options with --enable and --disable configurable.
+#AC_MSG_CHECKING([whether to enable FACEBOOK])
+#FACEBOOK=""
+#AC_ARG_ENABLE([facebook],
+# [ --enable-facebook Enable facebook.],
+# [
+# ENABLE_FACEBOOK=$enableval
+# ],
+# [
+# ENABLE_FACEBOOK="no"
+# ]
+#)
+#AM_CONDITIONAL([FACEBOOK], [test "$ENABLE_FACEBOOK" = yes])
+#AC_MSG_RESULT($ENABLE_FACEBOOK)
+
diff --git a/contrib/fb303/cpp/FacebookBase.cpp b/contrib/fb303/cpp/FacebookBase.cpp
new file mode 100644
index 0000000..aef8950
--- /dev/null
+++ b/contrib/fb303/cpp/FacebookBase.cpp
@@ -0,0 +1,114 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#include "FacebookBase.h"
+
+using namespace facebook::fb303;
+using facebook::thrift::concurrency::Guard;
+
+FacebookBase::FacebookBase(std::string name, get_static_limref_ptr reflect_lim) :
+ name_(name) {
+ aliveSince_ = (int64_t) time(NULL);
+ if (reflect_lim) {
+ reflect_lim(reflection_limited_);
+ }
+}
+
+inline void FacebookBase::getName(std::string& _return) {
+ _return = name_;
+}
+
+void FacebookBase::setOption(const std::string& key, const std::string& value) {
+ Guard g(optionsLock_);
+ options_[key] = value;
+}
+
+void FacebookBase::getOption(std::string& _return, const std::string& key) {
+ Guard g(optionsLock_);
+ _return = options_[key];
+}
+
+void FacebookBase::getOptions(std::map<std::string, std::string> & _return) {
+ Guard g(optionsLock_);
+ _return = options_;
+}
+
+int64_t FacebookBase::incrementCounter(const std::string& key, int64_t amount) {
+ counters_.acquireRead();
+
+ // if we didn't find the key, we need to write lock the whole map to create it
+ ReadWriteCounterMap::iterator it = counters_.find(key);
+ if (it == counters_.end()) {
+ counters_.release();
+ counters_.acquireWrite();
+
+ // we need to check again to make sure someone didn't create this key
+ // already while we released the lock
+ it = counters_.find(key);
+ if(it == counters_.end()){
+ counters_[key].value = amount;
+ counters_.release();
+ return amount;
+ }
+ }
+
+ it->second.acquireWrite();
+ int64_t count = it->second.value + amount;
+ it->second.value = count;
+ it->second.release();
+ counters_.release();
+ return count;
+}
+
+int64_t FacebookBase::setCounter(const std::string& key, int64_t value) {
+ counters_.acquireRead();
+
+ // if we didn't find the key, we need to write lock the whole map to create it
+ ReadWriteCounterMap::iterator it = counters_.find(key);
+ if (it == counters_.end()) {
+ counters_.release();
+ counters_.acquireWrite();
+ counters_[key].value = value;
+ counters_.release();
+ return value;
+ }
+
+ it->second.acquireWrite();
+ it->second.value = value;
+ it->second.release();
+ counters_.release();
+ return value;
+}
+
+void FacebookBase::getCounters(std::map<std::string, int64_t>& _return) {
+ // we need to lock the whole thing and actually build the map since we don't
+ // want our read/write structure to go over the wire
+ counters_.acquireRead();
+ for(ReadWriteCounterMap::iterator it = counters_.begin();
+ it != counters_.end(); it++)
+ {
+ _return[it->first] = it->second.value;
+ }
+ counters_.release();
+}
+
+int64_t FacebookBase::getCounter(const std::string& key) {
+ int64_t rv = 0;
+ counters_.acquireRead();
+ ReadWriteCounterMap::iterator it = counters_.find(key);
+ if (it != counters_.end()) {
+ it->second.acquireRead();
+ rv = it->second.value;
+ it->second.release();
+ }
+ counters_.release();
+ return rv;
+}
+
+inline int64_t FacebookBase::aliveSince() {
+ return aliveSince_;
+}
+
diff --git a/contrib/fb303/cpp/FacebookBase.h b/contrib/fb303/cpp/FacebookBase.h
new file mode 100644
index 0000000..a5afe5b
--- /dev/null
+++ b/contrib/fb303/cpp/FacebookBase.h
@@ -0,0 +1,98 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef _FACEBOOK_TB303_FACEBOOKBASE_H_
+#define _FACEBOOK_TB303_FACEBOOKBASE_H_ 1
+
+#include "FacebookService.h"
+
+#include "thrift/server/TServer.h"
+#include "thrift/concurrency/Mutex.h"
+
+#include <time.h>
+#include <string>
+#include <map>
+
+namespace facebook { namespace fb303 {
+
+using facebook::thrift::concurrency::Mutex;
+using facebook::thrift::concurrency::ReadWriteMutex;
+using facebook::thrift::server::TServer;
+
+struct ReadWriteInt : ReadWriteMutex {int64_t value;};
+struct ReadWriteCounterMap : ReadWriteMutex,
+ std::map<std::string, ReadWriteInt> {};
+
+typedef void (*get_static_limref_ptr)(facebook::thrift::reflection::limited::Service &);
+
+/**
+ * Base Facebook service implementation in C++.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+class FacebookBase : virtual public FacebookServiceIf {
+ protected:
+ FacebookBase(std::string name, get_static_limref_ptr reflect_lim = NULL);
+ virtual ~FacebookBase() {}
+
+ public:
+ void getName(std::string& _return);
+ virtual void getVersion(std::string& _return) { _return = ""; }
+
+ virtual fb_status getStatus() = 0;
+ virtual void getStatusDetails(std::string& _return) { _return = ""; }
+
+ void setOption(const std::string& key, const std::string& value);
+ void getOption(std::string& _return, const std::string& key);
+ void getOptions(std::map<std::string, std::string> & _return);
+
+ int64_t aliveSince();
+
+ void getLimitedReflection(facebook::thrift::reflection::limited::Service& _return) {
+ _return = reflection_limited_;
+ }
+
+ virtual void reinitialize() {}
+
+ virtual void shutdown() {
+ if (server_.get() != NULL) {
+ server_->stop();
+ }
+ }
+
+ int64_t incrementCounter(const std::string& key, int64_t amount = 1);
+ int64_t setCounter(const std::string& key, int64_t value);
+
+ void getCounters(std::map<std::string, int64_t>& _return);
+ int64_t getCounter(const std::string& key);
+
+ /**
+ * Set server handle for shutdown method
+ */
+ void setServer(boost::shared_ptr<TServer> server) {
+ server_ = server;
+ }
+
+ void getCpuProfile(std::string& _return, int32_t durSecs) { _return = ""; }
+
+ private:
+
+ std::string name_;
+ facebook::thrift::reflection::limited::Service reflection_limited_;
+ int64_t aliveSince_;
+
+ std::map<std::string, std::string> options_;
+ Mutex optionsLock_;
+
+ ReadWriteCounterMap counters_;
+
+ boost::shared_ptr<TServer> server_;
+
+};
+
+}} // facebook::tb303
+
+#endif // _FACEBOOK_TB303_FACEBOOKBASE_H_
diff --git a/contrib/fb303/cpp/Makefile.am b/contrib/fb303/cpp/Makefile.am
new file mode 100644
index 0000000..907cfc8
--- /dev/null
+++ b/contrib/fb303/cpp/Makefile.am
@@ -0,0 +1,65 @@
+@GLOBAL_HEADER_MK@
+
+@PRODUCT_MK@
+
+
+# User specified path variables set in configure.ac.
+# thrift_home
+# boost_home
+#
+THRIFT = $(thrift_home)/bin/thrift
+
+# User defined conditionals and conditonal statements set up in configure.ac.
+if DEBUG
+ DEBUG_CPPFLAGS = -DDEBUG_TIMING
+endif
+
+# Set common flags recognized by automake.
+# DO NOT USE CPPFLAGS, CXXFLAGS, CFLAGS, LDFLAGS here! Set in configure.ac and|or override on command line.
+# USE flags AM_CXXFLAGS, AM_CFLAGS, AM_CPPFLAGS, AM_LDFLAGS, LDADD in this section.
+
+AM_CPPFLAGS = -I..
+AM_CPPFLAGS += -Igen-cpp
+AM_CPPFLAGS += -I$(thrift_home)/include/thrift -I$(boost_home)/include/boost-1_33_1
+AM_CPPFLAGS += $(FB_CPPFLAGS) $(DEBUG_CPPFLAGS)
+
+# GENERATE BUILD RULES
+# Set Program/library specific flags recognized by automake.
+# Use <progname|libname>_<FLAG> to set prog / lib specific flag s
+# foo_CXXFLAGS foo_CPPFLAGS foo_LDFLAGS foo_LDADD
+
+fb303_lib = gen-cpp/FacebookService.cpp gen-cpp/fb303_constants.cpp gen-cpp/fb303_types.cpp FacebookBase.cpp ServiceTracker.cpp
+
+# Static -- multiple libraries can be defined
+if STATIC
+lib_LIBRARIES = libfb303.a
+libfb303_a_SOURCES = $(fb303_lib)
+INTERNAL_LIBS = libfb303.a
+endif
+
+# Shared -- multiple libraries can be defined
+if SHARED
+shareddir = lib
+shared_PROGRAMS = libfb303.so
+libfb303_so_SOURCES = $(fb303_lib)
+libfb303_so_CXXFLAGS = $(SHARED_CXXFLAGS)
+libfb303_so_LDFLAGS = $(SHARED_LDFLAGS)
+INTERNAL_LIBS = libfb303.so
+endif
+
+# Set up Thrift specific activity here.
+# We assume that a <name>+types.cpp will always be built from <name>.thrift.
+$(eval $(call thrift_template,.,../if/fb303.thrift,-I $(thrift_home)/share --gen cpp ))
+
+include_fb303dir = $(includedir)/thrift/fb303
+include_fb303_HEADERS = FacebookBase.h ServiceTracker.h gen-cpp/FacebookService.h gen-cpp/fb303_constants.h gen-cpp/fb303_types.h
+
+include_fb303ifdir = $(thrift_home)/share/fb303/if
+include_fb303if_HEADERS = ../if/fb303.thrift
+
+BUILT_SOURCES = thriftstyle
+
+# Add to pre-existing target clean
+clean-local: clean-common
+
+@GLOBAL_FOOTER_MK@
diff --git a/contrib/fb303/cpp/ServiceTracker.cpp b/contrib/fb303/cpp/ServiceTracker.cpp
new file mode 100644
index 0000000..8dc150d
--- /dev/null
+++ b/contrib/fb303/cpp/ServiceTracker.cpp
@@ -0,0 +1,475 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#include <sys/time.h>
+
+#include "FacebookBase.h"
+#include "ServiceTracker.h"
+#include "thrift/concurrency/ThreadManager.h"
+
+using namespace std;
+using namespace facebook::fb303;
+using namespace facebook::thrift::concurrency;
+
+
+uint64_t ServiceTracker::CHECKPOINT_MINIMUM_INTERVAL_SECONDS = 60;
+int ServiceTracker::LOG_LEVEL = 5;
+
+
+ServiceTracker::ServiceTracker(facebook::fb303::FacebookBase *handler,
+ void (*logMethod)(int, const string &),
+ bool featureCheckpoint,
+ bool featureStatusCheck,
+ bool featureThreadCheck,
+ Stopwatch::Unit stopwatchUnit)
+ : handler_(handler), logMethod_(logMethod),
+ featureCheckpoint_(featureCheckpoint),
+ featureStatusCheck_(featureStatusCheck),
+ featureThreadCheck_(featureThreadCheck),
+ stopwatchUnit_(stopwatchUnit),
+ checkpointServices_(0)
+{
+ if (featureCheckpoint_) {
+ time_t now = time(NULL);
+ checkpointTime_ = now;
+ } else {
+ checkpointTime_ = 0;
+ }
+}
+
+/**
+ * Registers the beginning of a "service method": basically, any of
+ * the implementations of Thrift remote procedure calls that a
+ * FacebookBase handler is handling. Controls concurrent
+ * services and reports statistics (via log and via fb303 counters).
+ * Throws an exception if the server is not ready to handle service
+ * methods yet.
+ *
+ * note: The relationship between startService() and finishService()
+ * is currently defined so that a call to finishService() should only
+ * be matched to this call to startService() if this method returns
+ * without exception. It wouldn't be a problem to implement things
+ * the other way, so that *every* start needed a finish, but this
+ * convention was chosen to match the way an object's constructor and
+ * destructor work together, i.e. to work well with ServiceMethod
+ * objects.
+ *
+ * @param const ServiceMethod &serviceMethod A reference to the ServiceMethod
+ * object instantiated at the start
+ * of the service method.
+ * @author Karl Voskuil
+ */
+void
+ServiceTracker::startService(const ServiceMethod &serviceMethod)
+{
+ // note: serviceMethod.timer_ automatically starts at construction.
+
+ // log service start
+ logMethod_(5, serviceMethod.signature_);
+
+ // check handler ready
+ if (featureStatusCheck_ && !serviceMethod.featureLogOnly_) {
+ // note: Throwing exceptions before counting statistics. See note
+ // in method header.
+ // note: A STOPPING server is not accepting new connections, but it
+ // is still handling any already-connected threads -- so from the
+ // service method's point of view, a status of STOPPING is a green
+ // light.
+ facebook::fb303::fb_status status = handler_->getStatus();
+ if (status != facebook::fb303::ALIVE
+ && status != facebook::fb303::STOPPING) {
+ if (status == facebook::fb303::STARTING) {
+ throw ServiceException("Server starting up; please try again later");
+ } else {
+ throw ServiceException("Server not alive; please try again later");
+ }
+ }
+ }
+
+ // check server threads
+ if (featureThreadCheck_ && !serviceMethod.featureLogOnly_) {
+ // note: Might want to put these messages in reportCheckpoint() if
+ // log is getting spammed.
+ if (threadManager_ != NULL) {
+ size_t idle_count = threadManager_->idleWorkerCount();
+ if (idle_count == 0) {
+ stringstream message;
+ message << "service " << serviceMethod.signature_
+ << ": all threads (" << threadManager_->workerCount()
+ << ") in use";
+ logMethod_(3, message.str());
+ }
+ }
+ }
+}
+
+/**
+ * Logs a significant step in the middle of a "service method"; see
+ * startService.
+ *
+ * @param const ServiceMethod &serviceMethod A reference to the ServiceMethod
+ * object instantiated at the start
+ * of the service method.
+ * @return int64_t Elapsed units (see stopwatchUnit_) since ServiceMethod
+ * instantiation.
+ * @author Karl Voskuil
+ */
+int64_t
+ServiceTracker::stepService(const ServiceMethod &serviceMethod,
+ const string &stepName)
+{
+ stringstream message;
+ string elapsed_label;
+ int64_t elapsed = serviceMethod.timer_.elapsedUnits(stopwatchUnit_,
+ &elapsed_label);
+ message << serviceMethod.signature_
+ << ' ' << stepName
+ << " [" << elapsed_label << ']';
+ logMethod_(5, message.str());
+ return elapsed;
+}
+
+/**
+ * Registers the end of a "service method"; see startService().
+ *
+ * @param const ServiceMethod &serviceMethod A reference to the ServiceMethod
+ * object instantiated at the start
+ * of the service method.
+ * @author Karl Voskuil
+ */
+void
+ServiceTracker::finishService(const ServiceMethod &serviceMethod)
+{
+ // log end of service
+ stringstream message;
+ string duration_label;
+ int64_t duration = serviceMethod.timer_.elapsedUnits(stopwatchUnit_,
+ &duration_label);
+ message << serviceMethod.signature_
+ << " finish [" << duration_label << ']';
+ logMethod_(5, message.str());
+
+ // count, record, and maybe report service statistics
+ if (!serviceMethod.featureLogOnly_) {
+
+ if (!featureCheckpoint_) {
+
+ // lifetime counters
+ // (note: No need to lock statisticsMutex_ if not doing checkpoint;
+ // FacebookService::incrementCounter() is already thread-safe.)
+ handler_->incrementCounter("lifetime_services");
+
+ } else {
+
+ statisticsMutex_.lock();
+ // note: No exceptions expected from this code block. Wrap in a try
+ // just to be safe.
+ try {
+
+ // lifetime counters
+ // note: Good to synchronize this with the increment of
+ // checkpoint services, even though incrementCounter() is
+ // already thread-safe, for the sake of checkpoint reporting
+ // consistency (i.e. since the last checkpoint,
+ // lifetime_services has incremented by checkpointServices_).
+ handler_->incrementCounter("lifetime_services");
+
+ // checkpoint counters
+ checkpointServices_++;
+ checkpointDuration_ += duration;
+
+ // per-service timing
+ // note kjv: According to my tests it is very slightly faster to
+ // call insert() once (and detect not-found) than calling find()
+ // and then maybe insert (if not-found). However, the difference
+ // is tiny for small maps like this one, and the code for the
+ // faster solution is slightly less readable. Also, I wonder if
+ // the instantiation of the (often unused) pair to insert makes
+ // the first algorithm slower after all.
+ map<string, pair<uint64_t, uint64_t> >::iterator iter;
+ iter = checkpointServiceDuration_.find(serviceMethod.name_);
+ if (iter != checkpointServiceDuration_.end()) {
+ iter->second.first++;
+ iter->second.second += duration;
+ } else {
+ checkpointServiceDuration_.insert(make_pair(serviceMethod.name_,
+ make_pair(1, duration)));
+ }
+
+ // maybe report checkpoint
+ // note: ...if it's been long enough since the last report.
+ time_t now = time(NULL);
+ uint64_t check_interval = now - checkpointTime_;
+ if (check_interval >= CHECKPOINT_MINIMUM_INTERVAL_SECONDS) {
+ reportCheckpoint();
+ }
+
+ } catch (...) {
+ statisticsMutex_.unlock();
+ throw;
+ }
+ statisticsMutex_.unlock();
+
+ }
+ }
+}
+
+/**
+ * Logs some statistics gathered since the last call to this method.
+ *
+ * note: Thread race conditions on this method could cause
+ * misreporting and/or undefined behavior; the caller must protect
+ * uses of the object variables (and calls to this method) with a
+ * mutex.
+ *
+ * @author Karl Voskuil
+ */
+void
+ServiceTracker::reportCheckpoint()
+{
+ time_t now = time(NULL);
+
+ uint64_t check_count = checkpointServices_;
+ uint64_t check_interval = now - checkpointTime_;
+ uint64_t check_duration = checkpointDuration_;
+
+ // export counters for timing of service methods (by service name)
+ handler_->setCounter("checkpoint_time", check_interval);
+ map<string, pair<uint64_t, uint64_t> >::iterator iter;
+ uint64_t count;
+ for (iter = checkpointServiceDuration_.begin();
+ iter != checkpointServiceDuration_.end();
+ iter++) {
+ count = iter->second.first;
+ handler_->setCounter(string("checkpoint_count_") + iter->first, count);
+ if (count == 0) {
+ handler_->setCounter(string("checkpoint_speed_") + iter->first,
+ 0);
+ } else {
+ handler_->setCounter(string("checkpoint_speed_") + iter->first,
+ iter->second.second / count);
+ }
+ }
+
+ // reset checkpoint variables
+ // note: Clearing the map while other threads are using it might
+ // cause undefined behavior.
+ checkpointServiceDuration_.clear();
+ checkpointTime_ = now;
+ checkpointServices_ = 0;
+ checkpointDuration_ = 0;
+
+ // get lifetime variables
+ uint64_t life_count = handler_->getCounter("lifetime_services");
+ uint64_t life_interval = now - handler_->aliveSince();
+
+ // log checkpoint
+ stringstream message;
+ message << "checkpoint_time:" << check_interval
+ << " checkpoint_services:" << check_count
+ << " checkpoint_speed_sum:" << check_duration
+ << " lifetime_time:" << life_interval
+ << " lifetime_services:" << life_count;
+ if (featureThreadCheck_ && threadManager_ != NULL) {
+ size_t worker_count = threadManager_->workerCount();
+ size_t idle_count = threadManager_->idleWorkerCount();
+ message << " total_workers:" << worker_count
+ << " active_workers:" << (worker_count - idle_count);
+ }
+ logMethod_(4, message.str());
+}
+
+/**
+ * Remembers the thread manager used in the server, for monitoring thread
+ * activity.
+ *
+ * @param shared_ptr<ThreadManager> threadManager The server's thread manager.
+ * @author Karl Voskuil
+ */
+void
+ServiceTracker::setThreadManager(boost::shared_ptr<ThreadManager>
+ threadManager)
+{
+ threadManager_ = threadManager;
+}
+
+/**
+ * Logs messages to stdout; the passed message will be logged if the
+ * passed level is less than or equal to LOG_LEVEL.
+ *
+ * This is the default logging method used by the ServiceTracker. An
+ * alternate logging method (that accepts the same parameters) may be
+ * specified to the constructor.
+ *
+ * @param int level A level associated with the message: higher levels
+ * are used to indicate higher levels of detail.
+ * @param string message The message to log.
+ */
+void
+ServiceTracker::defaultLogMethod(int level, const string &message)
+{
+ if (level <= LOG_LEVEL) {
+ string level_string;
+ time_t now = time(NULL);
+ char now_pretty[26];
+ ctime_r(&now, now_pretty);
+ now_pretty[24] = '\0';
+ switch (level) {
+ case 1:
+ level_string = "CRITICAL";
+ break;
+ case 2:
+ level_string = "ERROR";
+ break;
+ case 3:
+ level_string = "WARNING";
+ break;
+ case 5:
+ level_string = "DEBUG";
+ break;
+ case 4:
+ default:
+ level_string = "INFO";
+ break;
+ }
+ cout << '[' << level_string << "] [" << now_pretty << "] "
+ << message << endl;
+ }
+}
+
+
+/**
+ * Creates a Stopwatch, which can report the time elapsed since its
+ * creation.
+ *
+ * @author Karl Voskuil
+ */
+Stopwatch::Stopwatch()
+{
+ gettimeofday(&startTime_, NULL);
+}
+
+void
+Stopwatch::reset()
+{
+ gettimeofday(&startTime_, NULL);
+}
+
+uint64_t
+Stopwatch::elapsedUnits(Stopwatch::Unit unit, string *label) const
+{
+ timeval now_time;
+ gettimeofday(&now_time, NULL);
+ time_t duration_secs = now_time.tv_sec - startTime_.tv_sec;
+
+ uint64_t duration_units;
+ switch (unit) {
+ case UNIT_SECONDS:
+ duration_units = duration_secs
+ + (now_time.tv_usec - startTime_.tv_usec + 500000) / 1000000;
+ if (NULL != label) {
+ stringstream ss_label;
+ ss_label << duration_units << " secs";
+ label->assign(ss_label.str());
+ }
+ break;
+ case UNIT_MICROSECONDS:
+ duration_units = duration_secs * 1000000
+ + now_time.tv_usec - startTime_.tv_usec;
+ if (NULL != label) {
+ stringstream ss_label;
+ ss_label << duration_units << " us";
+ label->assign(ss_label.str());
+ }
+ break;
+ case UNIT_MILLISECONDS:
+ default:
+ duration_units = duration_secs * 1000
+ + (now_time.tv_usec - startTime_.tv_usec + 500) / 1000;
+ if (NULL != label) {
+ stringstream ss_label;
+ ss_label << duration_units << " ms";
+ label->assign(ss_label.str());
+ }
+ break;
+ }
+ return duration_units;
+}
+
+/**
+ * Creates a ServiceMethod, used for tracking a single service method
+ * invocation (via the ServiceTracker). The passed name of the
+ * ServiceMethod is used to group statistics (e.g. counts and durations)
+ * for similar invocations; the passed signature is used to uniquely
+ * identify the particular invocation in the log.
+ *
+ * note: A version of this constructor is provided that automatically
+ * forms a signature the name and a passed numeric id. Silly, sure,
+ * but commonly used, since it often saves the caller a line or two of
+ * code.
+ *
+ * @param ServiceTracker *tracker The service tracker that will track this
+ * ServiceMethod.
+ * @param const string &name The service method name (usually independent
+ * of service method parameters).
+ * @param const string &signature A signature uniquely identifying the method
+ * invocation (usually name plus parameters).
+ * @author Karl Voskuil
+ */
+ServiceMethod::ServiceMethod(ServiceTracker *tracker,
+ const string &name,
+ const string &signature,
+ bool featureLogOnly)
+ : tracker_(tracker), name_(name), signature_(signature),
+ featureLogOnly_(featureLogOnly)
+{
+ // note: timer_ automatically starts at construction.
+
+ // invoke tracker to start service
+ // note: Might throw. If it throws, then this object's destructor
+ // won't be called, which is according to plan: finishService() is
+ // only supposed to be matched to startService() if startService()
+ // returns without error.
+ tracker_->startService(*this);
+}
+
+ServiceMethod::ServiceMethod(ServiceTracker *tracker,
+ const string &name,
+ uint64_t id,
+ bool featureLogOnly)
+ : tracker_(tracker), name_(name), featureLogOnly_(featureLogOnly)
+{
+ // note: timer_ automatically starts at construction.
+ stringstream ss_signature;
+ ss_signature << name << " (" << id << ')';
+ signature_ = ss_signature.str();
+
+ // invoke tracker to start service
+ // note: Might throw. If it throws, then this object's destructor
+ // won't be called, which is according to plan: finishService() is
+ // only supposed to be matched to startService() if startService()
+ // returns without error.
+ tracker_->startService(*this);
+}
+
+ServiceMethod::~ServiceMethod()
+{
+ // invoke tracker to finish service
+ // note: Not expecting an exception from this code, but
+ // finishService() might conceivably throw an out-of-memory
+ // exception.
+ try {
+ tracker_->finishService(*this);
+ } catch (...) {
+ // don't throw
+ }
+}
+
+uint64_t
+ServiceMethod::step(const std::string &stepName)
+{
+ return tracker_->stepService(*this, stepName);
+}
diff --git a/contrib/fb303/cpp/ServiceTracker.h b/contrib/fb303/cpp/ServiceTracker.h
new file mode 100644
index 0000000..c8e4529
--- /dev/null
+++ b/contrib/fb303/cpp/ServiceTracker.h
@@ -0,0 +1,202 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+/**
+ * ServiceTracker is a utility class for logging and timing service
+ * calls to a fb303 Thrift server. Currently, ServiceTracker offers
+ * the following features:
+ *
+ * . Logging of service method start, end (and duration), and
+ * optional steps in between.
+ *
+ * . Automatic check of server status via fb303::getStatus()
+ * with a ServiceException thrown if server not alive
+ * (at method start).
+ *
+ * . A periodic logged checkpoint reporting lifetime time, lifetime
+ * service count, and per-method statistics since the last checkpoint
+ * time (at method finish).
+ *
+ * . Export of fb303 counters for lifetime and checkpoint statistics
+ * (at method finish).
+ *
+ * . For TThreadPoolServers, a logged warning when all server threads
+ * are busy (at method start). (Must call setThreadManager() after
+ * ServiceTracker instantiation for this feature to be enabled.)
+ *
+ * Individual features may be enabled or disabled by arguments to the
+ * constructor. The constructor also accepts a pointer to a logging
+ * method -- if no pointer is passed, the tracker will log to stdout.
+ *
+ * ServiceTracker defines private methods for service start, finish,
+ * and step, which are designed to be accessed by instantiating a
+ * friend ServiceMethod object, as in the following example:
+ *
+ * #include <ServiceTracker.h>
+ * class MyServiceHandler : virtual public MyServiceIf,
+ * public facebook::fb303::FacebookBase
+ * {
+ * public:
+ * MyServiceHandler::MyServiceHandler() : mServiceTracker(this) {}
+ * void MyServiceHandler::myServiceMethod(int userId) {
+ * // note: Instantiating a ServiceMethod object starts a timer
+ * // and tells the ServiceTracker to log the start. Might throw
+ * // a ServiceException.
+ * ServiceMethod serviceMethod(&mServiceTracker,
+ * "myServiceMethod",
+ * userId);
+ * ...
+ * // note: Calling the step method tells the ServiceTracker to
+ * // log the step, with a time elapsed since start.
+ * serviceMethod.step("post parsing, begin processing");
+ * ...
+ * // note: When the ServiceMethod object goes out of scope, the
+ * // ServiceTracker will log the total elapsed time of the method.
+ * }
+ * ...
+ * private:
+ * ServiceTracker mServiceTracker;
+ * }
+ *
+ * The step() method call is optional; the startService() and
+ * finishService() methods are handled by the object's constructor and
+ * destructor.
+ *
+ * The ServiceTracker is (intended to be) thread-safe.
+ *
+ * Future:
+ *
+ * . Come up with something better for logging than passing a
+ * function pointer to the constructor.
+ *
+ * . Add methods for tracking errors from service methods, e.g.
+ * ServiceTracker::reportService().
+ */
+
+#ifndef SERVICETRACKER_H
+#define SERVICETRACKER_H
+
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <exception>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+#include "thrift/concurrency/Mutex.h"
+
+
+namespace facebook { namespace thrift { namespace concurrency {
+ class ThreadManager;
+}}}
+
+
+namespace facebook { namespace fb303 {
+
+
+class FacebookBase;
+class ServiceMethod;
+
+
+class Stopwatch
+{
+public:
+ enum Unit { UNIT_SECONDS, UNIT_MILLISECONDS, UNIT_MICROSECONDS };
+ Stopwatch();
+ uint64_t elapsedUnits(Unit unit, std::string *label = NULL) const;
+ void reset();
+private:
+ timeval startTime_;
+};
+
+
+class ServiceTracker
+{
+ friend class ServiceMethod;
+
+public:
+
+ static uint64_t CHECKPOINT_MINIMUM_INTERVAL_SECONDS;
+ static int LOG_LEVEL;
+
+ ServiceTracker(facebook::fb303::FacebookBase *handler,
+ void (*logMethod)(int, const std::string &)
+ = &ServiceTracker::defaultLogMethod,
+ bool featureCheckpoint = true,
+ bool featureStatusCheck = true,
+ bool featureThreadCheck = true,
+ Stopwatch::Unit stopwatchUnit
+ = Stopwatch::UNIT_MILLISECONDS);
+
+ void setThreadManager(boost::shared_ptr<facebook::thrift::concurrency::ThreadManager> threadManager);
+
+private:
+
+ facebook::fb303::FacebookBase *handler_;
+ void (*logMethod_)(int, const std::string &);
+ boost::shared_ptr<facebook::thrift::concurrency::ThreadManager> threadManager_;
+
+ bool featureCheckpoint_;
+ bool featureStatusCheck_;
+ bool featureThreadCheck_;
+ Stopwatch::Unit stopwatchUnit_;
+
+ facebook::thrift::concurrency::Mutex statisticsMutex_;
+ time_t checkpointTime_;
+ uint64_t checkpointServices_;
+ uint64_t checkpointDuration_;
+ std::map<std::string, std::pair<uint64_t, uint64_t> > checkpointServiceDuration_;
+
+ void startService(const ServiceMethod &serviceMethod);
+ int64_t stepService(const ServiceMethod &serviceMethod,
+ const std::string &stepName);
+ void finishService(const ServiceMethod &serviceMethod);
+ void reportCheckpoint();
+ static void defaultLogMethod(int level, const std::string &message);
+};
+
+
+class ServiceMethod
+{
+ friend class ServiceTracker;
+public:
+ ServiceMethod(ServiceTracker *tracker,
+ const std::string &name,
+ const std::string &signature,
+ bool featureLogOnly = false);
+ ServiceMethod(ServiceTracker *tracker,
+ const std::string &name,
+ uint64_t id,
+ bool featureLogOnly = false);
+ ~ServiceMethod();
+ uint64_t step(const std::string &stepName);
+private:
+ ServiceTracker *tracker_;
+ std::string name_;
+ std::string signature_;
+ bool featureLogOnly_;
+ Stopwatch timer_;
+};
+
+
+class ServiceException : public std::exception
+{
+public:
+ explicit ServiceException(const std::string &message, int code = 0)
+ : message_(message), code_(code) {}
+ ~ServiceException() throw() {}
+ virtual const char *what() const throw() { return message_.c_str(); }
+ int code() const throw() { return code_; }
+private:
+ std::string message_;
+ int code_;
+};
+
+
+}} // facebook::fb303
+
+#endif
diff --git a/contrib/fb303/global_footer.mk b/contrib/fb303/global_footer.mk
new file mode 100644
index 0000000..7e5299f
--- /dev/null
+++ b/contrib/fb303/global_footer.mk
@@ -0,0 +1,2 @@
+thriftstyle : $(XBUILT_SOURCES)
+
diff --git a/contrib/fb303/global_header.mk b/contrib/fb303/global_header.mk
new file mode 100644
index 0000000..23d60fb
--- /dev/null
+++ b/contrib/fb303/global_header.mk
@@ -0,0 +1,19 @@
+#define thrift_template
+# $(1) : $(2)
+# $$(THRIFT) $(3) $(4) $(5) $(6) $(7) $(8) $$<
+#endef
+
+define thrift_template
+XTARGET := $(shell perl -e '@val = split("\/","$(2)"); $$last = pop(@val);split("\\.",$$last);print "$(1)/"."gen-cpp/"."@_[0]"."_types.cpp\n"' )
+
+ifneq ($$(XBUILT_SOURCES),)
+ XBUILT_SOURCES := $$(XBUILT_SOURCES) $$(XTARGET)
+else
+ XBUILT_SOURCES := $$(XTARGET)
+endif
+$$(XTARGET) : $(2)
+ $$(THRIFT) -o $1 $3 $$<
+endef
+
+clean-common:
+ rm -rf gen-*
diff --git a/contrib/fb303/if/fb303.thrift b/contrib/fb303/if/fb303.thrift
new file mode 100644
index 0000000..bf86cbf
--- /dev/null
+++ b/contrib/fb303/if/fb303.thrift
@@ -0,0 +1,114 @@
+/**
+ * fb303.thrift
+ *
+ * Copyright (c) 2006- Facebook
+ * Distributed under the Thrift Software License
+ *
+ * See accompanying file LICENSE or visit the Thrift site at:
+ * http://developers.facebook.com/thrift/
+ *
+ *
+ * Definition of common Facebook data types and status reporting mechanisms
+ * common to all Facebook services. In some cases, these methods are
+ * provided in the base implementation, and in other cases they simply define
+ * methods that inheriting applications should implement (i.e. status report)
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+
+include "thrift/if/reflection_limited.thrift"
+
+namespace java com.facebook.fb303
+namespace cpp facebook.fb303
+
+/**
+ * Common status reporting mechanism across all services
+ */
+enum fb_status {
+ DEAD = 0,
+ STARTING = 1,
+ ALIVE = 2,
+ STOPPING = 3,
+ STOPPED = 4,
+ WARNING = 5,
+}
+
+/**
+ * Standard base service
+ */
+service FacebookService {
+
+ /**
+ * Returns a descriptive name of the service
+ */
+ string getName(),
+
+ /**
+ * Returns the version of the service
+ */
+ string getVersion(),
+
+ /**
+ * Gets the status of this service
+ */
+ fb_status getStatus(),
+
+ /**
+ * User friendly description of status, such as why the service is in
+ * the dead or warning state, or what is being started or stopped.
+ */
+ string getStatusDetails(),
+
+ /**
+ * Gets the counters for this service
+ */
+ map<string, i64> getCounters(),
+
+ /**
+ * Gets the value of a single counter
+ */
+ i64 getCounter(1: string key),
+
+ /**
+ * Sets an option
+ */
+ void setOption(1: string key, 2: string value),
+
+ /**
+ * Gets an option
+ */
+ string getOption(1: string key),
+
+ /**
+ * Gets all options
+ */
+ map<string, string> getOptions(),
+
+ /**
+ * Returns a CPU profile over the given time interval (client and server
+ * must agree on the profile format).
+ */
+ string getCpuProfile(1: i32 profileDurationInSec),
+
+ /**
+ * Returns the unix time that the server has been running since
+ */
+ i64 aliveSince(),
+
+ /**
+ * Returns a limited description of this service.
+ */
+ reflection_limited.Service
+ getLimitedReflection(),
+
+ /**
+ * Tell the server to reload its configuration, reopen log files, etc
+ */
+ async void reinitialize(),
+
+ /**
+ * Suggest a shutdown to the server
+ */
+ async void shutdown(),
+
+}
diff --git a/contrib/fb303/java/Constants.java b/contrib/fb303/java/Constants.java
new file mode 100644
index 0000000..d1e8c73
--- /dev/null
+++ b/contrib/fb303/java/Constants.java
@@ -0,0 +1,16 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package com.facebook.fb303;
+
+import java.util.ArrayList;
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import com.facebook.thrift.*;
+
+public class Constants {
+
+}
diff --git a/contrib/fb303/java/FacebookBase.java b/contrib/fb303/java/FacebookBase.java
new file mode 100644
index 0000000..c9fe43b
--- /dev/null
+++ b/contrib/fb303/java/FacebookBase.java
@@ -0,0 +1,94 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+package com.facebook.fb303;
+
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+public abstract class FacebookBase implements FacebookService.Iface {
+
+ private String name_;
+
+ private long alive_;
+
+ private final ConcurrentHashMap<String,Long> counters_ =
+ new ConcurrentHashMap<String, Long>();
+
+ private final ConcurrentHashMap<String,String> options_ =
+ new ConcurrentHashMap<String, String>();
+
+ protected FacebookBase(String name) {
+ name_ = name;
+ alive_ = System.currentTimeMillis() / 1000;
+ }
+
+ public String getName() {
+ return name_;
+ }
+
+ public abstract int getStatus();
+
+ public String getStatusDetails() {
+ return "";
+ }
+
+ public void deleteCounter(String key) {
+ counters_.remove(key);
+ }
+
+ public void resetCounter(String key) {
+ counters_.put(key, 0L);
+ }
+
+ public long incrementCounter(String key) {
+ long val = getCounter(key) + 1;
+ counters_.put(key, val);
+ return val;
+ }
+
+ public AbstractMap<String,Long> getCounters() {
+ return counters_;
+ }
+
+ public long getCounter(String key) {
+ Long val = counters_.get(key);
+ if (val == null) {
+ return 0;
+ }
+ return val.longValue();
+ }
+
+ public void setOption(String key, String value) {
+ options_.put(key, value);
+ }
+
+ public String getOption(String key) {
+ return options_.get(key);
+ }
+
+ public AbstractMap<String,String> getOptions() {
+ return options_;
+ }
+
+ public long aliveSince() {
+ return alive_;
+ }
+
+ public String getCpuProfile() {
+ return "";
+ }
+
+ public com.facebook.thrift.reflection.limited.Service getLimitedReflection() {
+ return new com.facebook.thrift.reflection.limited.Service();
+ }
+
+ public void reinitialize() {}
+
+ public void shutdown() {}
+
+}
diff --git a/contrib/fb303/java/FacebookService.java b/contrib/fb303/java/FacebookService.java
new file mode 100644
index 0000000..b7a23dd
--- /dev/null
+++ b/contrib/fb303/java/FacebookService.java
@@ -0,0 +1,2057 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package com.facebook.fb303;
+
+import java.util.ArrayList;
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import com.facebook.thrift.*;
+
+import com.facebook.thrift.protocol.*;
+import com.facebook.thrift.transport.*;
+
+public class FacebookService {
+
+ public interface Iface {
+ public String getName() throws TException;
+ public String getVersion() throws TException;
+ public int getStatus() throws TException;
+ public String getStatusDetails() throws TException;
+ public AbstractMap<String,Long> getCounters() throws TException;
+ public long getCounter(String key) throws TException;
+ public void setOption(String key, String value) throws TException;
+ public String getOption(String key) throws TException;
+ public AbstractMap<String,String> getOptions() throws TException;
+ public long aliveSince() throws TException;
+ public com.facebook.thrift.reflection.limited.Service getLimitedReflection() throws TException;
+ public void reinitialize() throws TException;
+ public void shutdown() throws TException;
+ }
+
+ public static class Client implements Iface {
+ public Client(TProtocol prot)
+ {
+ this(prot, prot);
+ }
+
+ public Client(TProtocol iprot, TProtocol oprot)
+ {
+ iprot_ = iprot;
+ oprot_ = oprot;
+ }
+
+ protected TProtocol iprot_;
+ protected TProtocol oprot_;
+
+ protected int seqid_;
+
+ public String getName() throws TException
+ {
+ send_getName();
+ return recv_getName();
+ }
+
+ public void send_getName() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getName", TMessageType.CALL, seqid_));
+ getName_args args = new getName_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_getName() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getName_result result = new getName_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getName failed: unknown result");
+ }
+
+ public String getVersion() throws TException
+ {
+ send_getVersion();
+ return recv_getVersion();
+ }
+
+ public void send_getVersion() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getVersion", TMessageType.CALL, seqid_));
+ getVersion_args args = new getVersion_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_getVersion() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getVersion_result result = new getVersion_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getVersion failed: unknown result");
+ }
+
+ public int getStatus() throws TException
+ {
+ send_getStatus();
+ return recv_getStatus();
+ }
+
+ public void send_getStatus() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getStatus", TMessageType.CALL, seqid_));
+ getStatus_args args = new getStatus_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public int recv_getStatus() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getStatus_result result = new getStatus_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getStatus failed: unknown result");
+ }
+
+ public String getStatusDetails() throws TException
+ {
+ send_getStatusDetails();
+ return recv_getStatusDetails();
+ }
+
+ public void send_getStatusDetails() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getStatusDetails", TMessageType.CALL, seqid_));
+ getStatusDetails_args args = new getStatusDetails_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_getStatusDetails() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getStatusDetails_result result = new getStatusDetails_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getStatusDetails failed: unknown result");
+ }
+
+ public AbstractMap<String,Long> getCounters() throws TException
+ {
+ send_getCounters();
+ return recv_getCounters();
+ }
+
+ public void send_getCounters() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getCounters", TMessageType.CALL, seqid_));
+ getCounters_args args = new getCounters_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public AbstractMap<String,Long> recv_getCounters() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getCounters_result result = new getCounters_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getCounters failed: unknown result");
+ }
+
+ public long getCounter(String key) throws TException
+ {
+ send_getCounter(key);
+ return recv_getCounter();
+ }
+
+ public void send_getCounter(String key) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getCounter", TMessageType.CALL, seqid_));
+ getCounter_args args = new getCounter_args();
+ args.key = key;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public long recv_getCounter() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getCounter_result result = new getCounter_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getCounter failed: unknown result");
+ }
+
+ public void setOption(String key, String value) throws TException
+ {
+ send_setOption(key, value);
+ recv_setOption();
+ }
+
+ public void send_setOption(String key, String value) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("setOption", TMessageType.CALL, seqid_));
+ setOption_args args = new setOption_args();
+ args.key = key;
+ args.value = value;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public void recv_setOption() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ setOption_result result = new setOption_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ return;
+ }
+
+ public String getOption(String key) throws TException
+ {
+ send_getOption(key);
+ return recv_getOption();
+ }
+
+ public void send_getOption(String key) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getOption", TMessageType.CALL, seqid_));
+ getOption_args args = new getOption_args();
+ args.key = key;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_getOption() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getOption_result result = new getOption_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getOption failed: unknown result");
+ }
+
+ public AbstractMap<String,String> getOptions() throws TException
+ {
+ send_getOptions();
+ return recv_getOptions();
+ }
+
+ public void send_getOptions() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getOptions", TMessageType.CALL, seqid_));
+ getOptions_args args = new getOptions_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public AbstractMap<String,String> recv_getOptions() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getOptions_result result = new getOptions_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getOptions failed: unknown result");
+ }
+
+ public long aliveSince() throws TException
+ {
+ send_aliveSince();
+ return recv_aliveSince();
+ }
+
+ public void send_aliveSince() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("aliveSince", TMessageType.CALL, seqid_));
+ aliveSince_args args = new aliveSince_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public long recv_aliveSince() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ aliveSince_result result = new aliveSince_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "aliveSince failed: unknown result");
+ }
+
+ public com.facebook.thrift.reflection.limited.Service getLimitedReflection() throws TException
+ {
+ send_getLimitedReflection();
+ return recv_getLimitedReflection();
+ }
+
+ public void send_getLimitedReflection() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("getLimitedReflection", TMessageType.CALL, seqid_));
+ getLimitedReflection_args args = new getLimitedReflection_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public com.facebook.thrift.reflection.limited.Service recv_getLimitedReflection() throws TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ getLimitedReflection_result result = new getLimitedReflection_result();
+ result.read(iprot_);
+ iprot_.readMessageEnd();
+ if (result.__isset.success) {
+ return result.success;
+ }
+ throw new TApplicationException(TApplicationException.MISSING_RESULT, "getLimitedReflection failed: unknown result");
+ }
+
+ public void reinitialize() throws TException
+ {
+ send_reinitialize();
+ }
+
+ public void send_reinitialize() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("reinitialize", TMessageType.CALL, seqid_));
+ reinitialize_args args = new reinitialize_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public void shutdown() throws TException
+ {
+ send_shutdown();
+ }
+
+ public void send_shutdown() throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("shutdown", TMessageType.CALL, seqid_));
+ shutdown_args args = new shutdown_args();
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ }
+ public static class Processor implements TProcessor {
+ public Processor(Iface iface)
+ {
+ iface_ = iface;
+ processMap_.put("getName", new getName());
+ processMap_.put("getVersion", new getVersion());
+ processMap_.put("getStatus", new getStatus());
+ processMap_.put("getStatusDetails", new getStatusDetails());
+ processMap_.put("getCounters", new getCounters());
+ processMap_.put("getCounter", new getCounter());
+ processMap_.put("setOption", new setOption());
+ processMap_.put("getOption", new getOption());
+ processMap_.put("getOptions", new getOptions());
+ processMap_.put("aliveSince", new aliveSince());
+ processMap_.put("getLimitedReflection", new getLimitedReflection());
+ processMap_.put("reinitialize", new reinitialize());
+ processMap_.put("shutdown", new shutdown());
+ }
+
+ protected static interface ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
+ }
+
+ private Iface iface_;
+ protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();
+
+ public boolean process(TProtocol iprot, TProtocol oprot) throws TException
+ {
+ TMessage msg = iprot.readMessageBegin();
+ ProcessFunction fn = processMap_.get(msg.name);
+ if (fn == null) {
+ TProtocolUtil.skip(iprot, TType.STRUCT);
+ iprot.readMessageEnd();
+ TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
+ oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
+ x.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ return true;
+ }
+ fn.process(msg.seqid, iprot, oprot);
+ return true;
+ }
+
+ private class getName implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getName_args args = new getName_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getName_result result = new getName_result();
+ result.success = iface_.getName();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getName", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getVersion implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getVersion_args args = new getVersion_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getVersion_result result = new getVersion_result();
+ result.success = iface_.getVersion();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getVersion", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getStatus implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getStatus_args args = new getStatus_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getStatus_result result = new getStatus_result();
+ result.success = iface_.getStatus();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getStatus", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getStatusDetails implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getStatusDetails_args args = new getStatusDetails_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getStatusDetails_result result = new getStatusDetails_result();
+ result.success = iface_.getStatusDetails();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getStatusDetails", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getCounters implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getCounters_args args = new getCounters_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getCounters_result result = new getCounters_result();
+ result.success = iface_.getCounters();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getCounters", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getCounter implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getCounter_args args = new getCounter_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getCounter_result result = new getCounter_result();
+ result.success = iface_.getCounter(args.key);
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getCounter", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class setOption implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ setOption_args args = new setOption_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ setOption_result result = new setOption_result();
+ iface_.setOption(args.key, args.value);
+ oprot.writeMessageBegin(new TMessage("setOption", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getOption implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getOption_args args = new getOption_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getOption_result result = new getOption_result();
+ result.success = iface_.getOption(args.key);
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getOption", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getOptions implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getOptions_args args = new getOptions_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getOptions_result result = new getOptions_result();
+ result.success = iface_.getOptions();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getOptions", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class aliveSince implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ aliveSince_args args = new aliveSince_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ aliveSince_result result = new aliveSince_result();
+ result.success = iface_.aliveSince();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("aliveSince", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class getLimitedReflection implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ getLimitedReflection_args args = new getLimitedReflection_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ getLimitedReflection_result result = new getLimitedReflection_result();
+ result.success = iface_.getLimitedReflection();
+ result.__isset.success = true;
+ oprot.writeMessageBegin(new TMessage("getLimitedReflection", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
+ private class reinitialize implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ reinitialize_args args = new reinitialize_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ iface_.reinitialize();
+ return;
+ }
+ }
+
+ private class shutdown implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ shutdown_args args = new shutdown_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ iface_.shutdown();
+ return;
+ }
+ }
+
+ }
+
+ public static class getName_args {
+ public getName_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getName_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getName_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getName_result {
+ public String success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getName_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getName_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRING;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.success);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getName_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getVersion_args {
+ public getVersion_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getVersion_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getVersion_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getVersion_result {
+ public String success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getVersion_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getVersion_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRING;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.success);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getVersion_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getStatus_args {
+ public getStatus_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getStatus_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getStatus_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getStatus_result {
+ public int success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getStatus_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.I32) {
+ this.success = iprot.readI32();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getStatus_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ field.name = "success";
+ field.type = TType.I32;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeI32(this.success);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getStatus_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getStatusDetails_args {
+ public getStatusDetails_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getStatusDetails_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getStatusDetails_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getStatusDetails_result {
+ public String success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getStatusDetails_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getStatusDetails_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRING;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.success);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getStatusDetails_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getCounters_args {
+ public getCounters_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getCounters_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getCounters_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getCounters_result {
+ public AbstractMap<String,Long> success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getCounters_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.MAP) {
+ {
+ TMap _map0 = iprot.readMapBegin();
+ this.success = new HashMap<String,Long>(2*_map0.size);
+ for (int _i1 = 0; _i1 < _map0.size; ++_i1)
+ {
+ String _key2;
+ long _val3;
+ _key2 = iprot.readString();
+ _val3 = iprot.readI64();
+ this.success.put(_key2, _val3);
+ }
+ iprot.readMapEnd();
+ }
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getCounters_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.MAP;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ {
+ oprot.writeMapBegin(new TMap(TType.STRING, TType.I64, this.success.size()));
+ for (String _iter4 : this.success.keySet()) {
+ oprot.writeString(_iter4);
+ oprot.writeI64(this.success.get(_iter4));
+ oprot.writeMapEnd();
+ }
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getCounters_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getCounter_args {
+ public String key;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean key = false;
+ }
+
+ public getCounter_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 1:
+ if (field.type == TType.STRING) {
+ this.key = iprot.readString();
+ this.__isset.key = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getCounter_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ if (this.key != null) {
+ field.name = "key";
+ field.type = TType.STRING;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.key);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getCounter_args(");
+ sb.append("key:");
+ sb.append(this.key);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getCounter_result {
+ public long success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getCounter_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.I64) {
+ this.success = iprot.readI64();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getCounter_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ field.name = "success";
+ field.type = TType.I64;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeI64(this.success);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getCounter_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class setOption_args {
+ public String key;
+ public String value;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean key = false;
+ public boolean value = false;
+ }
+
+ public setOption_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 1:
+ if (field.type == TType.STRING) {
+ this.key = iprot.readString();
+ this.__isset.key = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case 2:
+ if (field.type == TType.STRING) {
+ this.value = iprot.readString();
+ this.__isset.value = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("setOption_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ if (this.key != null) {
+ field.name = "key";
+ field.type = TType.STRING;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.key);
+ oprot.writeFieldEnd();
+ }
+ if (this.value != null) {
+ field.name = "value";
+ field.type = TType.STRING;
+ field.id = 2;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.value);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("setOption_args(");
+ sb.append("key:");
+ sb.append(this.key);
+ sb.append(",value:");
+ sb.append(this.value);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class setOption_result {
+ public setOption_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("setOption_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("setOption_result(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getOption_args {
+ public String key;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean key = false;
+ }
+
+ public getOption_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 1:
+ if (field.type == TType.STRING) {
+ this.key = iprot.readString();
+ this.__isset.key = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getOption_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ if (this.key != null) {
+ field.name = "key";
+ field.type = TType.STRING;
+ field.id = 1;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.key);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getOption_args(");
+ sb.append("key:");
+ sb.append(this.key);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getOption_result {
+ public String success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getOption_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getOption_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRING;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeString(this.success);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getOption_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getOptions_args {
+ public getOptions_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getOptions_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getOptions_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getOptions_result {
+ public AbstractMap<String,String> success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getOptions_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.MAP) {
+ {
+ TMap _map5 = iprot.readMapBegin();
+ this.success = new HashMap<String,String>(2*_map5.size);
+ for (int _i6 = 0; _i6 < _map5.size; ++_i6)
+ {
+ String _key7;
+ String _val8;
+ _key7 = iprot.readString();
+ _val8 = iprot.readString();
+ this.success.put(_key7, _val8);
+ }
+ iprot.readMapEnd();
+ }
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getOptions_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.MAP;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ {
+ oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.success.size()));
+ for (String _iter9 : this.success.keySet()) {
+ oprot.writeString(_iter9);
+ oprot.writeString(this.success.get(_iter9));
+ oprot.writeMapEnd();
+ }
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getOptions_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class aliveSince_args {
+ public aliveSince_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("aliveSince_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("aliveSince_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class aliveSince_result {
+ public long success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public aliveSince_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.I64) {
+ this.success = iprot.readI64();
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("aliveSince_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ field.name = "success";
+ field.type = TType.I64;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ oprot.writeI64(this.success);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("aliveSince_result(");
+ sb.append("success:");
+ sb.append(this.success);
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getLimitedReflection_args {
+ public getLimitedReflection_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getLimitedReflection_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getLimitedReflection_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class getLimitedReflection_result {
+ public com.facebook.thrift.reflection.limited.Service success;
+
+ public final Isset __isset = new Isset();
+ public final class Isset {
+ public boolean success = false;
+ }
+
+ public getLimitedReflection_result() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ case 0:
+ if (field.type == TType.STRUCT) {
+ this.success = new com.facebook.thrift.reflection.limited.Service();
+ this.success.read(iprot);
+ this.__isset.success = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("getLimitedReflection_result");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+
+ if (this.__isset.success) {
+ if (this.success != null) {
+ field.name = "success";
+ field.type = TType.STRUCT;
+ field.id = 0;
+ oprot.writeFieldBegin(field);
+ this.success.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("getLimitedReflection_result(");
+ sb.append("success:");
+ sb.append(this.success.toString());
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class reinitialize_args {
+ public reinitialize_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("reinitialize_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("reinitialize_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+ public static class shutdown_args {
+ public shutdown_args() {
+ }
+
+ public void read(TProtocol iprot) throws TException {
+ TField field;
+ TStruct struct = iprot.readStructBegin();
+ while (true)
+ {
+ field = iprot.readFieldBegin();
+ if (field.type == TType.STOP) {
+ break;
+ }
+ switch (field.id)
+ {
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ TStruct struct = new TStruct("shutdown_args");
+ TField field = new TField();
+ oprot.writeStructBegin(struct);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("shutdown_args(");
+ sb.append(")");
+ return sb.toString();
+ }
+
+ }
+
+}
diff --git a/contrib/fb303/java/build.xml b/contrib/fb303/java/build.xml
new file mode 100755
index 0000000..1b61e0a
--- /dev/null
+++ b/contrib/fb303/java/build.xml
@@ -0,0 +1,62 @@
+<project name="libfb303" default="dist" basedir="..">
+
+ <!-- project wide settings. All directories relative to basedir -->
+ <property name="src.dir" value="java"/>
+ <property name="if.dir" value="if"/>
+ <property name="thrift_home" value="/usr/local"/>
+
+ <!-- temp build directories -->
+ <property name="build.dir" value="${src.dir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="build.lib.dir" value="${build.dir}/lib"/>
+
+ <!-- final distribution directories -->
+ <property name="dist.dir" value="/usr/local"/>
+ <property name="dist.lib.dir" value="${dist.dir}/lib"/>
+
+ <!-- make temporary and distribution directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${build.lib.dir}"/>
+ <mkdir dir="${dist.dir}"/>
+ <mkdir dir="${dist.lib.dir}"/>
+ </target>
+
+ <!-- generate fb303 thrift code -->
+ <target name="thriftbuild">
+ <echo>generating thrift fb303 files</echo>
+ <exec executable="${thrift_home}/bin/thrift" failonerror="true">
+ <arg line="--gen java -I ${thrift_home}/share/ -o ${build.dir} ${src.dir}/../if/fb303.thrift" />
+ </exec>
+ </target>
+
+ <!-- compile the base and thrift generated code and jar them -->
+ <target name="dist" depends="prepare,thriftbuild">
+ <echo>Building libfb303.jar .... </echo>
+ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on">
+ <classpath>
+ <pathelement location="${thrift_home}/lib/libthrift.jar"/>
+ </classpath>
+ <include name="*.java"/>
+ <include name="${build.dir}/gen-java/com/facebook/fb303"/>
+ </javac>
+ <jar jarfile="${build.lib.dir}/libfb303.jar" basedir="${build.classes.dir}">
+ </jar>
+ </target>
+
+ <!-- copy the build jar to the distribution library directory -->
+ <target name="install" depends="dist">
+ <copy todir="${dist.lib.dir}">
+ <fileset dir="${build.lib.dir}" includes="libfb303.jar"/>
+ </copy>
+ </target>
+
+ <target name="clean">
+ <echo>Cleaning old stuff .... </echo>
+ <delete dir="${build.dir}/classes/com"/>
+ <delete dir="${build.dir}/lib"/>
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+</project>
diff --git a/contrib/fb303/java/fb_status.java b/contrib/fb303/java/fb_status.java
new file mode 100644
index 0000000..4b51b8c
--- /dev/null
+++ b/contrib/fb303/java/fb_status.java
@@ -0,0 +1,16 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package com.facebook.fb303;
+
+
+public class fb_status {
+ public static final int DEAD = 0;
+ public static final int STARTING = 1;
+ public static final int ALIVE = 2;
+ public static final int STOPPING = 3;
+ public static final int STOPPED = 4;
+ public static final int WARNING = 5;
+}
diff --git a/contrib/fb303/php/FacebookBase.php b/contrib/fb303/php/FacebookBase.php
new file mode 100644
index 0000000..0bcfe32
--- /dev/null
+++ b/contrib/fb303/php/FacebookBase.php
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * Copyright (c) 2006- Facebook
+ * Distributed under the Thrift Software License
+ *
+ * See accompanying file LICENSE or visit the Thrift site at:
+ * http://developers.facebook.com/thrift/
+ *
+ * @package thrift
+ * @author Aditya Agarwal <aditya@facebook.com>
+ */
+
+/**
+ * Abstract Class providing null implementation for FacebookService
+ * methods.
+ */
+class FacebookBase implements FacebookServiceIf {
+ protected $name_ = '';
+
+ public function __construct($name) {
+ $this->name_ = $name;
+ }
+
+ public function getName() {
+ return $this->name_;
+ }
+
+ public function getVersion() {
+ return '';
+ }
+
+ public function getStatus() {
+ return null;
+ }
+
+ public function getStatusDetails() {
+ return '';
+ }
+
+ public function getCounters() {
+ return array();
+ }
+
+ public function getCounter($key) {
+ return null;
+ }
+
+ public function setOption($key, $value) {
+ return;
+ }
+
+ public function getOption($key) {
+ return '';
+ }
+
+ public function getOptions() {
+ return array();
+ }
+
+ public function aliveSince() {
+ return 0;
+ }
+
+ public function getCpuProfile($duration) {
+ return '';
+ }
+
+ public function getLimitedReflection() {
+ return array();
+ }
+
+ public function reinitialize() {
+ return;
+ }
+
+ public function shutdown() {
+ return;
+ }
+
+}
+
diff --git a/contrib/fb303/py/Makefile.am b/contrib/fb303/py/Makefile.am
new file mode 100644
index 0000000..d6fac6e
--- /dev/null
+++ b/contrib/fb303/py/Makefile.am
@@ -0,0 +1,23 @@
+DESTDIR ?= /
+EXTRA_DIST = setup.py src
+
+all:
+
+all-local:
+ $(PYTHON) setup.py build
+
+# We're ignoring prefix here because site-packages seems to be
+# the equivalent of /usr/local/lib in Python land.
+# Old version (can't put inline because it's not portable).
+#$(PYTHON) setup.py install --prefix=$(prefix) --root=$(DESTDIR) $(PYTHON_SETUPUTIL_ARGS)
+install-exec-hook:
+ $(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PY_PREFIX) $(PYTHON_SETUPUTIL_ARGS)
+
+
+
+clean: clean-local
+
+clean-local:
+ $(RM) -r build
+
+check-local: all
diff --git a/contrib/fb303/py/fb303/FacebookBase.py b/contrib/fb303/py/fb303/FacebookBase.py
new file mode 100644
index 0000000..f365517
--- /dev/null
+++ b/contrib/fb303/py/fb303/FacebookBase.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2006- Facebook
+# Distributed under the Thrift Software License
+#
+# See accompanying file LICENSE or visit the Thrift site at:
+# http://developers.facebook.com/thrift/
+
+import time
+import FacebookService
+import thrift.reflection.limited
+from ttypes import fb_status
+
+class FacebookBase(FacebookService.Iface):
+
+ def __init__(self, name):
+ self.name = name
+ self.alive = int(time.time())
+ self.counters = {}
+
+ def getName(self, ):
+ return self.name
+
+ def getVersion(self, ):
+ return ''
+
+ def getStatus(self, ):
+ return fb_status.ALIVE
+
+ def getCounters(self):
+ return self.counters
+
+ def resetCounter(self, key):
+ self.counters[key] = 0
+
+ def getCounter(self, key):
+ if self.counters.has_key(key):
+ return self.counters[key]
+ return 0
+
+ def incrementCounter(self, key):
+ self.counters[key] = self.getCounter(key) + 1
+
+ def setOption(self, key, value):
+ pass
+
+ def getOption(self, key):
+ return ""
+
+ def getOptions(self):
+ return {}
+
+ def getOptions(self):
+ return {}
+
+ def aliveSince(self):
+ return self.alive
+
+ def getCpuProfile(self, duration):
+ return ""
+
+ def getLimitedReflection(self):
+ return thrift.reflection.limited.Service()
+
+ def reinitialize(self):
+ pass
+
+ def shutdown(self):
+ pass
diff --git a/contrib/fb303/py/fb303/FacebookService-remote b/contrib/fb303/py/fb303/FacebookService-remote
new file mode 100755
index 0000000..af985be
--- /dev/null
+++ b/contrib/fb303/py/fb303/FacebookService-remote
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+import sys
+import pprint
+from urlparse import urlparse
+from thrift.transport import TTransport
+from thrift.transport import TSocket
+from thrift.transport import THttpClient
+from thrift.protocol import TBinaryProtocol
+
+import FacebookService
+from ttypes import *
+
+if len(sys.argv) <= 1 or sys.argv[1] == '--help':
+ print ''
+ print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
+ print ''
+ print 'Functions:'
+ print ' string getName()'
+ print ' string getVersion()'
+ print ' fb_status getStatus()'
+ print ' string getStatusDetails()'
+ print ' getCounters()'
+ print ' i64 getCounter(string key)'
+ print ' void setOption(string key, string value)'
+ print ' string getOption(string key)'
+ print ' getOptions()'
+ print ' i64 aliveSince()'
+ print ' Service getLimitedReflection()'
+ print ' void reinitialize()'
+ print ' void shutdown()'
+ print ''
+ sys.exit(0)
+
+pp = pprint.PrettyPrinter(indent = 2)
+host = 'localhost'
+port = 9090
+uri = ''
+framed = False
+http = False
+argi = 1
+
+if sys.argv[argi] == '-h':
+ parts = sys.argv[argi+1].split(':')
+ host = parts[0]
+ 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]
+ http = True
+ argi += 2
+
+if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
+ framed = True
+ argi += 1
+
+cmd = sys.argv[argi]
+args = sys.argv[argi+1:]
+
+if http:
+ transport = THttpClient.THttpClient(host, port, uri)
+else:
+ socket = TSocket.TSocket(host, port)
+ if framed:
+ transport = TTransport.TFramedTransport(socket)
+ else:
+ transport = TTransport.TBufferedTransport(socket)
+protocol = TBinaryProtocol.TBinaryProtocol(transport)
+client = FacebookService.Client(protocol)
+transport.open()
+
+if cmd == 'getName':
+ if len(args) != 0:
+ print 'getName requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getName())
+
+elif cmd == 'getVersion':
+ if len(args) != 0:
+ print 'getVersion requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getVersion())
+
+elif cmd == 'getStatus':
+ if len(args) != 0:
+ print 'getStatus requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getStatus())
+
+elif cmd == 'getStatusDetails':
+ if len(args) != 0:
+ print 'getStatusDetails requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getStatusDetails())
+
+elif cmd == 'getCounters':
+ if len(args) != 0:
+ print 'getCounters requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getCounters())
+
+elif cmd == 'getCounter':
+ if len(args) != 1:
+ print 'getCounter requires 1 args'
+ sys.exit(1)
+ pp.pprint(client.getCounter(args[0],))
+
+elif cmd == 'setOption':
+ if len(args) != 2:
+ print 'setOption requires 2 args'
+ sys.exit(1)
+ pp.pprint(client.setOption(args[0],args[1],))
+
+elif cmd == 'getOption':
+ if len(args) != 1:
+ print 'getOption requires 1 args'
+ sys.exit(1)
+ pp.pprint(client.getOption(args[0],))
+
+elif cmd == 'getOptions':
+ if len(args) != 0:
+ print 'getOptions requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getOptions())
+
+elif cmd == 'aliveSince':
+ if len(args) != 0:
+ print 'aliveSince requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.aliveSince())
+
+elif cmd == 'getLimitedReflection':
+ if len(args) != 0:
+ print 'getLimitedReflection requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getLimitedReflection())
+
+elif cmd == 'reinitialize':
+ if len(args) != 0:
+ print 'reinitialize requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.reinitialize())
+
+elif cmd == 'shutdown':
+ if len(args) != 0:
+ print 'shutdown requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.shutdown())
+
+transport.close()
diff --git a/contrib/fb303/py/fb303/FacebookService.py b/contrib/fb303/py/fb303/FacebookService.py
new file mode 100644
index 0000000..ddf7d33
--- /dev/null
+++ b/contrib/fb303/py/fb303/FacebookService.py
@@ -0,0 +1,1831 @@
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+from thrift.Thrift import *
+from ttypes import *
+from thrift.Thrift import TProcessor
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+try:
+ from thrift.protocol import fastbinary
+except:
+ fastbinary = None
+
+
+class Iface:
+ def getName(self, ):
+ pass
+
+ def getVersion(self, ):
+ pass
+
+ def getStatus(self, ):
+ pass
+
+ def getStatusDetails(self, ):
+ pass
+
+ def getCounters(self, ):
+ pass
+
+ def getCounter(self, key):
+ pass
+
+ def setOption(self, key, value):
+ pass
+
+ def getOption(self, key):
+ pass
+
+ def getOptions(self, ):
+ pass
+
+ def aliveSince(self, ):
+ pass
+
+ def getLimitedReflection(self, ):
+ pass
+
+ def reinitialize(self, ):
+ pass
+
+ def shutdown(self, ):
+ pass
+
+
+class Client(Iface):
+ def __init__(self, iprot, oprot=None):
+ self._iprot = self._oprot = iprot
+ if oprot != None:
+ self._oprot = oprot
+ self._seqid = 0
+
+ def getName(self, ):
+ self.send_getName()
+ return self.recv_getName()
+
+ def send_getName(self, ):
+ self._oprot.writeMessageBegin('getName', TMessageType.CALL, self._seqid)
+ args = getName_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getName(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getName_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getName failed: unknown result");
+
+ def getVersion(self, ):
+ self.send_getVersion()
+ return self.recv_getVersion()
+
+ def send_getVersion(self, ):
+ self._oprot.writeMessageBegin('getVersion', TMessageType.CALL, self._seqid)
+ args = getVersion_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getVersion(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getVersion_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getVersion failed: unknown result");
+
+ def getStatus(self, ):
+ self.send_getStatus()
+ return self.recv_getStatus()
+
+ def send_getStatus(self, ):
+ self._oprot.writeMessageBegin('getStatus', TMessageType.CALL, self._seqid)
+ args = getStatus_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getStatus(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getStatus_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getStatus failed: unknown result");
+
+ def getStatusDetails(self, ):
+ self.send_getStatusDetails()
+ return self.recv_getStatusDetails()
+
+ def send_getStatusDetails(self, ):
+ self._oprot.writeMessageBegin('getStatusDetails', TMessageType.CALL, self._seqid)
+ args = getStatusDetails_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getStatusDetails(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getStatusDetails_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getStatusDetails failed: unknown result");
+
+ def getCounters(self, ):
+ self.send_getCounters()
+ return self.recv_getCounters()
+
+ def send_getCounters(self, ):
+ self._oprot.writeMessageBegin('getCounters', TMessageType.CALL, self._seqid)
+ args = getCounters_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getCounters(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getCounters_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getCounters failed: unknown result");
+
+ def getCounter(self, key):
+ self.send_getCounter(key)
+ return self.recv_getCounter()
+
+ def send_getCounter(self, key):
+ self._oprot.writeMessageBegin('getCounter', TMessageType.CALL, self._seqid)
+ args = getCounter_args()
+ args.key = key
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getCounter(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getCounter_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getCounter failed: unknown result");
+
+ def setOption(self, key, value):
+ self.send_setOption(key, value)
+ self.recv_setOption()
+
+ def send_setOption(self, key, value):
+ self._oprot.writeMessageBegin('setOption', TMessageType.CALL, self._seqid)
+ args = setOption_args()
+ args.key = key
+ args.value = value
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_setOption(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = setOption_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ return
+
+ def getOption(self, key):
+ self.send_getOption(key)
+ return self.recv_getOption()
+
+ def send_getOption(self, key):
+ self._oprot.writeMessageBegin('getOption', TMessageType.CALL, self._seqid)
+ args = getOption_args()
+ args.key = key
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getOption(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getOption_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getOption failed: unknown result");
+
+ def getOptions(self, ):
+ self.send_getOptions()
+ return self.recv_getOptions()
+
+ def send_getOptions(self, ):
+ self._oprot.writeMessageBegin('getOptions', TMessageType.CALL, self._seqid)
+ args = getOptions_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getOptions(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getOptions_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getOptions failed: unknown result");
+
+ def aliveSince(self, ):
+ self.send_aliveSince()
+ return self.recv_aliveSince()
+
+ def send_aliveSince(self, ):
+ self._oprot.writeMessageBegin('aliveSince', TMessageType.CALL, self._seqid)
+ args = aliveSince_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_aliveSince(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = aliveSince_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "aliveSince failed: unknown result");
+
+ def getLimitedReflection(self, ):
+ self.send_getLimitedReflection()
+ return self.recv_getLimitedReflection()
+
+ def send_getLimitedReflection(self, ):
+ self._oprot.writeMessageBegin('getLimitedReflection', TMessageType.CALL, self._seqid)
+ args = getLimitedReflection_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getLimitedReflection(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getLimitedReflection_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getLimitedReflection failed: unknown result");
+
+ def reinitialize(self, ):
+ self.send_reinitialize()
+
+ def send_reinitialize(self, ):
+ self._oprot.writeMessageBegin('reinitialize', TMessageType.CALL, self._seqid)
+ args = reinitialize_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+ def shutdown(self, ):
+ self.send_shutdown()
+
+ def send_shutdown(self, ):
+ self._oprot.writeMessageBegin('shutdown', TMessageType.CALL, self._seqid)
+ args = shutdown_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+class Processor(Iface, TProcessor):
+ def __init__(self, handler):
+ self._handler = handler
+ self._processMap = {}
+ self._processMap["getName"] = Processor.process_getName
+ self._processMap["getVersion"] = Processor.process_getVersion
+ self._processMap["getStatus"] = Processor.process_getStatus
+ self._processMap["getStatusDetails"] = Processor.process_getStatusDetails
+ self._processMap["getCounters"] = Processor.process_getCounters
+ self._processMap["getCounter"] = Processor.process_getCounter
+ self._processMap["setOption"] = Processor.process_setOption
+ self._processMap["getOption"] = Processor.process_getOption
+ self._processMap["getOptions"] = Processor.process_getOptions
+ self._processMap["aliveSince"] = Processor.process_aliveSince
+ self._processMap["getLimitedReflection"] = Processor.process_getLimitedReflection
+ self._processMap["reinitialize"] = Processor.process_reinitialize
+ self._processMap["shutdown"] = Processor.process_shutdown
+
+ def process(self, iprot, oprot):
+ (name, type, seqid) = iprot.readMessageBegin()
+ 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_getName(self, seqid, iprot, oprot):
+ args = getName_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getName_result()
+ result.success = self._handler.getName()
+ oprot.writeMessageBegin("getName", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getVersion(self, seqid, iprot, oprot):
+ args = getVersion_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getVersion_result()
+ result.success = self._handler.getVersion()
+ oprot.writeMessageBegin("getVersion", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getStatus(self, seqid, iprot, oprot):
+ args = getStatus_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getStatus_result()
+ result.success = self._handler.getStatus()
+ oprot.writeMessageBegin("getStatus", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getStatusDetails(self, seqid, iprot, oprot):
+ args = getStatusDetails_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getStatusDetails_result()
+ result.success = self._handler.getStatusDetails()
+ oprot.writeMessageBegin("getStatusDetails", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getCounters(self, seqid, iprot, oprot):
+ args = getCounters_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getCounters_result()
+ result.success = self._handler.getCounters()
+ oprot.writeMessageBegin("getCounters", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getCounter(self, seqid, iprot, oprot):
+ args = getCounter_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getCounter_result()
+ result.success = self._handler.getCounter(args.key)
+ oprot.writeMessageBegin("getCounter", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_setOption(self, seqid, iprot, oprot):
+ args = setOption_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = setOption_result()
+ self._handler.setOption(args.key, args.value)
+ oprot.writeMessageBegin("setOption", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getOption(self, seqid, iprot, oprot):
+ args = getOption_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getOption_result()
+ result.success = self._handler.getOption(args.key)
+ oprot.writeMessageBegin("getOption", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getOptions(self, seqid, iprot, oprot):
+ args = getOptions_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getOptions_result()
+ result.success = self._handler.getOptions()
+ oprot.writeMessageBegin("getOptions", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_aliveSince(self, seqid, iprot, oprot):
+ args = aliveSince_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = aliveSince_result()
+ result.success = self._handler.aliveSince()
+ oprot.writeMessageBegin("aliveSince", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_getLimitedReflection(self, seqid, iprot, oprot):
+ args = getLimitedReflection_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getLimitedReflection_result()
+ result.success = self._handler.getLimitedReflection()
+ oprot.writeMessageBegin("getLimitedReflection", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_reinitialize(self, seqid, iprot, oprot):
+ args = reinitialize_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ self._handler.reinitialize()
+ return
+
+ def process_shutdown(self, seqid, iprot, oprot):
+ args = shutdown_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ self._handler.shutdown()
+ return
+
+
+# HELPER FUNCTIONS AND STRUCTURES
+
+class getName_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getName_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getName_result:
+
+ thrift_spec = (
+ (0, TType.STRING, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.STRING:
+ self.success = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getName_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.STRING, 0)
+ oprot.writeString(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getVersion_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getVersion_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getVersion_result:
+
+ thrift_spec = (
+ (0, TType.STRING, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.STRING:
+ self.success = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getVersion_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.STRING, 0)
+ oprot.writeString(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getStatus_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getStatus_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getStatus_result:
+
+ thrift_spec = (
+ (0, TType.I32, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getStatus_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.I32, 0)
+ oprot.writeI32(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getStatusDetails_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getStatusDetails_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getStatusDetails_result:
+
+ thrift_spec = (
+ (0, TType.STRING, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.STRING:
+ self.success = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getStatusDetails_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.STRING, 0)
+ oprot.writeString(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getCounters_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getCounters_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getCounters_result:
+
+ thrift_spec = (
+ (0, TType.MAP, 'success', (TType.STRING,None,TType.I64,None), None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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 = {}
+ (_ktype1, _vtype2, _size0 ) = iprot.readMapBegin()
+ for _i4 in xrange(_size0):
+ _key5 = iprot.readString();
+ _val6 = iprot.readI64();
+ self.success[_key5] = _val6
+ iprot.readMapEnd()
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getCounters_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.MAP, 0)
+ oprot.writeMapBegin(TType.STRING, TType.I64, len(self.success))
+ for kiter7,viter8 in self.success.items():
+ oprot.writeString(kiter7)
+ oprot.writeI64(viter8)
+ oprot.writeMapEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getCounter_args:
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ )
+
+ def __init__(self, d=None):
+ self.key = None
+ if isinstance(d, dict):
+ if 'key' in d:
+ self.key = d['key']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getCounter_args')
+ if self.key != None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getCounter_result:
+
+ thrift_spec = (
+ (0, TType.I64, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.I64:
+ self.success = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getCounter_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.I64, 0)
+ oprot.writeI64(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class setOption_args:
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ (2, TType.STRING, 'value', None, None, ), # 2
+ )
+
+ def __init__(self, d=None):
+ self.key = None
+ self.value = None
+ if isinstance(d, dict):
+ if 'key' in d:
+ self.key = d['key']
+ if 'value' in d:
+ self.value = d['value']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.value = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('setOption_args')
+ if self.key != None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ if self.value != None:
+ oprot.writeFieldBegin('value', TType.STRING, 2)
+ oprot.writeString(self.value)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class setOption_result:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('setOption_result')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getOption_args:
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'key', None, None, ), # 1
+ )
+
+ def __init__(self, d=None):
+ self.key = None
+ if isinstance(d, dict):
+ if 'key' in d:
+ self.key = d['key']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.key = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getOption_args')
+ if self.key != None:
+ oprot.writeFieldBegin('key', TType.STRING, 1)
+ oprot.writeString(self.key)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getOption_result:
+
+ thrift_spec = (
+ (0, TType.STRING, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.STRING:
+ self.success = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getOption_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.STRING, 0)
+ oprot.writeString(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getOptions_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getOptions_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getOptions_result:
+
+ thrift_spec = (
+ (0, TType.MAP, 'success', (TType.STRING,None,TType.STRING,None), None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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 = {}
+ (_ktype10, _vtype11, _size9 ) = iprot.readMapBegin()
+ for _i13 in xrange(_size9):
+ _key14 = iprot.readString();
+ _val15 = iprot.readString();
+ self.success[_key14] = _val15
+ iprot.readMapEnd()
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getOptions_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.MAP, 0)
+ oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success))
+ for kiter16,viter17 in self.success.items():
+ oprot.writeString(kiter16)
+ oprot.writeString(viter17)
+ oprot.writeMapEnd()
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class aliveSince_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('aliveSince_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class aliveSince_result:
+
+ thrift_spec = (
+ (0, TType.I64, 'success', None, None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.I64:
+ self.success = iprot.readI64();
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('aliveSince_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.I64, 0)
+ oprot.writeI64(self.success)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getLimitedReflection_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getLimitedReflection_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class getLimitedReflection_result:
+
+ thrift_spec = (
+ (0, TType.STRUCT, 'success', (thrift.reflection.limited.ttypes.Service, thrift.reflection.limited.ttypes.Service.thrift_spec), None, ), # 0
+ )
+
+ def __init__(self, d=None):
+ self.success = None
+ if isinstance(d, dict):
+ if 'success' in d:
+ self.success = d['success']
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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 = thrift.reflection.limited.ttypes.Service()
+ self.success.read(iprot)
+ else:
+ iprot.skip(ftype)
+ else:
+ iprot.skip(ftype)
+ iprot.readFieldEnd()
+ iprot.readStructEnd()
+
+ def write(self, oprot):
+ if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('getLimitedReflection_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.STRUCT, 0)
+ self.success.write(oprot)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class reinitialize_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('reinitialize_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class reinitialize_result:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('reinitialize_result')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class shutdown_args:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('shutdown_args')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class shutdown_result:
+
+ thrift_spec = (
+ )
+
+ def __init__(self, d=None):
+ pass
+
+ def read(self, iprot):
+ if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+ fastbinary.decode_binary(self, iprot.trans, (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.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+ oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+ return
+ oprot.writeStructBegin('shutdown_result')
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ def __repr__(self):
+ return repr(self.__dict__)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ return not (self == other)
+
+
diff --git a/contrib/fb303/py/fb303/__init__.py b/contrib/fb303/py/fb303/__init__.py
new file mode 100644
index 0000000..14c89e0
--- /dev/null
+++ b/contrib/fb303/py/fb303/__init__.py
@@ -0,0 +1 @@
+__all__ = ['ttypes', 'constants', 'FacebookService']
diff --git a/contrib/fb303/py/fb303/__init__.pyc b/contrib/fb303/py/fb303/__init__.pyc
new file mode 100644
index 0000000..0f8cfed
--- /dev/null
+++ b/contrib/fb303/py/fb303/__init__.pyc
Binary files differ
diff --git a/contrib/fb303/py/fb303/constants.py b/contrib/fb303/py/fb303/constants.py
new file mode 100644
index 0000000..2f17ec3
--- /dev/null
+++ b/contrib/fb303/py/fb303/constants.py
@@ -0,0 +1,9 @@
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+from thrift.Thrift import *
+from ttypes import *
+
diff --git a/contrib/fb303/py/fb303/ttypes.py b/contrib/fb303/py/fb303/ttypes.py
new file mode 100644
index 0000000..69b48ea
--- /dev/null
+++ b/contrib/fb303/py/fb303/ttypes.py
@@ -0,0 +1,26 @@
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+from thrift.Thrift import *
+import thrift.reflection.limited.ttypes
+
+
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+try:
+ from thrift.protocol import fastbinary
+except:
+ fastbinary = None
+
+
+class fb_status:
+ DEAD = 0
+ STARTING = 1
+ ALIVE = 2
+ STOPPING = 3
+ STOPPED = 4
+ WARNING = 5
+
diff --git a/contrib/fb303/py/fb303/ttypes.pyc b/contrib/fb303/py/fb303/ttypes.pyc
new file mode 100644
index 0000000..6d8d774
--- /dev/null
+++ b/contrib/fb303/py/fb303/ttypes.pyc
Binary files differ
diff --git a/contrib/fb303/py/setup.py b/contrib/fb303/py/setup.py
new file mode 100644
index 0000000..460ee58
--- /dev/null
+++ b/contrib/fb303/py/setup.py
@@ -0,0 +1,7 @@
+from distutils.core import setup
+
+setup(name='fb303',
+ version='1.0',
+ packages=['fb303'],
+ )
+
diff --git a/contrib/fb303/scripts/fb303_simple_mgmt.py b/contrib/fb303/scripts/fb303_simple_mgmt.py
new file mode 100755
index 0000000..bb2b62f
--- /dev/null
+++ b/contrib/fb303/scripts/fb303_simple_mgmt.py
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2006- Facebook
+# Distributed under the Thrift Software License
+#
+# See accompanying file LICENSE or visit the Thrift site at:
+# http://developers.facebook.com/thrift/
+
+import sys, os
+from optparse import OptionParser
+
+from thrift.Thrift import *
+
+from thrift.transport import TSocket
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+
+from fb303 import *
+from fb303.ttypes import *
+
+def service_ctrl(
+ command,
+ port,
+ trans_factory = None,
+ prot_factory = None):
+ """
+ service_ctrl is a generic function to execute standard fb303 functions
+
+ @param command: one of stop, start, reload, status, counters, name, alive
+ @param port: service's port
+ @param trans_factory: TTransportFactory to use for obtaining a TTransport. Default is
+ TBufferedTransportFactory
+ @param prot_factory: TProtocolFactory to use for obtaining a TProtocol. Default is
+ TBinaryProtocolFactory
+ """
+
+ # Only root should be able to run these scripts, although we could relax this for some of the operations.
+ if os.getuid() != 0:
+ print "requires root."
+ return 4
+
+ if command in ["status"]:
+ try:
+ status = fb303_wrapper('status', port, trans_factory, prot_factory)
+ status_details = fb303_wrapper('get_status_details', port, trans_factory, prot_factory)
+
+ msg = fb_status_string(status)
+ if (len(status_details)):
+ msg += " - %s" % status_details
+ print msg
+
+ if (status == fb_status.ALIVE):
+ return 2
+ else:
+ return 3
+ except:
+ print "Failed to get status"
+ return 3
+
+ # async commands
+ if command in ["stop","reload"]:
+ try:
+ fb303_wrapper(command, port, trans_factory, prot_factory)
+ return 0
+ except:
+ print "failed to tell the service to ", command
+ return 3
+
+ # scalar commands
+ if command in ["version","alive","name"]:
+ try:
+ result = fb303_wrapper(command, port, trans_factory, prot_factory)
+ print result
+ return 0
+ except:
+ print "failed to get ",command
+ return 3
+
+ # counters
+ if command in ["counters"]:
+ try:
+ counters = fb303_wrapper('counters', port, trans_factory, prot_factory)
+ for counter in counters:
+ print "%s: %d" % (counter, counters[counter])
+ return 0
+ except:
+ print "failed to get counters"
+ return 3
+
+ return 0;
+
+
+def fb303_wrapper(command, port, trans_factory = None, prot_factory = None):
+ sock = TSocket.TSocket('localhost', port)
+
+ # use input transport factory if provided
+ if (trans_factory is None):
+ trans = TTransport.TBufferedTransport(sock)
+ else:
+ trans = trans_factory.getTransport(sock)
+
+ # use input protocol factory if provided
+ if (prot_factory is None):
+ prot = TBinaryProtocol.TBinaryProtocol(trans)
+ else:
+ prot = prot_factory.getProtocol(trans)
+
+ # initialize client and open transport
+ fb303_client = FacebookService.Client(prot, prot)
+ trans.open()
+
+ if (command == 'reload'):
+ fb303_client.reinitialize()
+
+ elif (command == 'stop'):
+ fb303_client.shutdown()
+
+ elif (command == 'status'):
+ return fb303_client.getStatus()
+
+ elif (command == 'version'):
+ return fb303_client.getVersion()
+
+ elif (command == 'get_status_details'):
+ return fb303_client.getStatusDetails()
+
+ elif (command == 'counters'):
+ return fb303_client.getCounters()
+
+ elif (command == 'name'):
+ return fb303_client.getName()
+
+ elif (command == 'alive'):
+ return fb303_client.aliveSince()
+
+ trans.close()
+
+
+def fb_status_string(status_enum):
+ if (status_enum == fb_status.DEAD):
+ return "DEAD"
+ if (status_enum == fb_status.STARTING):
+ return "STARTING"
+ if (status_enum == fb_status.ALIVE):
+ return "ALIVE"
+ if (status_enum == fb_status.STOPPING):
+ return "STOPPING"
+ if (status_enum == fb_status.STOPPED):
+ return "STOPPED"
+ if (status_enum == fb_status.WARNING):
+ return "WARNING"
+
+
+def main(port, command):
+ status = service_ctrl(options.command, options.port)
+ sys.exit(status)
+
+
+# parse command line options
+parser = OptionParser()
+parser.add_option("-c", "--command", dest="command", help="execute this API", choices=["stop","counters","status","reload","version","name","alive"],
+ default="status")
+parser.add_option("-p","--port",dest="port",help="the service's port", default=9082)
+
+(options, args) = parser.parse_args()
+
+main(options.port, options.command)