lib/gizzard/commands.rb in gizzmo-0.11.1 vs lib/gizzard/commands.rb in gizzmo-0.11.2
- old
+ new
@@ -91,9 +91,27 @@
shard_id = ShardId.parse(shard_id_text)
manager.set_forwarding(Forwarding.new(table_id.to_i, base_id.to_i, shard_id))
end
end
+ class DumpCommand < Command
+ def run
+ table_ids = argv.map{|e| e.to_i }
+ manifest = manager.manifest(*table_ids)
+ manifest.trees.values.each do |tree|
+ down(tree, 0)
+ end
+ end
+
+ def down(shard, depth)
+ printable = " " * depth + shard.info.id.to_unix
+ output printable
+ shard.children.each do |child|
+ down(child, depth + 1)
+ end
+ end
+ end
+
class DeleteforwardingCommand < Command
def run
help! if argv.length != 3
table_id, base_id, shard_id_text = argv
shard_id = ShardId.parse(shard_id_text)