Permalink
Browse files

Add thrift and a thrift service

  • Loading branch information...
1 parent c320a24 commit 284534298389abe8e20dc6eb4148b4c413a387e8 @toddlipcon toddlipcon committed Nov 7, 2008
Showing with 4,011 additions and 12 deletions.
  1. +3 −3 Rakefile
  2. +9 −0 conf/default.config
  3. +24 −0 deps/thrift/COPYING
  4. +24 −0 deps/thrift/LICENSE
  5. +18 −0 deps/thrift/Makefile
  6. +31 −0 deps/thrift/README
  7. +59 −0 deps/thrift/build/beamver
  8. +15 −0 deps/thrift/build/buildtargets.mk
  9. +24 −0 deps/thrift/build/colors.mk
  10. +12 −0 deps/thrift/build/docs.mk
  11. +98 −0 deps/thrift/build/mime.types
  12. +146 −0 deps/thrift/build/otp.mk
  13. +85 −0 deps/thrift/build/otp_subdir.mk
  14. +29 −0 deps/thrift/build/raw_test.mk
  15. BIN deps/thrift/ebin/test_handler.beam
  16. BIN deps/thrift/ebin/test_service.beam
  17. +44 −0 deps/thrift/ebin/thrift.app
  18. +1 −0 deps/thrift/ebin/thrift.appup
  19. BIN deps/thrift/ebin/thrift_base64_transport.beam
  20. BIN deps/thrift/ebin/thrift_binary_protocol.beam
  21. BIN deps/thrift/ebin/thrift_buffered_transport.beam
  22. BIN deps/thrift/ebin/thrift_client.beam
  23. BIN deps/thrift/ebin/thrift_disk_log_transport.beam
  24. BIN deps/thrift/ebin/thrift_file_transport.beam
  25. BIN deps/thrift/ebin/thrift_framed_transport.beam
  26. BIN deps/thrift/ebin/thrift_http_transport.beam
  27. BIN deps/thrift/ebin/thrift_processor.beam
  28. BIN deps/thrift/ebin/thrift_protocol.beam
  29. BIN deps/thrift/ebin/thrift_server.beam
  30. BIN deps/thrift/ebin/thrift_service.beam
  31. BIN deps/thrift/ebin/thrift_socket_server.beam
  32. BIN deps/thrift/ebin/thrift_socket_transport.beam
  33. BIN deps/thrift/ebin/thrift_transport.beam
  34. +40 −0 deps/thrift/include/thrift_constants.hrl
  35. +12 −0 deps/thrift/include/thrift_protocol.hrl
  36. +318 −0 deps/thrift/src/.thrift_client.erl~
  37. +171 −0 deps/thrift/src/.thrift_server.erl~
  38. +116 −0 deps/thrift/src/Makefile
  39. +7 −0 deps/thrift/src/test_handler.erl
  40. +10 −0 deps/thrift/src/test_service.erl
  41. +44 −0 deps/thrift/src/thrift.app.src
  42. +1 −0 deps/thrift/src/thrift.appup.src
  43. +45 −0 deps/thrift/src/thrift_base64_transport.erl
  44. +311 −0 deps/thrift/src/thrift_binary_protocol.erl
  45. +168 −0 deps/thrift/src/thrift_buffered_transport.erl
  46. +318 −0 deps/thrift/src/thrift_client.erl
  47. +106 −0 deps/thrift/src/thrift_disk_log_transport.erl
  48. +69 −0 deps/thrift/src/thrift_file_transport.erl
  49. +196 −0 deps/thrift/src/thrift_framed_transport.erl
  50. +169 −0 deps/thrift/src/thrift_http_transport.erl
  51. +174 −0 deps/thrift/src/thrift_processor.erl
  52. +326 −0 deps/thrift/src/thrift_protocol.erl
  53. +171 −0 deps/thrift/src/thrift_server.erl
  54. +6 −0 deps/thrift/src/thrift_service.erl
  55. +240 −0 deps/thrift/src/thrift_socket_server.erl
  56. +100 −0 deps/thrift/src/thrift_socket_transport.erl
  57. +38 −0 deps/thrift/src/thrift_transport.erl
  58. +1 −0 deps/thrift/vsn.mk
  59. +4 −3 elibs/dynomite_app.erl
  60. +2 −1 elibs/dynomite_sup.erl
  61. +2 −1 elibs/dynomite_web.erl
  62. +2 −1 elibs/partitions.erl
  63. +70 −0 elibs/thrift_service.erl
  64. +9 −0 gen-erl/dynomite_constants.hrl
  65. +58 −0 gen-erl/dynomite_thrift.erl
  66. +5 −0 gen-erl/dynomite_thrift.hrl
  67. +29 −0 gen-erl/dynomite_types.erl
  68. +8 −0 gen-erl/dynomite_types.hrl
  69. +34 −0 if/dynomite.thrift
  70. +2 −2 include/config.hrl
  71. +7 −1 rlibs/cli/start.rb
View
@@ -3,11 +3,11 @@ require 'rubygems'
require 'rake'
ERLC_TEST_FLAGS = "-pa deps/eunit/ebin -I deps/eunit/include -DTEST"
-ERLC_FLAGS = "+debug_info -W0 -I include -pa deps/mochiweb/ebin -I deps/mochiweb/include -pa deps/rfc4627/ebin -I deps/rfc4627/include -o ebin"
+ERLC_FLAGS = "+debug_info -W0 -I include -pa deps/mochiweb/ebin -I deps/mochiweb/include -pa deps/rfc4627/ebin -I deps/rfc4627/include -I gen-erl/ -o ebin"
task :default => [:build_deps] do
puts "building #{ENV['TEST']}"
- sh "erlc #{ERLC_FLAGS} #{ENV['TEST'] ? ERLC_TEST_FLAGS : ''} elibs/*.erl"
+ sh "erlc #{ERLC_FLAGS} #{ENV['TEST'] ? ERLC_TEST_FLAGS : ''} elibs/*.erl gen-erl/*.erl"
# Dir["templates/*"].each do |template|
# sh %Q(erl -pz ebin -noshell -eval 'erltl:compile("#{template}", [{outdir, "ebin"}, debug_info, show_errors, show_warnings])' -s erlang halt)
# end
@@ -66,4 +66,4 @@ task :build_deps do
Dir["deps/*"].each do |dir|
sh "cd #{dir} && make"
end
-end
+end
View
@@ -0,0 +1,9 @@
+%% rotating log and minimal tty
+[{sasl, [
+ {sasl_error_logger, false},
+ {errlog_type, error},
+ {error_logger_mf_dir,"/p/log/dynomite"},
+ {error_logger_mf_maxbytes,52428800}, % 50 MB
+ {error_logger_mf_maxfiles, 10}
+]},
+ {dynomite, [{web_port, 8081}]}].
View
@@ -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.
View
@@ -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.
View
@@ -0,0 +1,18 @@
+MODULES = \
+ src
+
+all clean docs:
+ for dir in $(MODULES); do \
+ (cd $$dir; ${MAKE} $@); \
+ done
+
+install: all
+ echo 'No install target, sorry.'
+
+check: all
+
+distclean: clean
+
+# Hack to make "make dist" work.
+# This should not work, but it appears to.
+distdir:
View
@@ -0,0 +1,31 @@
+Example session using thrift_client:
+
+118> f(), {ok, C} = thrift_client:start_link("localhost", 9090, thriftTest_thrif
+t).
+{ok,<0.271.0>}
+119> thrift_client:call(C, testVoid, []).
+{ok,ok}
+120> thrift_client:call(C, testVoid, [asdf]).
+{error,{bad_args,testVoid,[asdf]}}
+121> thrift_client:call(C, testI32, [123]).
+{ok,123}
+122> thrift_client:call(C, testAsync, [1]).
+{ok,ok}
+123> catch thrift_client:call(C, testXception, ["foo"]).
+{error,{no_function,testXception}}
+124> catch thrift_client:call(C, testException, ["foo"]).
+{ok,ok}
+125> catch thrift_client:call(C, testException, ["Xception"]).
+{xception,1001,"This is an Xception"}
+126> thrift_client:call(C, testException, ["Xception"]).
+
+=ERROR REPORT==== 24-Feb-2008::23:00:23 ===
+Error in process <0.269.0> with exit value: {{nocatch,{xception,1001,"This is an
+ Xception"}},[{thrift_client,call,3},{erl_eval,do_apply,5},{shell,exprs,6},{shel
+l,eval_loop,3}]}
+
+** exited: {{nocatch,{xception,1001,"This is an Xception"}},
+ [{thrift_client,call,3},
+ {erl_eval,do_apply,5},
+ {shell,exprs,6},
+ {shell,eval_loop,3}]} **
View
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# erlwareSys: otp/build/beamver,v 1.1 2002/02/14 11:45:20 hal Exp $
+
+# usage: beamver <beam_file>
+#
+# if there's a usable -vsn() attribute, print it and exit with status 0
+# otherwise, print nothing and exit with status 1
+
+# From the Erlang shell:
+#
+# 5> code:which(acca_inets).
+# "/home/martin/work/otp/releases/<app>/../../acca/ebin/<app>.beam"
+#
+# 8> beam_lib:version(code:which(<app>)).
+# {ok,{<app>,['$Id: beamver,v 1.1.1.1 2003/06/13 21:43:21 mlogan Exp $ ']}}
+
+# TMPFILE looks like this:
+#
+# io:format("hello ~p~n",
+# beam_lib:version("/home/hal/work/otp/acca/ebin/acca_inets.beam")]).
+
+TMPFILE=/tmp/beamver.$$
+
+# exit with failure if we can't read the file
+test -f "$1" || exit 1
+BEAMFILE=\"$1\"
+
+cat > $TMPFILE <<_EOF
+io:format("~p~n",
+ [beam_lib:version($BEAMFILE)]).
+_EOF
+
+# beam_result is {ok,{Module_name, Beam_version} or {error,beam_lib,{Reason}}
+beam_result=`erl -noshell \
+ -s file eval $TMPFILE \
+ -s erlang halt`
+
+rm -f $TMPFILE
+
+# sed regexes:
+# remove brackets and anything outside them
+# remove quotes and anything outside them
+# remove apostrophes and anything outside them
+# remove leading and trailing spaces
+
+case $beam_result in
+\{ok*)
+ echo $beam_result | sed -e 's/.*\[\(.*\)].*/\1/' \
+ -e 's/.*\"\(.*\)\".*/\1/' \
+ -e "s/.*\'\(.*\)\'.*/\1/" \
+ -e 's/ *$//' -e 's/^ *//'
+ exit 0
+ ;;
+*)
+ exit 1
+ ;;
+esac
+
@@ -0,0 +1,15 @@
+EBIN ?= ../ebin
+ESRC ?= .
+EMULATOR = beam
+
+ERLC_WFLAGS = -W
+ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS)
+ERL = erl -boot start_clean
+
+$(EBIN)/%.beam: $(ESRC)/%.erl
+ @echo " ERLC $<"
+ @$(ERLC) $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
+
+.erl.beam:
+ $(ERLC) $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(dir $@) $<
+
@@ -0,0 +1,24 @@
+# Colors to assist visual inspection of make output.
+
+# Colors
+LGRAY=$$'\e[0;37m'
+DGRAY=$$'\e[1;30m'
+LGREEN=$$'\e[1;32m'
+LBLUE=$$'\e[1;34m'
+LCYAN=$$'\e[1;36m'
+LPURPLE=$$'\e[1;35m'
+LRED=$$'\e[1;31m'
+NO_COLOR=$$'\e[0m'
+DEFAULT=$$'\e[0m'
+BLACK=$$'\e[0;30m'
+BLUE=$$'\e[0;34m'
+GREEN=$$'\e[0;32m'
+CYAN=$$'\e[0;36m'
+RED=$$'\e[0;31m'
+PURPLE=$$'\e[0;35m'
+BROWN=$$'\e[0;33m'
+YELLOW=$$'\e[1;33m'
+WHITE=$$'\e[1;37m'
+
+BOLD=$$'\e[1;37m'
+OFF=$$'\e[0m'
View
@@ -0,0 +1,12 @@
+EDOC_PATH=../../../tools/utilities
+
+#single place to include docs from.
+docs:
+ @mkdir -p ../doc
+ @echo -n $${MY_BLUE:-$(BLUE)}; \
+ $(EDOC_PATH)/edoc $(APP_NAME); \
+ if [ $$? -eq 0 ]; then \
+ echo $${MY_LRED:-$(LRED)}"$$d Doc Failed"; \
+ fi; \
+ echo -n $(OFF)$(NO_COLOR)
+
@@ -0,0 +1,98 @@
+
+application/activemessage
+application/andrew-inset
+application/applefile
+application/atomicmail
+application/dca-rft
+application/dec-dx
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+application/macwriteii
+application/msword doc
+application/news-message-id
+application/news-transmission
+application/octet-stream bin dms lha lzh exe class
+application/oda oda
+application/pdf pdf
+application/postscript ai eps ps
+application/powerpoint ppt
+application/remote-printing
+application/rtf rtf
+application/slate
+application/wita
+application/wordperfect5.1
+application/x-bcpio bcpio
+application/x-cdlink vcd
+application/x-compress Z
+application/x-cpio cpio
+application/x-csh csh
+application/x-director dcr dir dxr
+application/x-dvi dvi
+application/x-gtar gtar
+application/x-gzip gz
+application/x-hdf hdf
+application/x-httpd-cgi cgi
+application/x-koan skp skd skt skm
+application/x-latex latex
+application/x-mif mif
+application/x-netcdf nc cdf
+application/x-sh sh
+application/x-shar shar
+application/x-stuffit sit
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-texinfo texinfo texi
+application/x-troff t tr roff
+application/x-troff-man man
+application/x-troff-me me
+application/x-troff-ms ms
+application/x-ustar ustar
+application/x-wais-source src
+application/zip zip
+audio/basic au snd
+audio/mpeg mpga mp2
+audio/x-aiff aif aiff aifc
+audio/x-pn-realaudio ram
+audio/x-pn-realaudio-plugin rpm
+audio/x-realaudio ra
+audio/x-wav wav
+chemical/x-pdb pdb xyz
+image/gif gif
+image/ief ief
+image/jpeg jpeg jpg jpe
+image/png png
+image/tiff tiff tif
+image/x-cmu-raster ras
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-rgb rgb
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+message/external-body
+message/news
+message/partial
+message/rfc822
+multipart/alternative
+multipart/appledouble
+multipart/digest
+multipart/mixed
+multipart/parallel
+text/html html htm
+text/x-server-parsed-html shtml
+text/plain txt
+text/richtext rtx
+text/tab-separated-values tsv
+text/x-setext etx
+text/x-sgml sgml sgm
+video/mpeg mpeg mpg mpe
+video/quicktime qt mov
+video/x-msvideo avi
+video/x-sgi-movie movie
+x-conference/x-cooltalk ice
+x-world/x-vrml wrl vrml
Oops, something went wrong.

0 comments on commit 2845342

Please sign in to comment.