leela_client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/leela_client/lb.rb CHANGED
@@ -18,33 +18,31 @@ module LeelaClient
18
18
  module LoadBalancer
19
19
  extend self
20
20
 
21
- def group(ring, metrics)
22
- group = Hash[ ring.values.map {|x| [x, []]} ]
23
- metrics.each do |m|
24
- node = ring.select(m.key)
25
- group[node] << m
21
+ def group(ring, values)
22
+ g = Hash[ ring.values.map {|x| [x, []]} ]
23
+ values.each do |v|
24
+ node = ring.select(v.key)
25
+ g[node] << v
26
26
  end
27
-
28
- group
27
+ return(g)
29
28
  end
30
29
 
31
- def group_limit(ring, metrics, maxsize)
32
- g1 = {}
33
- c = 0
34
-
35
- group(ring, metrics).each do |k, ms|
36
- g1[k] = [[]]
37
- ms.each do |m|
38
- c += m.size
39
- g1[k][-1] << m
30
+ def group_limit(ring, values, maxsize)
31
+ g = {}
32
+ c = 0
33
+ group(ring, values).each do |k, vs|
34
+ tmp = [[]]
35
+ vs.each do |v|
36
+ c += v.size
40
37
  if (c >= maxsize)
41
- c = 0
42
- g1[k] << []
38
+ c = v.size
39
+ tmp << []
43
40
  end
41
+ tmp[-1] << v
44
42
  end
43
+ g[k] = tmp.select {|vs| vs.size > 0}
45
44
  end
46
-
47
- g1
45
+ return(g)
48
46
  end
49
47
  end
50
48
  end
@@ -1,3 +1,3 @@
1
1
  module LeelaClient
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leela_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,23 +12,22 @@ bindir: bin
12
12
  cert_chain: []
13
13
  date: 2013-04-17 00:00:00.000000000 Z
14
14
  dependencies: []
15
- description: A client for leela chart server
15
+ description: A client for leela server
16
16
  email:
17
17
  - pothix@pothix.com
18
- - dgvncsz0f@bitforest.com
18
+ - dsouza@c0d3.xxx
19
19
  executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
+ - ./leela_client.rb
24
+ - ./leela_client-0.0.4.gem
25
+ - ./leela_client/metrics.rb
26
+ - ./leela_client/ring.rb
27
+ - ./leela_client/api.rb
23
28
  - ./leela_client/version.rb
24
29
  - ./leela_client/transport.rb
25
- - ./leela_client/api.rb
26
- - ./leela_client/ring.rb
27
30
  - ./leela_client/lb.rb
28
- - ./leela_client/metrics.rb
29
- - ./Rakefile
30
- - ./leela_client.gemspec
31
- - ./leela_client.rb
32
31
  homepage: https://github.com/locaweb/leela-client
33
32
  licenses: []
34
33
  post_install_message:
@@ -49,8 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
48
  version: '0'
50
49
  requirements: []
51
50
  rubyforge_project:
52
- rubygems_version: 1.8.23
51
+ rubygems_version: 1.8.24
53
52
  signing_key:
54
53
  specification_version: 3
55
- summary: A client for leela chart server
54
+ summary: A client for leela server
56
55
  test_files: []
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
data/leela_client.gemspec DELETED
@@ -1,16 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../leela_client/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["PotHix", "dgvncsz0f"]
6
- gem.email = ["pothix@pothix.com", "dgvncsz0f@bitforest.com"]
7
- gem.description = %q{A client for leela chart server}
8
- gem.summary = gem.description
9
- gem.homepage = "https://github.com/locaweb/leela-client"
10
-
11
- gem.files = Dir["./**/*"].reject {|file| file =~ /\.git|pkg/}
12
- gem.require_paths = ["leela_client"]
13
-
14
- gem.name = "leela_client"
15
- gem.version = LeelaClient::VERSION
16
- end