gizzmo 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -28,6 +28,10 @@ Run `gizzmo help` for up-to-date usage.
28
28
  PARENT=`gizzmo links $REPL | cut -f 1 | grep -v $REPL | head -1`
29
29
  gizzmo addlink $PARENT a_shard $NEW_WEIGHT
30
30
  gizzmo unwrap $REPL
31
+
32
+ == Contributing
33
+
34
+ Contributions are welcome! Please send a pull request, or if you're internal to Twitter, please make a branch! Commits to master, and/or patches without minimal test coverage will be rejected/reverted.
31
35
 
32
36
  == Running tests
33
37
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
data/gizzmo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gizzmo}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyle Maxwell"]
12
- s.date = %q{2010-07-13}
12
+ s.date = %q{2010-07-14}
13
13
  s.default_executable = %q{gizzmo}
14
14
  s.description = %q{Gizzmo is a command-line client for managing gizzard clusters.}
15
15
  s.email = %q{kmaxwell@twitter.com}
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/gizzmo.rb",
34
34
  "lib/vendor/thrift_client/simple.rb",
35
35
  "test/config.yaml",
36
+ "test/expected/deep.txt",
36
37
  "test/expected/dry-wrap-table_b_0.txt",
37
38
  "test/expected/empty-file.txt",
38
39
  "test/expected/find-only-sql-shard-type.txt",
@@ -65,7 +65,7 @@ module Gizzard
65
65
  @roots = []
66
66
  argv.each do |arg|
67
67
  @id = ShardId.parse(arg)
68
- @roots << up(@id)
68
+ @roots += roots_of(@id)
69
69
  end
70
70
  @roots.uniq.each do |root|
71
71
  output root.to_unix
@@ -73,15 +73,15 @@ module Gizzard
73
73
  end
74
74
  end
75
75
 
76
- def up(id)
76
+ def roots_of(id)
77
77
  links = service.list_upward_links(id)
78
78
  if links.empty?
79
- id
79
+ [id]
80
80
  else
81
- links.map { |link| link.up_id }.find { |up_id| up(up_id) }
81
+ links.map { |link| roots_of(link.up_id) }.flatten
82
82
  end
83
83
  end
84
-
84
+
85
85
  def down(id, depth = 0)
86
86
  service.list_downward_links(id).map do |link|
87
87
  printable = " " * depth + link.down_id.to_unix
@@ -0,0 +1,10 @@
1
+ localhost/table_deep_repl_0
2
+ localhost/table_deep_repl_1
3
+ localhost/table_deep_repl_2
4
+ localhost/table_deep_repl_3
5
+ localhost/table_deep_repl_4
6
+ localhost/table_deep_repl_5
7
+ localhost/table_deep_repl_6
8
+ localhost/table_deep_repl_7
9
+ localhost/table_deep_repl_8
10
+ localhost/table_deep_repl_9
@@ -29,5 +29,3 @@ localhost/table_b_8 com.twitter.service.flock.edges.SqlShard unbusy
29
29
  localhost/table_repl_9 com.twitter.service.flock.edges.ReplicatingShard unbusy
30
30
  localhost/table_a_9 com.twitter.service.flock.edges.SqlShard unbusy
31
31
  localhost/table_b_9 com.twitter.service.flock.edges.SqlShard unbusy
32
- localhost/replicating_table_b_0 com.twitter.service.flock.edges.ReplicatingShard unbusy
33
- localhost/table_b_0 com.twitter.service.flock.edges.SqlShard unbusy
@@ -10,8 +10,6 @@ localhost/table_repl_1
10
10
  localhost/table_repl_2
11
11
  localhost/table_a_2
12
12
  localhost/table_b_2
13
- localhost/blocked_table_a_3
14
- localhost/table_a_3
15
13
  localhost/table_repl_4
16
14
  localhost/table_a_4
17
15
  localhost/table_b_4
data/test/test.sh CHANGED
@@ -62,3 +62,14 @@ g links localhost/table_b_0 | expect empty-file.txt
62
62
  g wrap com.twitter.gizzard.shards.BlockedShard localhost/table_a_3
63
63
  g find -hlocalhost | xargs ../bin/gizzmo -Cconfig.yaml subtree 2>&1 | expect subtree.txt
64
64
  g find -hlocalhost | ../bin/gizzmo -Cconfig.yaml subtree 2>&1 | expect subtree.txt
65
+
66
+ # test a deep tree
67
+ g create localhost "table_deep_repl_0" com.twitter.service.flock.edges.ReplicatingShard
68
+ for i in {1..9}
69
+ do
70
+ last=$((i-1))
71
+ g create localhost "table_deep_repl_$i" com.twitter.service.flock.edges.ReplicatingShard
72
+ g addlink "localhost/table_deep_repl_$last" "localhost/table_deep_repl_$i" 2
73
+ done
74
+
75
+ g subtree localhost/table_deep_repl_5 | expect deep.txt
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kyle Maxwell
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-13 00:00:00 -07:00
17
+ date: 2010-07-14 00:00:00 -07:00
18
18
  default_executable: gizzmo
19
19
  dependencies: []
20
20
 
@@ -42,6 +42,7 @@ files:
42
42
  - lib/gizzmo.rb
43
43
  - lib/vendor/thrift_client/simple.rb
44
44
  - test/config.yaml
45
+ - test/expected/deep.txt
45
46
  - test/expected/dry-wrap-table_b_0.txt
46
47
  - test/expected/empty-file.txt
47
48
  - test/expected/find-only-sql-shard-type.txt