Permalink
Browse files

mvstore->cf (first rev) + merged in post-r7 master + Nick's review co…

…mments (3 passes)

Change-Id: I82d3eab3cbe2c375e3e084aa5407b8f9a3e33306
  • Loading branch information...
1 parent 8a891bb commit 07a152defbcc436c8208cbf93f60b3f4c4cb2f05 @mwindisch mwindisch committed Dec 12, 2011
Showing with 1,306 additions and 0 deletions.
  1. +3 −0 mvstore/.gitignore
  2. +23 −0 mvstore/Gemfile
  3. +128 −0 mvstore/Gemfile.lock
  4. +39 −0 mvstore/Rakefile
  5. +27 −0 mvstore/bin/mvstore_gateway
  6. +36 −0 mvstore/bin/mvstore_node
  7. +16 −0 mvstore/config/mvstore_gateway.yml
  8. +16 −0 mvstore/config/mvstore_node.yml
  9. +12 −0 mvstore/lib/mvstore_service/common.rb
  10. +569 −0 mvstore/lib/mvstore_service/mvstore_node.rb
  11. +10 −0 mvstore/lib/mvstore_service/mvstore_provisioner.rb
  12. +41 −0 mvstore/spec/Rakefile
  13. +96 −0 mvstore/spec/mvstore_bind_spec.rb
  14. +42 −0 mvstore/spec/mvstore_orphan_spec.rb
  15. +156 −0 mvstore/spec/mvstore_provision_spec.rb
  16. +92 −0 mvstore/spec/spec_helper.rb
  17. BIN mvstore/vendor/cache/addressable-2.2.4.gem
  18. BIN mvstore/vendor/cache/bcrypt-ruby-2.1.4.gem
  19. BIN mvstore/vendor/cache/builder-3.0.0.gem
  20. BIN mvstore/vendor/cache/ci_reporter-1.6.4.gem
  21. BIN mvstore/vendor/cache/daemons-1.1.2.gem
  22. BIN mvstore/vendor/cache/data_objects-0.10.3.gem
  23. BIN mvstore/vendor/cache/datamapper-1.1.0.gem
  24. BIN mvstore/vendor/cache/diff-lcs-1.1.2.gem
  25. BIN mvstore/vendor/cache/dm-aggregates-1.1.0.gem
  26. BIN mvstore/vendor/cache/dm-constraints-1.1.0.gem
  27. BIN mvstore/vendor/cache/dm-core-1.1.0.gem
  28. BIN mvstore/vendor/cache/dm-do-adapter-1.1.0.gem
  29. BIN mvstore/vendor/cache/dm-migrations-1.1.0.gem
  30. BIN mvstore/vendor/cache/dm-serializer-1.1.0.gem
  31. BIN mvstore/vendor/cache/dm-sqlite-adapter-1.1.0.gem
  32. BIN mvstore/vendor/cache/dm-timestamps-1.1.0.gem
  33. BIN mvstore/vendor/cache/dm-transactions-1.1.0.gem
  34. BIN mvstore/vendor/cache/dm-types-1.1.0.gem
  35. BIN mvstore/vendor/cache/dm-validations-1.1.0.gem
  36. BIN mvstore/vendor/cache/do_sqlite3-0.10.3.gem
  37. BIN mvstore/vendor/cache/em-http-request-0.3.0.gem
  38. BIN mvstore/vendor/cache/escape_utils-0.2.3.gem
  39. BIN mvstore/vendor/cache/eventmachine-0.12.10.gem
  40. BIN mvstore/vendor/cache/fastercsv-1.5.4.gem
  41. BIN mvstore/vendor/cache/json-1.4.6.gem
  42. BIN mvstore/vendor/cache/json_pure-1.5.1.gem
  43. BIN mvstore/vendor/cache/little-plugger-1.1.2.gem
  44. BIN mvstore/vendor/cache/logging-1.5.0.gem
  45. BIN mvstore/vendor/cache/mime-types-1.17.2.gem
  46. BIN mvstore/vendor/cache/nats-0.4.10.gem
  47. BIN mvstore/vendor/cache/posix-spawn-0.3.6.gem
  48. BIN mvstore/vendor/cache/rack-1.2.2.gem
  49. BIN mvstore/vendor/cache/rake-0.9.2.gem
  50. BIN mvstore/vendor/cache/rcov-0.9.9.gem
  51. BIN mvstore/vendor/cache/rest-client-1.6.7.gem
  52. BIN mvstore/vendor/cache/rspec-2.5.0.gem
  53. BIN mvstore/vendor/cache/rspec-core-2.5.1.gem
  54. BIN mvstore/vendor/cache/rspec-expectations-2.5.0.gem
  55. BIN mvstore/vendor/cache/rspec-mocks-2.5.0.gem
  56. BIN mvstore/vendor/cache/ruby-hmac-0.4.0.gem
  57. BIN mvstore/vendor/cache/sinatra-1.2.1.gem
  58. BIN mvstore/vendor/cache/stringex-1.2.1.gem
  59. BIN mvstore/vendor/cache/thin-1.2.11.gem
  60. BIN mvstore/vendor/cache/tilt-1.2.2.gem
  61. BIN mvstore/vendor/cache/uuidtools-2.1.2.gem
  62. BIN mvstore/vendor/cache/vcap_common-0.99.gem
  63. BIN mvstore/vendor/cache/vcap_logging-0.1.3.gem
  64. BIN mvstore/vendor/cache/yajl-ruby-0.8.2.gem
View
@@ -0,0 +1,3 @@
+./configs/*
+./databases/*
+*.db
View
@@ -0,0 +1,23 @@
+source :rubygems
+
+gem "eventmachine"
+gem "em-http-request"
+gem "nats", '>= 0.4.10'
+gem "ruby-hmac"
+gem "uuidtools"
+gem "datamapper", ">= 0.10.2"
+gem "do_sqlite3"
+gem "dm-sqlite-adapter"
+gem "rest-client", ">= 1.6.7"
+gem "sinatra"
+gem "thin"
+
+gem 'vcap_common', :require => ['vcap/common', 'vcap/component']
+gem 'vcap_logging', '>=0.1.3', :require => ['vcap/logging']
+
+group :test do
+ gem "rake"
+ gem "rspec"
+ gem "rcov"
+ gem "ci_reporter"
+end
View
@@ -0,0 +1,128 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.4)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ ci_reporter (1.6.4)
+ builder (>= 2.1.2)
+ daemons (1.1.2)
+ data_objects (0.10.3)
+ 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.2)
+ 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.3)
+ data_objects (= 0.10.3)
+ em-http-request (0.3.0)
+ addressable (>= 2.0.0)
+ escape_utils
+ eventmachine (>= 0.12.9)
+ escape_utils (0.2.3)
+ eventmachine (0.12.10)
+ fastercsv (1.5.4)
+ json (1.4.6)
+ json_pure (1.5.1)
+ little-plugger (1.1.2)
+ logging (1.5.0)
+ little-plugger (>= 1.1.2)
+ mime-types (1.17.2)
+ nats (0.4.10)
+ daemons (>= 1.1.0)
+ eventmachine (>= 0.12.10)
+ json_pure (>= 1.5.1)
+ posix-spawn (0.3.6)
+ rack (1.2.2)
+ rake (0.9.2)
+ rcov (0.9.9)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.1)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ ruby-hmac (0.4.0)
+ sinatra (1.2.1)
+ rack (~> 1.1)
+ tilt (>= 1.2.2, < 2.0)
+ stringex (1.2.1)
+ thin (1.2.11)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ tilt (1.2.2)
+ uuidtools (2.1.2)
+ vcap_common (0.99)
+ eventmachine (~> 0.12.10)
+ logging (>= 1.5.0)
+ nats
+ posix-spawn
+ thin
+ yajl-ruby
+ vcap_logging (0.1.3)
+ yajl-ruby (0.8.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ ci_reporter
+ datamapper (>= 0.10.2)
+ dm-sqlite-adapter
+ do_sqlite3
+ em-http-request
+ eventmachine
+ nats (>= 0.4.10)
+ rake
+ rcov
+ rest-client (>= 1.6.7)
+ rspec
+ ruby-hmac
+ sinatra
+ thin
+ uuidtools
+ vcap_common
+ vcap_logging (>= 0.1.3)
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
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# -*- mode: ruby -*-
+# Copyright (c) 2009-2011 VMware, Inc.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'base', 'lib')
+require 'base/gateway'
+
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+require 'mvstore_service/mvstore_provisioner'
+
+class VCAP::Services::MVStore::Gateway < VCAP::Services::Base::Gateway
+
+ def provisioner_class
+ VCAP::Services::MVStore::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, 'mvstore_gateway.yml')
+ end
+
+end
+
+VCAP::Services::MVStore::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__)
+
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'base', 'lib')
+require 'base/node_bin'
+
+$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
+require "mvstore_service/mvstore_node"
+
+class VCAP::Services::MVStore::NodeBin < VCAP::Services::Base::NodeBin
+
+ def node_class
+ VCAP::Services::MVStore::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, 'mvstore_node.yml')
+ end
+
+ def additional_config(options, config)
+ options[:config_template] = File.expand_path("../../resources/mvstore.conf.erb", __FILE__)
+ options[:port_range] = parse_property(config, "port_range", Range)
+ options[:mvstore_path] = parse_property(config, "mvstore_path", String)
+ options[:available_memory] = parse_property(config, "available_memory", Integer)
+ options[:max_memory] = parse_property(config, "max_memory", Integer)
+ options[:mvstore_log_dir] = parse_property(config, "mvstore_log_dir", String)
+ options
+ end
+
+end
+
+VCAP::Services::MVStore::NodeBin.new.start
@@ -0,0 +1,16 @@
+---
+cloud_controller_uri: http://api.vcap.me
+service:
+ name: mvstore
+ version: "1.0"
+ description: 'MVStore database'
+ plans: ['free']
+ tags: ['mvstore', 'nosql']
+host: localhost
+index: 0
+token: changemvstoretoken
+mbus: nats://localhost:4222
+pid: /var/vcap/sys/run/mvstore_service.pid
+logging:
+ level: debug
+# allow_over_provisioning: false
@@ -0,0 +1,16 @@
+---
+local_db: sqlite3:/var/vcap/services/mvstore/mvstore_node.db
+mbus: nats://localhost:4222
+index: 0
+base_dir: /var/vcap/services/mvstore/instances
+mvstore_log_dir: /var/vcap/sys/log/mvstore
+pid: /var/vcap/sys/run/mvstore_node.pid
+max_memory: 128
+available_memory: 4096
+node_id: mvstore_node_0
+mvstore_path: mvstored
+port_range:
+ first: 25001
+ last: 45000
+logging:
+ level: debug
@@ -0,0 +1,12 @@
+# Copyright (c) 2009-2011 VMware, Inc.
+module VCAP
+ module Services
+ module MVStore
+ module Common
+ def service_name
+ "MVStoreaaS"
+ end
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 07a152d

Please sign in to comment.