You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/27 08:08:39 UTC
svn commit: r1140024 [1/15] - in /incubator/mesos/trunk: ./ ec2/
ec2/deploy.karmic64/ ec2/deploy.solaris/ frameworks/torque/nexus-hpl/
include/mesos/ src/ src/common/ src/configurator/ src/detector/
src/examples/ src/examples/java/ src/examples/python/...
Author: benh
Date: Mon Jun 27 06:08:33 2011
New Revision: 1140024
URL: http://svn.apache.org/viewvc?rev=1140024&view=rev
Log:
This commit is based off of a patch from the diff of github.com/mesos/mesos/commit/2fdef1ccab3eff4719682c5123d9231020e4fbf7 and what was previously here.
Added:
incubator/mesos/trunk/src/common/hashmap.hpp
incubator/mesos/trunk/src/common/hashset.hpp
incubator/mesos/trunk/src/common/option.hpp
incubator/mesos/trunk/src/common/result.hpp
incubator/mesos/trunk/src/common/units.hpp
incubator/mesos/trunk/src/common/uuid.hpp
incubator/mesos/trunk/src/common/zookeeper_candidate.cpp
incubator/mesos/trunk/src/common/zookeeper_candidate.hpp
incubator/mesos/trunk/src/messages/
incubator/mesos/trunk/src/messages/messages.hpp
incubator/mesos/trunk/src/messages/messages.proto
incubator/mesos/trunk/src/slave/reaper.cpp
incubator/mesos/trunk/src/slave/reaper.hpp
incubator/mesos/trunk/src/tests/configurator_tests.cpp
incubator/mesos/trunk/src/tests/external_tests.cpp
incubator/mesos/trunk/src/tests/fault_tolerant_tests.cpp
incubator/mesos/trunk/src/tests/lxc_isolation_tests.cpp
incubator/mesos/trunk/src/tests/master_tests.cpp
incubator/mesos/trunk/src/tests/multimap_tests.cpp
incubator/mesos/trunk/src/tests/resource_offer_reply_tests.cpp
incubator/mesos/trunk/src/tests/resource_offer_tests.cpp
incubator/mesos/trunk/src/tests/resources_tests.cpp
incubator/mesos/trunk/src/tests/sample_frameworks_tests.cpp
incubator/mesos/trunk/src/tests/string_utils_tests.cpp
incubator/mesos/trunk/src/tests/uuid_tests.cpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/io/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/io/detail/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/io/detail/quoted_manip.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/io/ios_state.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/io_fwd.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/memory_order.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/additive_combine.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/bernoulli_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/binomial_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/cauchy_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/auto_link.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/config.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/const_mod.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/disable_warnings.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/enable_warnings.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/iterator_mixin.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/pass_through_engine.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/ptr_helper.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/seed.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/signed_unsigned_tools.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/detail/uniform_int_float.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/discard_block.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/exponential_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/gamma_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/geometric_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/inversive_congruential.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lagged_fibonacci.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_congruential.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/linear_feedback_shift.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/lognormal_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/mersenne_twister.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/normal_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/poisson_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/random_number_generator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/ranlux.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/shuffle_output.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/subtract_with_carry.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/triangle_distribution.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_01.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_int.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_on_sphere.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_real.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/uniform_smallint.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/variate_generator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/random/xor_combine.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/shared_ptr.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/bad_weak_ptr.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count_gcc.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count_pthreads.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count_solaris.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count_sync.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/atomic_count_win32.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/lightweight_mutex.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/lwm_nop.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/lwm_pthreads.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/lwm_win32_cs.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/operator_bool.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/quick_allocator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/shared_array_nmt.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/shared_count.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/shared_ptr_nmt.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_convertible.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_nt.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_pt.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_solaris.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_spin.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_sync.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_base_w32.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_counted_impl.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/sp_has_sync.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock_nt.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock_pool.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock_pt.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock_sync.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/spinlock_w32.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/detail/yield_k.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/enable_shared_from_this.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/enable_shared_from_this2.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/intrusive_ptr.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/make_shared.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_array.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_ptr.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_array.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_ptr.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/weak_ptr.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/name_generator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/nil_generator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/random_generator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/seed_rng.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/sha1.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/string_generator.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid_generators.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid_io.hpp
incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid_serialize.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/dispatch.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/option.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/protobuf.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/timer.hpp
incubator/mesos/trunk/third_party/libprocess/src/timer.cpp
Removed:
incubator/mesos/trunk/ec2/deploy.karmic64/
incubator/mesos/trunk/ec2/deploy.solaris/
incubator/mesos/trunk/frameworks/torque/nexus-hpl/
incubator/mesos/trunk/src/java/src/mesos/
incubator/mesos/trunk/src/messaging/
incubator/mesos/trunk/src/tests/configurator_test.cpp
incubator/mesos/trunk/src/tests/external_test.cpp
incubator/mesos/trunk/src/tests/lxc_isolation_test.cpp
incubator/mesos/trunk/src/tests/master_test.cpp
incubator/mesos/trunk/src/tests/multimap_test.cpp
incubator/mesos/trunk/src/tests/offer_reply_errors_test.cpp
incubator/mesos/trunk/src/tests/resources_test.cpp
incubator/mesos/trunk/src/tests/sample_frameworks_test.cpp
incubator/mesos/trunk/src/tests/string_utils_test.cpp
incubator/mesos/trunk/src/webui/bottle-0.5.6/
incubator/mesos/trunk/third_party/gtest-1.5.0/
incubator/mesos/trunk/third_party/libprocess/examples/files/
incubator/mesos/trunk/third_party/libprocess/swig/
incubator/mesos/trunk/third_party/libprocess/tuples/
Modified:
incubator/mesos/trunk/.gitignore
incubator/mesos/trunk/LICENSE
incubator/mesos/trunk/Makefile.in
incubator/mesos/trunk/ec2/mesos_ec2.py
incubator/mesos/trunk/include/mesos/mesos.proto
incubator/mesos/trunk/src/Makefile.in
incubator/mesos/trunk/src/common/foreach.hpp
incubator/mesos/trunk/src/common/type_utils.hpp
incubator/mesos/trunk/src/common/utils.hpp
incubator/mesos/trunk/src/common/zookeeper.cpp
incubator/mesos/trunk/src/configurator/configurator.cpp
incubator/mesos/trunk/src/configurator/configurator.hpp
incubator/mesos/trunk/src/configurator/option.hpp
incubator/mesos/trunk/src/detector/detector.cpp
incubator/mesos/trunk/src/examples/cpp_test_executor.cpp
incubator/mesos/trunk/src/examples/java/TestExecutor.java
incubator/mesos/trunk/src/examples/long_lived_executor.cpp
incubator/mesos/trunk/src/examples/memhog_executor.cpp
incubator/mesos/trunk/src/examples/python/test_executor.py
incubator/mesos/trunk/src/exec/exec.cpp
incubator/mesos/trunk/src/launcher/launcher.cpp
incubator/mesos/trunk/src/launcher/launcher.hpp
incubator/mesos/trunk/src/launcher/main.cpp
incubator/mesos/trunk/src/local/local.cpp
incubator/mesos/trunk/src/master/allocator.hpp
incubator/mesos/trunk/src/master/main.cpp
incubator/mesos/trunk/src/master/master.cpp
incubator/mesos/trunk/src/master/master.hpp
incubator/mesos/trunk/src/master/simple_allocator.cpp
incubator/mesos/trunk/src/master/simple_allocator.hpp
incubator/mesos/trunk/src/master/slaves_manager.cpp
incubator/mesos/trunk/src/master/state.hpp
incubator/mesos/trunk/src/master/webui.cpp
incubator/mesos/trunk/src/sched/sched.cpp
incubator/mesos/trunk/src/slave/isolation_module.cpp
incubator/mesos/trunk/src/slave/isolation_module.hpp
incubator/mesos/trunk/src/slave/lxc_isolation_module.cpp
incubator/mesos/trunk/src/slave/lxc_isolation_module.hpp
incubator/mesos/trunk/src/slave/main.cpp
incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp
incubator/mesos/trunk/src/slave/process_based_isolation_module.hpp
incubator/mesos/trunk/src/slave/projd.cpp
incubator/mesos/trunk/src/slave/slave.cpp
incubator/mesos/trunk/src/slave/slave.hpp
incubator/mesos/trunk/src/slave/solaris_project_isolation_module.hpp
incubator/mesos/trunk/src/slave/state.hpp
incubator/mesos/trunk/src/slave/webui.cpp
incubator/mesos/trunk/src/tests/Makefile.in
incubator/mesos/trunk/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh
incubator/mesos/trunk/src/tests/main.cpp
incubator/mesos/trunk/src/tests/utils.cpp
incubator/mesos/trunk/src/tests/utils.hpp
incubator/mesos/trunk/src/webui/common/webui_lib.py
incubator/mesos/trunk/src/webui/master/index.tpl
incubator/mesos/trunk/src/webui/master/swig/master.i
incubator/mesos/trunk/third_party/libprocess/Makefile.in
incubator/mesos/trunk/third_party/libprocess/include/process/future.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/gc.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/http.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/latch.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/pid.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/process.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/promise.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/run.hpp
incubator/mesos/trunk/third_party/libprocess/include/process/tuples/tuples.hpp
incubator/mesos/trunk/third_party/libprocess/src/pid.cpp
incubator/mesos/trunk/third_party/libprocess/src/process.cpp
incubator/mesos/trunk/third_party/libprocess/src/tests.cpp
Modified: incubator/mesos/trunk/.gitignore
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/.gitignore?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/.gitignore (original)
+++ incubator/mesos/trunk/.gitignore Mon Jun 27 06:08:33 2011
@@ -1,52 +1,81 @@
-.*
!.gitignore
-*~
-config.cache
-tags
-autom4te.cache
-libtool
-Makefile
!frameworks/*/Makefile
+!src/config/config.hpp.in
*.a
-*.d
-*.o
-*.so
-*.lo
-*.la
-*.swp
*.aux
*.bbl
*.blg
-*.log
*.class
-*.pyc
+*.d
*.dSYM
*.dylib
+*.la
+*.lo
+*.log
+*.o
+*.pyc
+*.so
+*.swp
+*~
+.*
+Makefile
+autom4te.cache
+build/
+config.cache
config.log
config.status
-src/work
+include/mesos.hpp
+libtool
mesos_wrap.cpp
mesos_wrap.h
-bin/master
-bin/slaves
+src/alltests
+src/conf/mesos.conf
src/config/config.hpp
-!src/config/config.hpp.in
+src/cpp-test-executor
+src/cpp-test-framework
+src/java/generated/
+src/java/jni/mesos_MesosExecutorDriver.h
+src/java/jni/mesos_MesosSchedulerDriver.h
+src/logs
+src/memhog
+src/memhog-executor
+src/mesos-getconf
+src/mesos-launcher
+src/mesos-local
+src/mesos-master
+src/mesos-projd
+src/mesos-slave
+src/mesos.pb.cc
+src/mesos.pb.h
+src/messaging/messages.pb.cc
+src/messaging/messages.pb.h
+src/scheduled-memhog
+src/swig/java/mesos
src/swig/java/mesos.jar
+src/swig/python/mesos.py
+src/test-executor
+src/test-framework
+src/test_output
src/webui/master/swig/master.py
src/webui/master/swig/master_wrap.cpp
src/webui/master/swig/master_wrap.h
src/webui/slave/swig/slave.py
src/webui/slave/swig/slave_wrap.cpp
src/webui/slave/swig/slave_wrap.h
-third_party/glog-0.3.1/demangle_unittest
+src/work
+tags
+test_detail.xml
+test_output/
third_party/glog-0.3.1/configure
-third_party/glog-0.3.1/src/config.h.in
+third_party/glog-0.3.1/demangle_unittest
third_party/glog-0.3.1/libglog.pc
third_party/glog-0.3.1/logging_striptest0
third_party/glog-0.3.1/logging_striptest10
third_party/glog-0.3.1/logging_striptest2
third_party/glog-0.3.1/logging_unittest
third_party/glog-0.3.1/signalhandler_unittest
+third_party/glog-0.3.1/src/config.h
+third_party/glog-0.3.1/src/config.h.in
third_party/glog-0.3.1/src/glog/logging.h
third_party/glog-0.3.1/src/glog/raw_logging.h
third_party/glog-0.3.1/src/glog/stl_logging.h
@@ -56,34 +85,61 @@ third_party/glog-0.3.1/stacktrace_unitte
third_party/glog-0.3.1/stl_logging_unittest
third_party/glog-0.3.1/symbolize_unittest
third_party/glog-0.3.1/utilities_unittest
-third_party/libprocess/third_party/libev-3.8/stamp-h1
-third_party/glog-0.3.1/src/config.h
-third_party/gtest-1.5.0/configure
+third_party/gmock-1.5.0/build-aux/config.h
+third_party/gmock-1.5.0/build-aux/stamp-h1
+third_party/gmock-1.5.0/gtest/build-aux/config.h
+third_party/gmock-1.5.0/gtest/build-aux/stamp-h1
+third_party/gmock-1.5.0/gtest/scripts/gtest-config
+third_party/gmock-1.5.0/scripts/gmock-config
third_party/gtest-1.5.0/build-aux/config.h
third_party/gtest-1.5.0/build-aux/stamp-h1
+third_party/gtest-1.5.0/configure
third_party/gtest-1.5.0/scripts/gtest-config
third_party/libprocess/third_party/libev-3.8/config.h
+third_party/libprocess/third_party/libev-3.8/libev-3.8.tar.gz
+third_party/libprocess/third_party/libev-3.8/stamp-h1
+third_party/protobuf-2.3.0/Makefile.in
+third_party/protobuf-2.3.0/aclocal.m4
+third_party/protobuf-2.3.0/config.h
+third_party/protobuf-2.3.0/config.h.in
+third_party/protobuf-2.3.0/configure
+third_party/protobuf-2.3.0/gtest/build-aux/config.h
+third_party/protobuf-2.3.0/gtest/build-aux/stamp-h1
+third_party/protobuf-2.3.0/gtest/scripts/gtest-config
+third_party/protobuf-2.3.0/java/src/main/java/com/google/protobuf/DescriptorProtos.java
+third_party/protobuf-2.3.0/protobuf-lite.pc
+third_party/protobuf-2.3.0/protobuf.pc
+third_party/protobuf-2.3.0/python/google
+third_party/protobuf-2.3.0/src/Makefile.in
+third_party/protobuf-2.3.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_custom_options.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_custom_options.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_embed_optimize_for.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_embed_optimize_for.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_empty.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_empty.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_import.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_import.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_import_lite.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_import_lite.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_lite.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_lite.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_lite_imports_nonlite.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_lite_imports_nonlite.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_mset.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_mset.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_no_generic_services.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_no_generic_services.pb.h
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_optimize_for.pb.cc
+third_party/protobuf-2.3.0/src/google/protobuf/unittest_optimize_for.pb.h
+third_party/protobuf-2.3.0/src/protoc
+third_party/protobuf-2.3.0/src/unittest_proto_middleman
+third_party/protobuf-2.3.0/stamp-h1
third_party/zookeeper-3.3.1/src/c/cli_mt
third_party/zookeeper-3.3.1/src/c/cli_st
third_party/zookeeper-3.3.1/src/c/config.h
third_party/zookeeper-3.3.1/src/c/load_gen
third_party/zookeeper-3.3.1/src/c/stamp-h1
-src/alltests
-src/conf/mesos.conf
-src/cpp-test-executor
-src/cpp-test-framework
-src/logs
-src/mesos-local
-src/mesos-master
-src/mesos-slave
-src/mesos-projd
-src/mesos-launcher
-src/mesos-getconf
-src/memhog
-src/memhog-executor
-src/test-framework
-src/test-executor
-src/scheduled-memhog
-src/swig/java/mesos
-src/swig/python/mesos.py
-src/test_output
Modified: incubator/mesos/trunk/LICENSE
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/LICENSE?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/LICENSE (original)
+++ incubator/mesos/trunk/LICENSE Mon Jun 27 06:08:33 2011
@@ -1,202 +1,27 @@
+Copyright (c) 2010, Regents of the University of California.
+All rights reserved.
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the University of California, Berkeley nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Modified: incubator/mesos/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/Makefile.in?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/Makefile.in (original)
+++ incubator/mesos/trunk/Makefile.in Mon Jun 27 06:08:33 2011
@@ -14,11 +14,10 @@ MESOS_HOME = @prefix@/mesos
WITH_INCLUDED_ZOOKEEPER = @WITH_INCLUDED_ZOOKEEPER@
LIBPROCESS = third_party/libprocess
-
-ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
-
+PROTOBUF = third_party/protobuf-2.3.0
GLOG = third_party/glog-0.3.1
GMOCK = third_party/gmock-1.5.0
+ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
default: all
@@ -28,12 +27,14 @@ src: third_party
third_party:
$(MAKE) -C $(LIBPROCESS)
+ $(MAKE) -C $(PROTOBUF)
$(MAKE) -C $(GLOG)
$(MAKE) -C $(GMOCK)
ifeq ($(WITH_INCLUDED_ZOOKEEPER),1)
$(MAKE) -C $(ZOOKEEPER)
endif
+# TODO(benh): Install generated C++ header files.
install:
if test ! -d $(MESOS_HOME)/bin; \
then mkdir -p $(MESOS_HOME)/bin; \
@@ -80,8 +81,9 @@ dist:
$(error unimplemented)
distclean:
- $(MAKE) -C src clean
+ $(MAKE) -C src clean # TODO(benh): Support an internal distclean.
$(MAKE) -C $(LIBPROCESS) distclean
+ $(MAKE) -C $(PROTOBUF) distclean
$(MAKE) -C $(GLOG) distclean
$(MAKE) -C $(GMOCK) distclean
ifeq ($(WITH_INCLUDED_ZOOKEEPER),1)
@@ -115,6 +117,7 @@ all: src
clean:
$(MAKE) -C src clean
$(MAKE) -C $(LIBPROCESS) clean
+ $(MAKE) -C $(PROTOBUF) clean
$(MAKE) -C $(GLOG) clean
$(MAKE) -C $(GMOCK) clean
ifeq ($(WITH_INCLUDED_ZOOKEEPER),1)
Modified: incubator/mesos/trunk/ec2/mesos_ec2.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/ec2/mesos_ec2.py?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/ec2/mesos_ec2.py (original)
+++ incubator/mesos/trunk/ec2/mesos_ec2.py Mon Jun 27 06:08:33 2011
@@ -6,6 +6,7 @@ from __future__ import with_statement
import boto
import logging
import os
+import random
import shutil
import subprocess
import sys
@@ -36,7 +37,7 @@ def parse_args():
"WARNING: must be 64 bit, thus small instances won't work")
parser.add_option("-m", "--master-instance-type", default="",
help="Master instance type (leave empty for same as instance-type)")
- parser.add_option("-z", "--zone", default="us-east-1b",
+ parser.add_option("-z", "--zone", default="",
help="Availability zone to launch instances in")
parser.add_option("-a", "--ami", default="ami-fa4eb393",
help="Amazon Machine Image ID to use")
@@ -414,6 +415,10 @@ def main():
(opts, action, cluster_name) = parse_args()
conn = boto.connect_ec2()
+ # Select an AZ at random if it was not specified.
+ if opts.zone == "":
+ opts.zone = random.choice(conn.get_all_zones()).name
+
if action == "launch":
if opts.resume:
(master_nodes, slave_nodes, zoo_nodes) = get_existing_cluster(
Modified: incubator/mesos/trunk/include/mesos/mesos.proto
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/mesos/mesos.proto?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/include/mesos/mesos.proto (original)
+++ incubator/mesos/trunk/include/mesos/mesos.proto Mon Jun 27 06:08:33 2011
@@ -91,14 +91,6 @@ message ExecutorArgs {
};
-message StatusUpdate {
- required TaskID task_id = 1;
- required SlaveID slave_id = 2;
- required TaskState state = 3;
- optional bytes data = 4;
-}
-
-
message TaskDescription {
required string name = 1;
required TaskID task_id = 2;
@@ -121,9 +113,8 @@ enum TaskState {
message TaskStatus {
required TaskID task_id = 1;
- required SlaveID slave_id = 2;
- required TaskState state = 3;
- optional bytes data = 4;
+ required TaskState state = 2;
+ optional bytes data = 3;
}
Modified: incubator/mesos/trunk/src/Makefile.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/Makefile.in?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/Makefile.in (original)
+++ incubator/mesos/trunk/src/Makefile.in Mon Jun 27 06:08:33 2011
@@ -98,8 +98,9 @@ endif
MASTER_OBJ = master/master.o master/slaves_manager.o \
master/allocator_factory.o master/simple_allocator.o
-SLAVE_OBJ = slave/slave.o launcher/launcher.o slave/isolation_module.o \
- slave/process_based_isolation_module.o
+SLAVE_OBJ = slave/slave.o slave/isolation_module.o \
+ slave/process_based_isolation_module.o slave/reaper.o \
+ launcher/launcher.o
ifeq ($(OS_NAME),solaris)
SLAVE_OBJ += slave/solaris_project_isolation_module.o
@@ -109,7 +110,7 @@ ifeq ($(OS_NAME),linux)
SLAVE_OBJ += slave/lxc_isolation_module.o
endif
-PROTOBUF_OBJ = mesos.pb.o messaging/messages.pb.o
+PROTOBUF_OBJ = mesos.pb.o messages/messages.pb.o
MASTER_WEBUI_OBJ = master/webui.o
MASTER_SWIG_WEBUI_OBJ = webui/master/swig/master_wrap.o
@@ -123,8 +124,7 @@ SWIG_WEBUI_OBJ = $(MASTER_SWIG_WEBUI_OBJ
COMMON_OBJ = common/fatal.o common/lock.o detector/detector.o \
detector/url_processor.o configurator/configurator.o \
common/string_utils.o common/logging.o \
- common/date_utils.o common/tokenize.o common/resources.o \
- messaging/messages.o
+ common/date_utils.o common/tokenize.o common/resources.o
ifeq ($(WITH_ZOOKEEPER),1)
COMMON_OBJ += common/zookeeper.o
@@ -231,7 +231,7 @@ DEPLOY_FILES = $(DEPLOYDIR)/deploy-to-sl
# Create rules for building the directories that aren't created
# automagically by configure.
OBJ_DIRECTORIES = common configurator detector exec launcher local \
- master messaging sched slave
+ master messages sched slave
WEBUI_DIRECTORIES = $(BINDIR)/webui/common $(BINDIR)/webui/master \
$(BINDIR)/webui/slave $(BINDIR)/webui/static \
@@ -258,9 +258,9 @@ mesos.pb.cc: @top_srcdir@/include/mesos/
$(INCLUDEDIR)/mesos/mesos.hpp: mesos.pb.cc | $(INCLUDEDIR) $(INCLUDEDIR)/mesos
cp mesos.pb.h $(INCLUDEDIR)/mesos/mesos.hpp
-messaging/messages.pb.cc: $(SRCDIR)/messaging/messages.proto
- mkdir -p messaging
- $(PROTOC) -I$(SRCDIR)/messaging -I@top_srcdir@/include/mesos --cpp_out=messaging $(SRCDIR)/messaging/messages.proto
+messages/messages.pb.cc: $(SRCDIR)/messages/messages.proto
+ mkdir -p messages
+ $(PROTOC) -I$(SRCDIR)/messages -I@top_srcdir@/include/mesos --cpp_out=messages $(SRCDIR)/messages/messages.proto
common/build.o: $(SRCDIR)/common/build.cpp force | common
$(CXX) -c $(CXXFLAGS) -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\"" -DBUILD_USER="\"$$USER\"" -DBUILD_FLAGS="\"$(CFLAGS) $(CXXFLAGS)\"" -o $@ $<
Modified: incubator/mesos/trunk/src/common/foreach.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/foreach.hpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/foreach.hpp (original)
+++ incubator/mesos/trunk/src/common/foreach.hpp Mon Jun 27 06:08:33 2011
@@ -3,6 +3,9 @@
#include <boost/foreach.hpp>
+#include <boost/tuple/tuple.hpp>
+
+
#define BOOST_FOREACH_PAIR(VARFIRST, VARSECOND, COL) \
BOOST_FOREACH_PREAMBLE() \
if (boost::foreach_detail_::auto_any_t _foreach_col = BOOST_FOREACH_CONTAIN(COL)) {} else \
@@ -23,23 +26,10 @@
#define foreach BOOST_FOREACH
#define foreachpair BOOST_FOREACH_PAIR
-#include <boost/tuple/tuple.hpp>
-
-namespace foreach {
-
-const boost::tuples::detail::swallow_assign _ = boost::tuples::ignore;
-
-template <typename T> T copy(const T& t) { return t; }
-
-}
-
-
-#define foreachcopy(VAR, COL) \
- foreach (VAR, foreach::copy(COL))
-
-#define foreachpaircopy(VARFIRST, VARSECOND, COL) \
- foreachpair (VARFIRST, VARSECOND, foreach::copy(COL))
-
+#define foreachkey(VAR, COL) \
+ foreachpair (VAR, boost::tuples::ignore, COL)
+#define foreachvalue(VAR, COL) \
+ foreachpair (boost::tuples::ignore, VAR, COL)
-#endif /* FOREACH_HPP */
+#endif // __FOREACH_HPP__
Added: incubator/mesos/trunk/src/common/hashmap.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/hashmap.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/hashmap.hpp (added)
+++ incubator/mesos/trunk/src/common/hashmap.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,64 @@
+#ifndef __HASHMAP_HPP__
+#define __HASHMAP_HPP__
+
+#include <boost/get_pointer.hpp>
+#include <boost/unordered_map.hpp>
+
+#include "common/foreach.hpp"
+
+
+namespace mesos { namespace internal {
+
+// Provides a hash map via Boost's 'unordered_map'. For most intensive
+// purposes this could be accomplished with a templated typedef, but
+// those don't exist (until C++-0x). Also, doing it this way allows us
+// to add functionality, or better naming of existing functionality,
+// etc.
+
+template <typename Key, typename Value>
+class hashmap : public boost::unordered_map<Key, Value>
+{
+public:
+ // Checks whether this map contains a binding for a key.
+ bool contains(const Key& key) { return count(key) > 0; }
+
+ // Checks whether there exists a bound value in this map.
+ bool containsValue(const Value& v)
+ {
+ foreachvalue (const Value& value, *this) {
+ if (value == v) {
+ return true;
+ }
+ }
+ }
+
+ // Checks whether there exists a value in this map that returns the
+ // a result equal to 'r' when the specified method is invoked.
+ template <typename R, typename T>
+ bool existsValue(R (T::*method)(), R r)
+ {
+ foreachvalue (const Value& value, *this) {
+ const T* t = boost::get_pointer(value);
+ if (t->*method() == r) {
+ return true;
+ }
+ }
+ }
+
+ // Checks whether there exists a value in this map whose specified
+ // member is equal to 'r'.
+ template <typename R, typename T>
+ bool existsValue(R (T::*member), R r)
+ {
+ foreachvalue (const Value& value, *this) {
+ const T* t = boost::get_pointer(value);
+ if (t->*member == r) {
+ return true;
+ }
+ }
+ }
+};
+
+}} // namespace mesos { namespace internal {
+
+#endif // __HASHMAP_HPP__
Added: incubator/mesos/trunk/src/common/hashset.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/hashset.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/hashset.hpp (added)
+++ incubator/mesos/trunk/src/common/hashset.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,54 @@
+#ifndef __HASHSET_HPP__
+#define __HASHSET_HPP__
+
+#include <boost/get_pointer.hpp>
+#include <boost/unordered_set.hpp>
+
+#include "common/foreach.hpp"
+
+
+namespace mesos { namespace internal {
+
+// Provides a hash map via Boost's 'unordered_map'. For most intensive
+// purposes this could be accomplished with a templated typedef, but
+// those don't exist (until C++-0x). Also, doing it this way allows us
+// to add functionality, or better naming of existing functionality,
+// etc.
+
+template <typename Elem>
+class hashset : public boost::unordered_set<Elem>
+{
+public:
+ // Checks whether this map contains a binding for a key.
+ bool contains(const Elem& elem) { return count(elem) > 0; }
+
+ // Checks whether there exists a value in this set that returns the
+ // a result equal to 'r' when the specified method is invoked.
+ template <typename R, typename T>
+ bool exists(R (T::*method)(), R r)
+ {
+ foreach (const Elem& elem, *this) {
+ const T* t = boost::get_pointer(elem);
+ if (t->*method() == r) {
+ return true;
+ }
+ }
+ }
+
+ // Checks whether there exists an element in this set whose
+ // specified member is equal to 'r'.
+ template <typename R, typename T>
+ bool exists(R (T::*member), R r)
+ {
+ foreach (const Elem& elem, *this) {
+ const T* t = boost::get_pointer(elem);
+ if (t->*member == r) {
+ return true;
+ }
+ }
+ }
+};
+
+}} // namespace mesos { namespace internal {
+
+#endif // __HASHMAP_HPP__
Added: incubator/mesos/trunk/src/common/option.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/option.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/option.hpp (added)
+++ incubator/mesos/trunk/src/common/option.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,71 @@
+#ifndef __OPTION_HPP__
+#define __OPTION_HPP__
+
+template <typename T>
+class Option
+{
+public:
+ static Option<T> none()
+ {
+ return Option<T>(NONE);
+ }
+
+ static Option<T> some(const T& t)
+ {
+ return Option<T>(SOME, new T(t));
+ }
+
+ Option() : state(NONE), t(NULL) {}
+
+ Option(const T& _t) : state(SOME), t(new T(_t)) {}
+
+ Option(const Option<T>& that)
+ {
+ state = that.state;
+ if (that.t != NULL) {
+ t = new T(*that.t);
+ } else {
+ t = NULL;
+ }
+ }
+
+ ~Option()
+ {
+ if (t != NULL) {
+ delete t;
+ }
+ }
+
+ Option<T>& operator = (const Option<T>& that)
+ {
+ if (this != &that) {
+ state = that.state;
+ if (that.t != NULL) {
+ t = new T(*that.t);
+ } else {
+ t = NULL;
+ }
+ }
+
+ return *this;
+ }
+
+ bool isSome() const { return state == SOME; }
+ bool isNone() const { return state == NONE; }
+
+ T get() const { assert(state == SOME); return *t; }
+
+private:
+ enum State {
+ SOME,
+ NONE,
+ };
+
+ Option(State _state, T* _t = NULL)
+ : state(_state), t(_t) {}
+
+ State state;
+ T* t;
+};
+
+#endif // __OPTION_HPP__
Added: incubator/mesos/trunk/src/common/result.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/result.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/result.hpp (added)
+++ incubator/mesos/trunk/src/common/result.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,84 @@
+#ifndef __RESULT_HPP__
+#define __RESULT_HPP__
+
+#include <assert.h>
+
+#include <string>
+
+
+template <typename T>
+class Result
+{
+public:
+ static Result<T> none()
+ {
+ return Result<T>(NONE);
+ }
+
+ static Result<T> some(const T& t)
+ {
+ return Result<T>(SOME, new T(t));
+ }
+
+ static Result<T> error(const std::string& message)
+ {
+ return Result<T>(ERROR, NULL, message);
+ }
+
+ Result(const Result<T>& that)
+ {
+ state = that.state;
+ if (that.t != NULL) {
+ t = new T(*that.t);
+ } else {
+ t = NULL;
+ }
+ message = that.message;
+ }
+
+ virtual ~Result()
+ {
+ if (t != NULL) {
+ delete t;
+ }
+ }
+
+ Result<T>& operator = (const Result<T>& that)
+ {
+ if (this != &that) {
+ state = that.state;
+ if (that.t != NULL) {
+ t = new T(*that.t);
+ } else {
+ t = NULL;
+ }
+ message = that.message;
+ }
+
+ return *this;
+ }
+
+ bool isSome() { return state == SOME; }
+ bool isNone() { return state == NONE; }
+ bool isError() { return state == ERROR; }
+
+ T get() { assert(state == SOME); return *t; }
+
+ std::string error() { return message; }
+
+ enum State {
+ SOME,
+ NONE,
+ ERROR
+ };
+
+private:
+ Result(State _state, T* _t = NULL, const std::string& _message = "")
+ : state(_state), t(_t), message(_message) {}
+
+ State state;
+ T* t;
+ std::string message;
+};
+
+#endif // __RESULT_HPP__
Modified: incubator/mesos/trunk/src/common/type_utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/type_utils.hpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/type_utils.hpp (original)
+++ incubator/mesos/trunk/src/common/type_utils.hpp Mon Jun 27 06:08:33 2011
@@ -1,16 +1,13 @@
#ifndef __TYPE_UTILS_HPP__
#define __TYPE_UTILS_HPP__
+#include <google/protobuf/descriptor.h>
+
#include <mesos/mesos.hpp>
#include <boost/functional/hash.hpp>
-#include "messaging/messages.pb.h"
-
-
-// Some memory unit constants.
-const int32_t Megabyte = 1;
-const int32_t Gigabyte = 1024 * Megabyte;
+#include "messages/messages.hpp"
namespace mesos {
@@ -50,6 +47,14 @@ inline std::ostream& operator << (std::o
}
+inline std::ostream& operator << (std::ostream& stream, const TaskState& state)
+{
+ stream << TaskState_descriptor()->FindValueByNumber(state)->name();
+ return stream;
+}
+
+
+
inline bool operator == (const FrameworkID& left, const FrameworkID& right)
{
return left.value() == right.value();
Added: incubator/mesos/trunk/src/common/units.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/units.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/units.hpp (added)
+++ incubator/mesos/trunk/src/common/units.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,10 @@
+#ifndef __UNITS_HPP__
+#define __UNITS_HPP__
+
+// const int32_t Byte = 1;
+// const int32_t Kilobyte = 1024 * Byte;
+// const int32_t Megabyte = 1024 * Kilobyte;
+const int32_t Megabyte = 1;
+const int32_t Gigabyte = 1024 * Megabyte;
+
+#endif // __UNITS_HPP__
Modified: incubator/mesos/trunk/src/common/utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/utils.hpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/utils.hpp (original)
+++ incubator/mesos/trunk/src/common/utils.hpp Mon Jun 27 06:08:33 2011
@@ -1,19 +1,265 @@
#ifndef __UTILS_HPP__
#define __UTILS_HPP__
+#include <errno.h>
+#include <dirent.h>
+#include <libgen.h>
+#include <limits.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <stddef.h>
#include <unistd.h>
+#include <google/protobuf/message.h>
-// Useful common macros.
-#define VA_NUM_ARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N
-#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1)
+#include <glog/logging.h>
-#define CONCAT_IMPL(A, B) A ## B
-#define CONCAT(A, B) CONCAT_IMPL(A, B)
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <google/protobuf/io/zero_copy_stream_impl.h>
+
+#include <list>
+
+#include <boost/lexical_cast.hpp>
+
+#include "common/foreach.hpp"
+#include "common/result.hpp"
+#include "common/tokenize.hpp"
+
+#ifdef __APPLE__
+#define gethostbyname2_r(name, af, ret, buf, buflen, result, h_errnop) \
+ ({ *(result) = gethostbyname2(name, af); 0; })
+#endif // __APPLE__
namespace mesos { namespace internal { namespace utils {
+template <typename T>
+T copy(const T& t) { return t; }
+
+
+template <typename T>
+std::string stringify(T t)
+{
+ try {
+ return boost::lexical_cast<std::string>(t);
+ } catch (const boost::bad_lexical_cast&) {
+ LOG(FATAL) << "Failed to stringify!";
+ }
+}
+
+namespace protobuf {
+
+// Write out the given protobuf to the specified file descriptor by
+// first writing out the length of the protobuf followed by the
+// contents.
+inline bool write(int fd, const google::protobuf::Message& message)
+{
+ if (!message.IsInitialized()) {
+ LOG(ERROR) << "Failed to write protocol buffer to file, "
+ << "protocol buffer is not initialized!";
+ return false;
+ }
+
+ uint32_t size = message.ByteSize();
+
+ ssize_t length = ::write(fd, (void*) &size, sizeof(size));
+
+ if (length != sizeof(size)) {
+ PLOG(ERROR) << "Failed to write protocol buffer to file, write";
+ return false;
+ }
+
+ return message.SerializeToFileDescriptor(fd);
+}
+
+
+// Read the next protobuf from the file by first reading the "size"
+// followed by the contents (as written by 'write' above).
+inline bool read(int fd, google::protobuf::Message* message)
+{
+ if (message == NULL) {
+ return false;
+ }
+
+ // Save the offset so we can re-adjust if something goes wrong.
+ off_t offset = lseek(fd, 0, SEEK_CUR);
+
+ if (offset < 0) {
+ return false;
+ }
+
+ uint32_t size;
+ ssize_t length = ::read(fd, (void*) &size, sizeof(size));
+
+ if (length != sizeof(size)) {
+ PLOG(ERROR) << "Failed to read protocol buffer from file, read";
+
+ // Return the file position.
+
+ lseek(fd, offset, SEEK_SET);
+ return false;
+ }
+
+ char* temp = new char[size];
+
+ length = ::read(fd, temp, size);
+
+ if (length != size) {
+ PLOG(ERROR) << "Failed to read protocol buffer from file, read";
+
+ // Return the file position.
+ lseek(fd, offset, SEEK_SET);
+
+ return false;
+ }
+
+ google::protobuf::io::ArrayInputStream stream(temp, length);
+ bool result = message->ParseFromZeroCopyStream(&stream);
+
+ delete[] temp;
+
+ return result;
+}
+
+} // namespace protobuf {
+
+
+namespace os {
+
+// Checks if the specified key is in the environment variables.
+inline bool hasenv(const std::string& key)
+{
+ char* value = ::getenv(key.c_str());
+
+ return value != NULL;
+}
+
+// Looks in the environment variables for the specified key and
+// returns a string representation of it's value. If 'expected' is
+// true (default) and no environment variable matching key is found,
+// this function will exit the process.
+inline std::string getenv(const std::string& key, bool expected = true)
+{
+ char* value = ::getenv(key.c_str());
+
+ if (expected && value == NULL) {
+ LOG(FATAL) << "Expecting '" << key << "' in environment variables";
+ }
+
+ return std::string(value);
+}
+
+
+// Sets the value associated with the specfied key in the set of
+// environment variables.
+inline void setenv(const std::string& key,
+ const std::string& value,
+ bool overwrite = true)
+{
+ ::setenv(key.c_str(), value.c_str(), overwrite ? 1 : 0);
+}
+
+
+// Unsets the value associated with the specfied key in the set of
+// environment variables.
+inline void unsetenv(const std::string& key)
+{
+ ::unsetenv(key.c_str());
+}
+
+
+inline std::string basename(const std::string& path)
+{
+ return ::basename(const_cast<char*>(path.c_str()));
+}
+
+
+inline bool mkdir(const std::string& directory)
+{
+ try {
+ std::vector<std::string> tokens = tokenize::split(directory, "/");
+
+ std::string path = "";
+
+ // We got an absolute path, so keep the leading slash.
+ if (directory.find_first_of("/") == 0) {
+ path = "/";
+ }
+
+ foreach (const std::string& token, tokens) {
+ path += token;
+ if (::mkdir(path.c_str(), 0755) < 0 && errno != EEXIST) {
+ PLOG(ERROR) << "Failed to make directory, mkdir";
+ return false;
+ }
+ path += "/";
+ }
+ } catch (...) {
+ return false;
+ }
+
+ return true;
+}
+
+
+// Changes the specified file's user and group ownership to that of
+// the specified user..
+inline bool chown(const std::string& user, const std::string& file)
+{
+ struct passwd* passwd;
+ if ((passwd = ::getpwnam(user.c_str())) == NULL) {
+ PLOG(ERROR) << "Failed to get user information for '"
+ << user
+ << "', getpwnam";
+ return false;
+ }
+
+ if (::chown(file.c_str(), passwd->pw_uid, passwd->pw_gid) < 0) {
+ PLOG(ERROR) << "Failed to change file user and group ownership, chown";
+ return false;
+ }
+
+ return true;
+}
+
+
+inline bool chdir(const std::string& directory)
+{
+ if (chdir(directory.c_str()) < 0) {
+ PLOG(ERROR) << "Failed to change directory, chdir";
+ return false;
+ }
+
+ return true;
+}
+
+
+inline bool su(const std::string& user)
+{
+ struct passwd* passwd;
+ if ((passwd = ::getpwnam(user.c_str())) == NULL) {
+ PLOG(ERROR) << "Failed to get user information for '"
+ << user
+ << "', getpwnam";
+ return false;
+ }
+
+ if (::setgid(passwd->pw_gid) < 0) {
+ PLOG(ERROR) << "Failed to set group id, setgid";
+ return false;
+ }
+
+ if (::setuid(passwd->pw_uid) < 0) {
+ PLOG(ERROR) << "Failed to set user id, setuid";
+ return false;
+ }
+
+ return true;
+}
+
+
inline std::string getcwd()
{
size_t size = 100;
@@ -36,6 +282,98 @@ inline std::string getcwd()
return std::string();
}
+
+inline std::list<std::string> listdir(const std::string& directory)
+{
+ std::list<std::string> result;
+
+ DIR* dir = opendir(directory.c_str());
+
+ if (dir == NULL) {
+ return std::list<std::string>();
+ }
+
+ // Calculate the size for a "directory entry".
+ long name_max = fpathconf(dirfd(dir), _PC_NAME_MAX);
+
+ // If we don't get a valid size, check NAME_MAX, but fall back on
+ // 255 in the worst case ... Danger, Will Robinson!
+ if (name_max == -1) {
+ name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
+ }
+
+ size_t name_end =
+ (size_t) offsetof(dirent, d_name) + name_max + 1;
+
+ size_t size = (name_end > sizeof(dirent)
+ ? name_end
+ : sizeof(dirent));
+
+ dirent* temp = (dirent*) malloc(size);
+
+ if (temp == NULL) {
+ free(temp);
+ closedir(dir);
+ return std::list<std::string>();
+ }
+
+ struct dirent* entry;
+
+ int error;
+
+ while ((error = readdir_r(dir, temp, &entry)) == 0 && entry != NULL) {
+ result.push_back(entry->d_name);
+ }
+
+ free(temp);
+ closedir(dir);
+
+ if (error != 0) {
+ return std::list<std::string>();
+ }
+
+ return result;
+}
+
+
+inline Result<std::string> hostname()
+{
+ char host[512];
+
+ if (gethostname(host, sizeof(host)) < 0) {
+ return Result<std::string>::error(strerror(errno));
+ }
+
+ struct hostent he, *hep;
+ char* temp;
+ size_t length;
+ int result;
+ int herrno;
+
+ // Allocate temporary buffer for gethostbyname2_r.
+ length = 1024;
+ temp = new char[length];
+
+ while ((result = gethostbyname2_r(host, AF_INET, &he, temp,
+ length, &hep, &herrno)) == ERANGE) {
+ // Enlarge the buffer.
+ delete[] temp;
+ length *= 2;
+ temp = new char[length];
+ }
+
+ if (result != 0 || hep == NULL) {
+ delete[] temp;
+ return Result<std::string>::error(hstrerror(herrno));
+ }
+
+ std::string hostname = hep->h_name;
+ delete[] temp;
+ return Result<std::string>::some(hostname);
+}
+
+} // namespace os {
+
}}} // namespace mesos { namespace internal { namespace utils {
#endif // __UTILS_HPP__
Added: incubator/mesos/trunk/src/common/uuid.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/uuid.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/uuid.hpp (added)
+++ incubator/mesos/trunk/src/common/uuid.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,54 @@
+#include <assert.h>
+
+#include <sstream>
+#include <string>
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/uuid/uuid_generators.hpp>
+
+
+namespace mesos { namespace internal {
+
+struct UUID : boost::uuids::uuid
+{
+public:
+ static UUID random()
+ {
+ return UUID(boost::uuids::random_generator()());
+ }
+
+ static UUID fromBytes(const std::string& s)
+ {
+ boost::uuids::uuid uuid;
+ memcpy(&uuid, s.data(), s.size());
+ return UUID(uuid);
+ }
+
+ static UUID fromString(const std::string& s)
+ {
+ boost::uuids::uuid uuid;
+ std::istringstream in(s);
+ in >> uuid;
+ return UUID(uuid);
+ }
+
+ std::string toBytes() const
+ {
+ assert(sizeof(data) == size());
+ return std::string(reinterpret_cast<const char*>(data), sizeof(data));
+ }
+
+ std::string toString() const
+ {
+ std::ostringstream out;
+ out << *this;
+ return out.str();
+ }
+
+private:
+ explicit UUID(const boost::uuids::uuid& uuid)
+ : boost::uuids::uuid(uuid) {}
+};
+
+}} // namespace mesos { namespace internal {
Modified: incubator/mesos/trunk/src/common/zookeeper.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/zookeeper.cpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/zookeeper.cpp (original)
+++ incubator/mesos/trunk/src/common/zookeeper.cpp Mon Jun 27 06:08:33 2011
@@ -5,12 +5,16 @@
#include <boost/tuple/tuple.hpp>
+#include <process/dispatch.hpp>
#include <process/process.hpp>
#include "zookeeper.hpp"
#include "common/fatal.hpp"
+// DO NOT REMOVE! Removing this will require also changing which
+// ZooKeeper library get's used for linking, right now the Makefile is
+// assuming the multithreaded library will get used ...
#define USE_THREADED_ZOOKEEPER
using boost::cref;
@@ -527,7 +531,7 @@ int ZooKeeper::create(const string& path
cref(path), cref(data), cref(acl), flags, result);
#else
Promise<int> promise = impl->create(path, data, acl, flags, result);
- return Future<int>(&promise).get();
+ return promise.future().get();
#endif // USE_THREADED_ZOOKEEPER
}
@@ -539,7 +543,7 @@ int ZooKeeper::remove(const string& path
cref(path), version);
#else
Promise<int> promise = impl->remove(path, version);
- return Future<int>(&promise).get();
+ return promise.future().get();
#endif // USE_THREADED_ZOOKEEPER
}
@@ -551,7 +555,7 @@ int ZooKeeper::exists(const string& path
cref(path), watch, stat);
#else
Promise<int> promise = impl->exists(path, watch, stat);
- return Future<int>(&promise).get();
+ return promise.future().get();
#endif // USE_THREADED_ZOOKEEPER
}
@@ -563,7 +567,7 @@ int ZooKeeper::get(const string& path, b
cref(path), watch, result, stat);
#else
Promise<int> promise = impl->get(path, watch, result, stat);
- return Future<int>(&promise).get();
+ return promise.future().get();
#endif // USE_THREADED_ZOOKEEPER
}
@@ -576,7 +580,7 @@ int ZooKeeper::getChildren(const string&
cref(path), watch, results);
#else
Promise<int> promise = impl->getChildren(path, watch, results);
- return Future<int>(&promise).get();
+ return promise.future().get();
#endif // USE_THREADED_ZOOKEEPER
}
@@ -588,7 +592,7 @@ int ZooKeeper::set(const string& path, c
cref(path), cref(data), version);
#else
Promise<int> promise = impl->set(path, data, version);
- return Future<int>(&promise).get();
+ return promise.future().get();
#endif // USE_THREADED_ZOOKEEPER
}
Added: incubator/mesos/trunk/src/common/zookeeper_candidate.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/zookeeper_candidate.cpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/zookeeper_candidate.cpp (added)
+++ incubator/mesos/trunk/src/common/zookeeper_candidate.cpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,404 @@
+#include <functional>
+#include <list>
+#include <queue>
+#include <vector>
+
+#include <boost/lexical_cast.hpp>
+
+#include <process/dispatch.hpp>
+
+#include "fatal.hpp"
+#include "utils.hpp"
+#include "zookeeper.hpp"
+#include "zookeeper_candidate.hpp"
+
+using std::list;
+using std::make_pair;
+using std::pair;
+using std::queue;
+using std::string;
+using std::vector;
+
+
+namespace mesos { namespace internal { namespace zookeeper {
+
+class ElectionProcess : public Process<ElectionProcess>
+{
+public:
+ ElectionProcess(Election* _election,
+ const string& _servers,
+ const string& _znode);
+
+ virtual ~ElectionProcess();
+
+ // Election method implementations.
+ void submit(const PID<Candidate>& candidate, const string& data);
+ void resign(const PID<Candidate>& candidate);
+
+ // ZooKeeper events. TODO(*): Use a ZooKeeper listener?
+ void connected();
+ void reconnecting();
+ void reconnected();
+ void expired();
+ void updated(const string& path);
+
+private:
+ // Runs an election.
+ void elect();
+
+ // Helpers for registering candidates in ZooKeeper.
+ void registerCandidate(const PID<Candidate>& candidate, const string& data);
+ void registerCandidates();
+
+ // Pointer to election.
+ Election* election;
+
+ // ZooKeeper bits and pieces.
+ bool ready;
+ string servers;
+ string znode;
+ ZooKeeper* zk;
+ Watcher* watcher;
+
+ // Information about each of the candidates.
+ struct CandidateInfo
+ {
+ PID<Candidate> pid;
+ string data;
+ uint64_t id;
+ bool elected;
+ };
+
+ // Submitted but not registered candiates.
+ queue<pair<PID<Candidate>, string> > queue;
+
+ // Registered candidate information.
+ list<CandidateInfo*> infos;
+};
+
+
+// A watcher that just forwards ZooKeeper events to election.
+class ElectionProcessWatcher : public Watcher
+{
+public:
+ ElectionProcessWatcher(const PID<ElectionProcess>& _pid)
+ : pid(_pid), reconnect(false) {}
+
+ virtual ~ElectionProcessWatcher() {}
+
+ virtual void process(ZooKeeper* zk, int type, int state, const string& path)
+ {
+ if ((state == ZOO_CONNECTED_STATE) && (type == ZOO_SESSION_EVENT)) {
+ // Check if this is a reconnect.
+ if (!reconnect) {
+ // Initial connect.
+ dispatch(pid, &ElectionProcess::connected);
+ } else {
+ // Reconnected.
+ dispatch(pid, &ElectionProcess::reconnected);
+ }
+ } else if ((state == ZOO_CONNECTING_STATE) &&
+ (type == ZOO_SESSION_EVENT)) {
+ // The client library automatically reconnects, taking into
+ // account failed servers in the connection string,
+ // appropriately handling the "herd effect", etc.
+ reconnect = true;
+ dispatch(pid, &ElectionProcess::reconnecting);
+ } else if ((state == ZOO_EXPIRED_SESSION_STATE) &&
+ (type == ZOO_SESSION_EVENT)) {
+ dispatch(pid, &ElectionProcess::expired);
+
+ // If this watcher is reused, the next connect won't be a reconnect.
+ reconnect = false;
+ } else if ((state == ZOO_CONNECTED_STATE) && (type == ZOO_CHILD_EVENT)) {
+ dispatch(pid, &ElectionProcess::updated, path);
+ } else if ((state == ZOO_CONNECTED_STATE) && (type == ZOO_CHANGED_EVENT)) {
+ dispatch(pid, &ElectionProcess::updated, path);
+ } else {
+ LOG(FATAL) << "Unimplemented ZooKeeper event: (state is "
+ << state << " and type is " << type << ")";
+ }
+ }
+
+private:
+ const PID<ElectionProcess> pid;
+ bool reconnect;
+};
+
+
+ElectionProcess::ElectionProcess(Election* _election,
+ const string& _servers,
+ const string& _znode)
+ : election(_election), servers(_servers), znode(_znode)
+{
+ // TODO(benh): Real testing requires injecting a ZooKeeper instance.
+ watcher = new ElectionProcessWatcher(self());
+ zk = new ZooKeeper(servers, 10000, watcher);
+}
+
+
+ElectionProcess::~ElectionProcess()
+{
+ delete zk;
+ delete watcher;
+
+ foreach (CandidateInfo* info, infos) {
+ delete info;
+ }
+
+ infos.clear();
+}
+
+
+void ElectionProcess::submit(
+ const PID<Candidate>& candidate,
+ const string& data)
+{
+ if (!ready) {
+ queue.push(make_pair(candidate, data));
+ } else {
+ registerCandidate(candidate, data);
+ }
+}
+
+
+void ElectionProcess::resign(const PID<Candidate>& candidate)
+{
+ // TODO(jsirois): Implement me!
+ LOG(FATAL) << "unimplemented";
+}
+
+
+void ElectionProcess::connected()
+{
+ LOG(INFO) << "Election connected to ZooKeeper";
+
+ int ret;
+ string result;
+
+ // Assume the znode that was created does not end with a "/".
+ CHECK(znode.size() == 0 || znode.at(znode.size() - 1) != '/');
+
+ // Create directory path znodes as necessary.
+ size_t index = znode.find("/", 0);
+
+ while (index < string::npos) {
+ // Get out the prefix to create.
+ index = znode.find("/", index + 1);
+ string prefix = znode.substr(0, index);
+
+ LOG(INFO) << "Election trying to create znode '"
+ << prefix << "' in ZooKeeper";
+
+ // Create the node (even if it already exists).
+ ret = zk->create(prefix, "", ZOO_OPEN_ACL_UNSAFE,
+ // ZOO_CREATOR_ALL_ACL, // needs authentication
+ 0, &result);
+
+ if (ret != ZOK && ret != ZNODEEXISTS) {
+ LOG(FATAL) << "Failed to create '" << prefix
+ << "' in ZooKeeper: " << zk->error(ret);
+ }
+ }
+
+ // Signal that ZooKeeper is ready for use.
+ ready = true;
+
+ // Check if there are any submitted candidates that need to get
+ // created in ZooKeeper.
+ registerCandidates();
+
+ // Run an initial election!
+ elect();
+}
+
+
+void ElectionProcess::reconnecting()
+{
+ // TODO(jsirois): Implement me!
+ LOG(FATAL) << "unimplemented";
+}
+
+
+void ElectionProcess::reconnected()
+{
+ // TODO(jsirois): Implement me!
+ LOG(FATAL) << "unimplemented";
+}
+
+
+void ElectionProcess::expired()
+{
+ // TODO(jsirois): Implement me!
+ LOG(FATAL) << "unimplemented";
+}
+
+
+void ElectionProcess::updated(const string& path)
+{
+ CHECK(znode == path);
+ elect();
+}
+
+
+void ElectionProcess::elect()
+{
+ // Determine which replica is the master/coordinator.
+ vector<string> results;
+
+ int ret = zk->getChildren(znode, true, &results);
+
+ if (ret != ZOK) {
+ LOG(FATAL) << "Failed to get children of '" << znode
+ << "' in ZooKeeper: " << zk->error(ret);
+ }
+
+ // "Elect" the minimum ephemeral znode.
+ uint64_t id = LONG_MAX;
+ foreach (const string& result, results) {
+ try {
+ id = std::min(id, boost::lexical_cast<uint64_t>(result));
+ } catch (boost::bad_lexical_cast&) {
+ LOG(FATAL) << "Failed to convert '" << result << "' into an integer";
+ }
+ }
+
+ foreach (CandidateInfo* info, infos) {
+ if (info->id == id) {
+ info->elected = true;
+ dispatch(info->pid, &Candidate::onElected, election);
+ } else if (info->elected) {
+ dispatch(info->pid, &Candidate::onDefeated);
+ }
+ }
+
+ // (Re)set a watch on the znode.
+ ret = zk->getChildren(znode, true, NULL);
+
+ if (ret != ZOK) {
+ LOG(FATAL) << "Failed to set a watch on '" << znode
+ << "' in ZooKeeper: " << zk->error(ret);
+ }
+}
+
+
+void ElectionProcess::registerCandidate(
+ const PID<Candidate>& candidate,
+ const string& data)
+{
+ int ret;
+ string result;
+
+ // Create a new ephemeral znode for this candidate and populate it
+ // with the pid for this process.
+ ret = zk->create(znode + "/", data, ZOO_OPEN_ACL_UNSAFE,
+ // ZOO_CREATOR_ALL_ACL, // needs authentication
+ ZOO_SEQUENCE | ZOO_EPHEMERAL, &result);
+
+ if (ret != ZOK) {
+ LOG(FATAL) << "Failed to create an ephmeral node at '"
+ << znode << "' in ZooKeeper: " << zk->error(ret);
+ }
+
+ // Save the sequence id but only grab the basename, e.g.,
+ // "/path/to/znode/000000131" => "000000131".
+ result = utils::os::basename(result);
+
+ uint64_t id;
+
+ try {
+ id = boost::lexical_cast<uint64_t>(result);
+ } catch (boost::bad_lexical_cast&) {
+ LOG(FATAL) << "Failed to convert '" << result << "' into an integer";
+ }
+
+ CandidateInfo* info = new CandidateInfo();
+ info->pid = candidate;
+ info->data = data;
+ info->id = id;
+ info->elected = false;
+
+ infos.push_back(info);
+}
+
+
+void ElectionProcess::registerCandidates()
+{
+ while (!queue.empty()) {
+ const pair<PID<Candidate>, string>& pair = queue.front();
+ registerCandidate(pair.first, pair.second);
+ queue.pop();
+ }
+}
+
+
+Election::Election(const string& servers, const string& znode)
+{
+ process = new ElectionProcess(this, servers, znode);
+ spawn(process);
+}
+
+
+Election::~Election()
+{
+ terminate(process);
+ wait(process);
+ delete process;
+}
+
+
+void Election::submit(const PID<Candidate>& candidate, const string& data)
+{
+ dispatch(process, &ElectionProcess::submit, candidate, data);
+}
+
+
+void Election::resign(const PID<Candidate>& candidate)
+{
+ dispatch(process, &ElectionProcess::resign, candidate);
+}
+
+}}} // namespace mesos { namespace internal { namespace zookeeper {
+
+
+using namespace process;
+
+using mesos::internal::zookeeper::Candidate;
+using mesos::internal::zookeeper::Election;
+
+
+class TestCandidate : public Candidate
+{
+public:
+ virtual void onElected(Election* election)
+ {
+ std::cout << "TestCandidate::onElected" << std::endl;
+ }
+
+ virtual void onDefeated()
+ {
+ std::cout << "TestCandidate::onDefeated" << std::endl;
+ }
+};
+
+
+int main(int argc, char** argv)
+{
+ if (argc != 3) {
+ fatal("usage: %s <servers> <znode>", argv[0]);
+ }
+
+ string servers = argv[1];
+ string znode = argv[2];
+
+ Election election(servers, znode);
+
+ TestCandidate candidate;
+ spawn(&candidate);
+
+ election.submit(candidate, "test");
+
+ wait(candidate);
+
+ return 0;
+}
Added: incubator/mesos/trunk/src/common/zookeeper_candidate.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/zookeeper_candidate.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/zookeeper_candidate.hpp (added)
+++ incubator/mesos/trunk/src/common/zookeeper_candidate.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,50 @@
+#include <process/process.hpp>
+
+
+namespace mesos { namespace internal { namespace zookeeper {
+
+using namespace process;
+
+class Election;
+class ElectionProcess;
+
+
+// Interface definition for becoming a ZooKeeper-based group leader.
+class Candidate : public Process<Candidate>
+{
+public:
+ // Called when this leader has been elected.
+ virtual void onElected(Election* election) = 0;
+
+ // Called when the leader has been ousted. Can occur either if the
+ // leader abdicates or if an external event causes the leader to
+ // lose its leadership role (session expiration).
+ virtual void onDefeated() = 0;
+};
+
+
+// Performs leader election for a set of candidates using ZooKeeper.
+class Election
+{
+public:
+ Election(const std::string& servers, const std::string& znode);
+ ~Election();
+
+ // Submit candidate for election.
+ void submit(const PID<Candidate>& candidate, const std::string& data);
+
+ // Relinquish current leadership (if leader), then re-run election
+ // (possibly being re-elected).
+ void resign(const PID<Candidate>& candidate);
+
+private:
+ // Not copyable or assignable.
+ Election(const Election& that);
+ Election& operator = (const Election& that);
+
+ // Underlying process that interacts with ZooKeeper, performs
+ // elections, etc.
+ ElectionProcess* process;
+};
+
+}}} // namespace mesos { namespace internal { namespace zookeeper {
Modified: incubator/mesos/trunk/src/configurator/configurator.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/configurator/configurator.cpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/configurator/configurator.cpp (original)
+++ incubator/mesos/trunk/src/configurator/configurator.cpp Mon Jun 27 06:08:33 2011
@@ -15,8 +15,6 @@
using namespace mesos::internal;
-using foreach::_;
-
using std::ifstream;
using std::map;
using std::string;
@@ -57,7 +55,7 @@ Configurator::Configurator()
void Configurator::validate()
{
- foreachpair (const string& key, const Option& opt, options) {
+ foreachpair (const string& key, const ConfigOption& opt, options) {
if (conf.contains(key) && opt.validator &&
!opt.validator->isValid(conf[key])) {
string msg = "Invalid value for '" + key + "' option: " + conf[key];
@@ -302,12 +300,12 @@ string Configurator::getUsage() const
{
const int PAD = 5;
string usage;
-
+
map<string,string> col1; // key -> col 1 string
int maxLen = 0;
// construct string for the first column and get size of column
- foreachpair (const string& key, const Option& opt, options) {
+ foreachpair (const string& key, const ConfigOption& opt, options) {
string val;
if (opt.validator->isBool())
val = " --[no-]" + key;
@@ -320,12 +318,12 @@ string Configurator::getUsage() const
else
val += string(" (or -") + opt.shortName + " VAL)";
}
-
+
col1[key] = val;
maxLen = val.size() > maxLen ? val.size() : maxLen;
}
- foreachpair (const string& key, const Option& opt, options) {
+ foreachpair (const string& key, const ConfigOption& opt, options) {
string helpStr = opt.helpString;
string line = col1[key];
@@ -363,11 +361,11 @@ string Configurator::getUsage() const
}
return usage;
}
-
+
void Configurator::loadDefaults()
{
- foreachpair (const string& key, const Option& option, options) {
+ foreachpair (const string& key, const ConfigOption& option, options) {
if (option.hasDefault && !conf.contains(key)) {
conf[key] = option.defaultValue;
}
@@ -378,7 +376,7 @@ void Configurator::loadDefaults()
vector<string> Configurator::getOptions() const
{
vector<string> ret;
- foreachpair (const string& key, _, options) {
+ foreachkey (const string& key, options) {
ret.push_back(key);
}
return ret;
@@ -392,7 +390,7 @@ Configuration& Configurator::getConfigur
string Configurator::getLongName(char shortName) const
{
- foreachpair (const string& key, const Option& opt, options) {
+ foreachpair (const string& key, const ConfigOption& opt, options) {
if (opt.hasShortName && opt.shortName == shortName)
return key;
}
Modified: incubator/mesos/trunk/src/configurator/configurator.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/configurator/configurator.hpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/configurator/configurator.hpp (original)
+++ incubator/mesos/trunk/src/configurator/configurator.hpp Mon Jun 27 06:08:33 2011
@@ -7,12 +7,12 @@
#include <glog/logging.h>
-#include "configuration.hpp"
-#include "option.hpp"
+#include "configurator/configuration.hpp"
+#include "configurator/option.hpp"
namespace mesos { namespace internal {
-
+
/**
* Exception type thrown by Configurator.
@@ -25,7 +25,7 @@ struct ConfigurationException : std::exc
};
-/**
+/**
* This class populates a Configuration object, which can be retrieved
* with getConfiguration(), by reading variables from the command
* line, a config file or the environment.
@@ -47,7 +47,7 @@ public:
private:
Configuration conf;
- std::map<std::string, Option> options;
+ std::map<std::string, ConfigOption> options;
public:
@@ -100,12 +100,12 @@ private:
std::string message = "Duplicate option registration: " + name;
throw ConfigurationException(message.c_str());
}
- options[name] = Option(helpString,
- Validator<T>(),
- hasShortName,
- shortName,
- hasDefault,
- defaultValue);
+ options[name] = ConfigOption(helpString,
+ Validator<T>(),
+ hasShortName,
+ shortName,
+ hasDefault,
+ defaultValue);
}
public:
Modified: incubator/mesos/trunk/src/configurator/option.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/configurator/option.hpp?rev=1140024&r1=1140023&r2=1140024&view=diff
==============================================================================
--- incubator/mesos/trunk/src/configurator/option.hpp (original)
+++ incubator/mesos/trunk/src/configurator/option.hpp Mon Jun 27 06:08:33 2011
@@ -1,5 +1,5 @@
-#ifndef __OPTION_HPP__
-#define __OPTION_HPP__
+#ifndef __CONFIGURATOR_OPTION_HPP__
+#define __CONFIGURATOR_OPTION_HPP__
#include <string>
@@ -75,16 +75,16 @@ public:
/**
* Registered option with help string and default value
**/
-class Option {
+class ConfigOption {
public:
- Option() : hasDefault(false), validator(NULL) {}
+ ConfigOption() : hasDefault(false), validator(NULL) {}
- Option(const std::string& _helpString,
- const ValidatorBase& _validator,
- bool _hasShortName,
- char _shortName,
- bool _hasDefault,
- const std::string& _defaultValue)
+ ConfigOption(const std::string& _helpString,
+ const ValidatorBase& _validator,
+ bool _hasShortName,
+ char _shortName,
+ bool _hasDefault,
+ const std::string& _defaultValue)
: helpString(_helpString),
hasDefault(_hasDefault),
defaultValue(_defaultValue),
@@ -93,9 +93,9 @@ public:
{
validator = _validator.clone();
}
-
- Option(const Option& opt)
- : helpString(opt.helpString),
+
+ ConfigOption(const ConfigOption& opt)
+ : helpString(opt.helpString),
hasDefault(opt.hasDefault),
hasShortName(opt.hasShortName),
shortName(opt.shortName),
@@ -104,7 +104,7 @@ public:
validator = (opt.validator == NULL) ? NULL : opt.validator->clone();
}
- Option &operator=(const Option& opt)
+ ConfigOption &operator=(const ConfigOption& opt)
{
helpString = opt.helpString;
hasDefault = opt.hasDefault;
@@ -115,9 +115,9 @@ public:
return *this;
}
- ~Option()
- {
- if (validator != 0) delete validator;
+ ~ConfigOption()
+ {
+ if (validator != 0) delete validator;
}
std::string helpString;
@@ -130,4 +130,4 @@ public:
} } // end mesos :: internal namespace
-#endif
+#endif // __CONFIGURATOR_OPTION_HPP__