distlock 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in distlock.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/distlock.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "distlock/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "distlock"
7
+ s.version = Distlock::VERSION
8
+ s.authors = ["Simon Horne"]
9
+ s.email = ["simon@soulware.co.uk"]
10
+ s.homepage = ""
11
+ s.summary = %q{Distributed Locking}
12
+ s.description = %q{Distributed Locking}
13
+
14
+ s.rubyforge_project = "distlock"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+
25
+ s.add_runtime_dependency "zookeeper"
26
+ end
@@ -0,0 +1,3 @@
1
+ module Distlock
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,19 @@
1
+ module Distlock
2
+ module ZK
3
+ class AffinityPool
4
+ def initialize(options={})
5
+ defaults = {:host => "localhost:2181", :timeout => 10, :root_path => "/affinity/global/test"}
6
+ @options = defaults.merge(options)
7
+ end
8
+
9
+ def zk
10
+ @zk ||= begin
11
+ zk = Zookeeper.new(@options[:host], @options[:timeout])
12
+
13
+ # todo - initialize the root_path hierarchy here
14
+ zk.stat(:path => @options[:root_path])
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ require 'zookeeper'
2
+ require 'distlock/zk/affinity_pool'
3
+
4
+ module Distlock
5
+ module ZK
6
+ end
7
+ end
data/lib/distlock.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'distlock/version'
2
+ require 'distlock/zk/zk'
3
+
4
+ module Distlock
5
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: distlock
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Simon Horne
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: zookeeper
16
+ requirement: &70317091743500 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70317091743500
25
+ description: Distributed Locking
26
+ email:
27
+ - simon@soulware.co.uk
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - distlock.gemspec
36
+ - lib/distlock.rb
37
+ - lib/distlock/version.rb
38
+ - lib/distlock/zk/affinity_pool.rb
39
+ - lib/distlock/zk/zk.rb
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project: distlock
60
+ rubygems_version: 1.8.10
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Distributed Locking
64
+ test_files: []