Permalink
Browse files

Merge branch 'vblob' into services-r9

Change-Id: I7a3e7fcfab2457a680483e30013a697b6b92ba5f
  • Loading branch information...
2 parents 5c0cc39 + cf8f153 commit 0b2a22a143b0229c2a48a42c2bede8672756ab31 SonicWang committed Mar 1, 2012
Showing with 1,290 additions and 0 deletions.
  1. +25 −0 vblob/Gemfile
  2. +169 −0 vblob/Gemfile.lock
  3. +39 −0 vblob/Rakefile
  4. +28 −0 vblob/bin/vblob_gateway
  5. +36 −0 vblob/bin/vblob_node
  6. +28 −0 vblob/config/vblob_gateway.yml
  7. +23 −0 vblob/config/vblob_node.yml
  8. +12 −0 vblob/lib/vblob_service/common.rb
  9. +503 −0 vblob/lib/vblob_service/vblob_node.rb
  10. +9 −0 vblob/lib/vblob_service/vblob_provisioner.rb
  11. +29 −0 vblob/resources/vblob.conf.erb
  12. +41 −0 vblob/spec/Rakefile
  13. +97 −0 vblob/spec/spec_helper.rb
  14. +105 −0 vblob/spec/vblob_bind_spec.rb
  15. +42 −0 vblob/spec/vblob_orphan_spec.rb
  16. +104 −0 vblob/spec/vblob_provision_spec.rb
  17. BIN vblob/vendor/cache/addressable-2.2.6.gem
  18. BIN vblob/vendor/cache/bcrypt-ruby-2.1.4.gem
  19. BIN vblob/vendor/cache/builder-3.0.0.gem
  20. BIN vblob/vendor/cache/ci_reporter-1.6.9.gem
  21. BIN vblob/vendor/cache/curb-0.7.16.gem
  22. BIN vblob/vendor/cache/daemons-1.1.5.gem
  23. BIN vblob/vendor/cache/data_objects-0.10.7.gem
  24. BIN vblob/vendor/cache/datamapper-1.1.0.gem
  25. BIN vblob/vendor/cache/diff-lcs-1.1.3.gem
  26. BIN vblob/vendor/cache/dm-aggregates-1.1.0.gem
  27. BIN vblob/vendor/cache/dm-constraints-1.1.0.gem
  28. BIN vblob/vendor/cache/dm-core-1.1.0.gem
  29. BIN vblob/vendor/cache/dm-do-adapter-1.1.0.gem
  30. BIN vblob/vendor/cache/dm-migrations-1.1.0.gem
  31. BIN vblob/vendor/cache/dm-serializer-1.1.0.gem
  32. BIN vblob/vendor/cache/dm-sqlite-adapter-1.1.0.gem
  33. BIN vblob/vendor/cache/dm-timestamps-1.1.0.gem
  34. BIN vblob/vendor/cache/dm-transactions-1.1.0.gem
  35. BIN vblob/vendor/cache/dm-types-1.1.0.gem
  36. BIN vblob/vendor/cache/dm-validations-1.1.0.gem
  37. BIN vblob/vendor/cache/do_sqlite3-0.10.7.gem
  38. BIN vblob/vendor/cache/em-http-request-0.3.0.gem
  39. BIN vblob/vendor/cache/escape_utils-0.2.4.gem
  40. BIN vblob/vendor/cache/eventmachine-0.12.11.cloudfoundry.3.gem
  41. BIN vblob/vendor/cache/eventmachine_httpserver-0.2.1.gem
  42. BIN vblob/vendor/cache/fastercsv-1.5.4.gem
  43. BIN vblob/vendor/cache/json-1.4.6.gem
  44. BIN vblob/vendor/cache/json_pure-1.6.4.gem
  45. BIN vblob/vendor/cache/little-plugger-1.1.3.gem
  46. BIN vblob/vendor/cache/logging-1.6.1.gem
  47. BIN vblob/vendor/cache/macaddr-1.5.0.gem
  48. BIN vblob/vendor/cache/multi_json-1.0.4.gem
  49. BIN vblob/vendor/cache/nats-0.4.22.beta.4.gem
  50. BIN vblob/vendor/cache/posix-spawn-0.3.6.gem
  51. BIN vblob/vendor/cache/rack-1.4.0.gem
  52. BIN vblob/vendor/cache/rake-0.9.2.2.gem
  53. BIN vblob/vendor/cache/rcov-0.9.11.gem
  54. BIN vblob/vendor/cache/redis-2.2.2.gem
  55. BIN vblob/vendor/cache/redis-namespace-1.0.3.gem
  56. BIN vblob/vendor/cache/redisk-0.2.2.gem
  57. BIN vblob/vendor/cache/resque-1.19.0.gem
  58. BIN vblob/vendor/cache/resque-status-0.2.4.gem
  59. BIN vblob/vendor/cache/rspec-2.7.0.gem
  60. BIN vblob/vendor/cache/rspec-core-2.7.1.gem
  61. BIN vblob/vendor/cache/rspec-expectations-2.7.0.gem
  62. BIN vblob/vendor/cache/rspec-mocks-2.7.0.gem
  63. BIN vblob/vendor/cache/ruby-hmac-0.4.0.gem
  64. BIN vblob/vendor/cache/sinatra-1.2.7.gem
  65. BIN vblob/vendor/cache/stringex-1.2.2.gem
  66. BIN vblob/vendor/cache/systemu-2.4.2.gem
  67. BIN vblob/vendor/cache/thin-1.3.1.gem
  68. BIN vblob/vendor/cache/tilt-1.3.3.gem
  69. BIN vblob/vendor/cache/uuid-2.3.4.gem
  70. BIN vblob/vendor/cache/uuidtools-2.1.2.gem
  71. BIN vblob/vendor/cache/vcap_common-1.0.4.gem
  72. BIN vblob/vendor/cache/vcap_logging-0.1.3.gem
  73. BIN vblob/vendor/cache/vcap_services_base-0.1.7.gem
  74. BIN vblob/vendor/cache/vegas-0.1.8.gem
  75. BIN vblob/vendor/cache/yajl-ruby-0.8.3.gem
View
@@ -0,0 +1,25 @@
+source :rubygems
+
+gem 'eventmachine'
+gem "em-http-request"
+gem "nats"
+gem "ruby-hmac"
+gem "uuidtools"
+gem "datamapper", ">= 0.10.2"
+gem "do_sqlite3"
+gem "dm-sqlite-adapter"
+gem "sinatra"
+gem "thin"
+gem "json"
+gem "yajl-ruby"
+
+gem 'vcap_common', '~> 1.0.4', :require => ['vcap/common', 'vcap/component']
+gem 'vcap_logging', '>=0.1.3', :require => ['vcap/logging']
+gem 'vcap_services_base'
+
+group :test do
+ gem "rake"
+ gem "rspec"
+ gem "rcov"
+ gem "ci_reporter"
+end
View
@@ -0,0 +1,169 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.6)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ ci_reporter (1.6.9)
+ builder (>= 2.1.2)
+ curb (0.7.16)
+ daemons (1.1.5)
+ data_objects (0.10.7)
+ addressable (~> 2.1)
+ datamapper (1.1.0)
+ dm-aggregates (= 1.1.0)
+ dm-constraints (= 1.1.0)
+ dm-core (= 1.1.0)
+ dm-migrations (= 1.1.0)
+ dm-serializer (= 1.1.0)
+ dm-timestamps (= 1.1.0)
+ dm-transactions (= 1.1.0)
+ dm-types (= 1.1.0)
+ dm-validations (= 1.1.0)
+ diff-lcs (1.1.3)
+ dm-aggregates (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-constraints (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-core (1.1.0)
+ addressable (~> 2.2.4)
+ dm-do-adapter (1.1.0)
+ data_objects (~> 0.10.2)
+ dm-core (~> 1.1.0)
+ dm-migrations (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-serializer (1.1.0)
+ dm-core (~> 1.1.0)
+ fastercsv (~> 1.5.4)
+ json (~> 1.4.6)
+ dm-sqlite-adapter (1.1.0)
+ dm-do-adapter (~> 1.1.0)
+ do_sqlite3 (~> 0.10.2)
+ dm-timestamps (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-transactions (1.1.0)
+ dm-core (~> 1.1.0)
+ dm-types (1.1.0)
+ bcrypt-ruby (~> 2.1.4)
+ dm-core (~> 1.1.0)
+ fastercsv (~> 1.5.4)
+ json (~> 1.4.6)
+ stringex (~> 1.2.0)
+ uuidtools (~> 2.1.2)
+ dm-validations (1.1.0)
+ dm-core (~> 1.1.0)
+ do_sqlite3 (0.10.7)
+ data_objects (= 0.10.7)
+ em-http-request (0.3.0)
+ addressable (>= 2.0.0)
+ escape_utils
+ eventmachine (>= 0.12.9)
+ escape_utils (0.2.4)
+ eventmachine (0.12.11.cloudfoundry.3)
+ eventmachine_httpserver (0.2.1)
+ fastercsv (1.5.4)
+ json (1.4.6)
+ json_pure (1.6.4)
+ little-plugger (1.1.3)
+ logging (1.6.1)
+ little-plugger (>= 1.1.2)
+ macaddr (1.5.0)
+ systemu (>= 2.4.0)
+ multi_json (1.0.4)
+ nats (0.4.22.beta.4)
+ daemons (>= 1.1.4)
+ eventmachine (>= 0.12.10)
+ json_pure (>= 1.6.1)
+ thin (>= 1.3.1)
+ posix-spawn (0.3.6)
+ rack (1.4.0)
+ rake (0.9.2.2)
+ rcov (0.9.11)
+ redis (2.2.2)
+ redis-namespace (1.0.3)
+ redis (< 3.0.0)
+ redisk (0.2.2)
+ redis (>= 0.1.1)
+ redis-namespace (>= 0.1.0)
+ resque (1.19.0)
+ multi_json (~> 1.0)
+ redis-namespace (~> 1.0.2)
+ sinatra (>= 0.9.2)
+ vegas (~> 0.1.2)
+ resque-status (0.2.4)
+ redisk (>= 0.2.1)
+ resque (>= 1.3.1)
+ uuid (>= 2.0.2)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.7.0)
+ ruby-hmac (0.4.0)
+ sinatra (1.2.7)
+ rack (~> 1.1)
+ tilt (>= 1.2.2, < 2.0)
+ stringex (1.2.2)
+ systemu (2.4.2)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ tilt (1.3.3)
+ uuid (2.3.4)
+ macaddr (~> 1.0)
+ uuidtools (2.1.2)
+ vcap_common (1.0.4)
+ eventmachine (~> 0.12.11.cloudfoundry.3)
+ logging (>= 1.5.0)
+ nats (~> 0.4.22.beta.4)
+ posix-spawn (~> 0.3.6)
+ thin (~> 1.3.1)
+ yajl-ruby (~> 0.8.3)
+ vcap_logging (0.1.3)
+ vcap_services_base (0.1.7)
+ curb (~> 0.7.16)
+ datamapper (~> 1.1.0)
+ do_sqlite3 (~> 0.10.3)
+ em-http-request (~> 0.3.0)
+ eventmachine (~> 0.12.11.cloudfoundry.3)
+ eventmachine_httpserver (~> 0.2.1)
+ json (~> 1.4.6)
+ nats (~> 0.4.22.beta.4)
+ resque-status (~> 0.2.4)
+ ruby-hmac (~> 0.4.0)
+ sinatra (~> 1.2.3)
+ thin (~> 1.3.1)
+ uuidtools (~> 2.1.2)
+ vcap_common (>= 1.0.4)
+ vcap_logging (>= 0.1.3)
+ vegas (0.1.8)
+ rack (>= 1.0.0)
+ yajl-ruby (0.8.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ ci_reporter
+ datamapper (>= 0.10.2)
+ dm-sqlite-adapter
+ do_sqlite3
+ em-http-request
+ eventmachine
+ json
+ nats
+ rake
+ rcov
+ rspec
+ ruby-hmac
+ sinatra
+ thin
+ uuidtools
+ vcap_common (~> 1.0.4)
+ vcap_logging (>= 0.1.3)
+ vcap_services_base
+ yajl-ruby
View
@@ -0,0 +1,39 @@
+require 'rake'
+
+desc "Run specs"
+task "spec" => ["bundler:install:test", "test:spec"]
+
+desc "Run specs using RCov"
+task "spec:rcov" => ["bundler:install:test", "test:spec:rcov"]
+
+namespace "bundler" do
+ desc "Install gems"
+ task "install" do
+ sh("bundle install")
+ end
+
+ desc "Install gems for test"
+ task "install:test" do
+ sh("bundle install --without development production")
+ end
+
+ desc "Install gems for production"
+ task "install:production" do
+ sh("bundle install --without development test")
+ end
+
+ desc "Install gems for development"
+ task "install:development" do
+ sh("bundle install --without test production")
+ end
+end
+
+namespace "test" do
+ task "spec" do |t|
+ sh("cd spec && ../../base/bin/nats-util start && rake spec && ../../base/bin/nats-util stop")
+ end
+
+ task "spec:rcov" do |t|
+ sh("cd spec && rake spec:rcov")
+ end
+end
View
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+# -*- mode: ruby -*-
+# Copyright (c) 2009-2011 VMware, Inc.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+require 'bundler/setup'
+require 'vcap_services_base'
+
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+require 'vblob_service/vblob_provisioner'
+
+class VCAP::Services::VBlob::Gateway < VCAP::Services::Base::Gateway
+
+ def provisioner_class
+ VCAP::Services::VBlob::Provisioner
+ end
+
+ def default_config_file
+ config_base_dir = ENV["CLOUD_FOUNDRY_CONFIG_PATH"] || File.join(File.dirname(__FILE__), '..', 'config')
+ File.join(config_base_dir, 'vblob_gateway.yml')
+ end
+
+end
+
+VCAP::Services::VBlob::Gateway.new.start
+
+
View
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+# -*- mode: ruby -*-
+# Copyright (c) 2009-2011 VMware, Inc.
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+require 'bundler/setup'
+require 'vcap_services_base'
+
+$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
+require "vblob_service/vblob_node"
+
+class VCAP::Services::VBlob::NodeBin < VCAP::Services::Base::NodeBin
+
+ def node_class
+ VCAP::Services::VBlob::Node
+ end
+
+ def default_config_file
+ config_base_dir = ENV["CLOUD_FOUNDRY_CONFIG_PATH"] || File.join(File.dirname(__FILE__), '..', 'config')
+ File.join(config_base_dir, 'vblob_node.yml')
+ end
+
+ def additional_config(options, config)
+ options[:config_template] = File.expand_path("../../resources/vblob.conf.erb", __FILE__)
+ options[:port_range] = parse_property(config, "port_range", Range)
+ options[:nodejs_path] = parse_property(config, "nodejs_path", String)
+ options[:vblobd_log_dir] = parse_property(config, "vblobd_log_dir", String)
+ options[:vblobd_path] = parse_property(config, "vblobd_path", String)
+ options[:vblobd_auth] = parse_property(config, "vblobd_auth", String)
+ options[:max_memory] = parse_property(config, "max_memory", Integer)
+ options
+ end
+
+end
+
+VCAP::Services::VBlob::NodeBin.new.start
@@ -0,0 +1,28 @@
+---
+# cloud_controller_uri: api.vcap.me
+service:
+ name: vblob
+ version: "1.0"
+ description: 'vBlob service'
+ plans: ['free']
+ tags: ['vblob', 'vblob-1.0', 'nosql']
+ip_route: localhost
+#proxy:
+# host: proxy
+# port: 8080
+# keepalive: true
+index: 0
+token: "0xdeadbeef"
+mbus: nats://localhost:4222
+logging:
+ level: debug
+pid: /var/vcap/sys/run/vblob_service.pid
+# z_interval: 30
+# check_orphan_interval: 3600
+# double_check_orphan_interval: 300
+plan_management:
+ plans:
+ free:
+ low_water: 10
+ high_water: 180
+ #allow_over_provisioning: false
@@ -0,0 +1,23 @@
+---
+capacity: 200
+plan: free
+local_db: sqlite3:/var/vcap/services/vblob/vblob_node.db
+mbus: nats://localhost:4222
+index: 0
+base_dir: /var/vcap/services/vblob/instances
+ip_route: 127.0.0.1
+logging:
+ level: debug
+vblobd_log_dir: /var/vcap/sys/service-log/vblob
+pid: /var/vcap/sys/run/vblob_node.pid
+max_memory: 128
+node_id: vblob_node_free_1
+nodejs_path: node
+vblobd_path: /var/vcap/packages/vblob
+vblobd_auth: disabled
+port_range:
+ first: 45001
+ last: 65000
+# z_interval: 30
+# max_nats_payload: 1048576
+# fqdn_hosts: false
@@ -0,0 +1,12 @@
+# Copyright (c) 2009-2011 VMware, Inc.
+module VCAP
+ module Services
+ module VBlob
+ module Common
+ def service_name
+ "VBlobaaS"
+ end
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 0b2a22a

Please sign in to comment.