zookeeper 0.4.1 → 0.4.2

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/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.4.2 Add options to Zookeeper#initialize, silence most Zookeeper logs.
2
+
1
3
  v0.4.1 Upgrade to ZooKeeper 3.3.2
2
4
 
3
5
  v0.4.0. More attr-readers (StarvingMarvin) and 1.9 compatibility (tsuraan)
data/Manifest CHANGED
@@ -1,6 +1,5 @@
1
1
  CHANGELOG
2
2
  LICENSE
3
- Manifest
4
3
  README
5
4
  Rakefile
6
5
  examples/cloud_config.rb
@@ -21,4 +20,4 @@ test/test_close.rb
21
20
  test/test_esoteric.rb
22
21
  test/test_watcher1.rb
23
22
  test/test_watcher2.rb
24
- zookeeper.gemspec
23
+ Manifest
data/ext/zookeeper_c.c CHANGED
@@ -55,9 +55,28 @@ static void print_zkrb_instance_data(struct zkrb_instance_data* ptr) {
55
55
  fprintf(stderr, "}\n");
56
56
  }
57
57
 
58
- static VALUE method_init(VALUE self, VALUE hostPort) {
58
+ static VALUE method_init(int argc, VALUE* argv, VALUE self) {
59
+ VALUE hostPort;
60
+ VALUE options;
61
+ rb_scan_args(argc, argv, "11", &hostPort, &options);
62
+
63
+ if (NIL_P(options)) {
64
+ options = rb_hash_new();
65
+ } else {
66
+ Check_Type(options, T_HASH);
67
+ }
68
+
59
69
  Check_Type(hostPort, T_STRING);
60
70
 
71
+ // Look up :zkc_log_level
72
+ VALUE log_level = rb_hash_aref(options, ID2SYM(rb_intern("zkc_log_level")));
73
+ if (NIL_P(log_level)) {
74
+ zoo_set_debug_level(0); // no log messages
75
+ } else {
76
+ Check_Type(log_level, T_FIXNUM);
77
+ zoo_set_debug_level(log_level);
78
+ }
79
+
61
80
  VALUE data;
62
81
  struct zkrb_instance_data *zk_local_ctx = NULL;
63
82
  data = Data_Make_Struct(Zookeeper,
@@ -66,10 +85,9 @@ static VALUE method_init(VALUE self, VALUE hostPort) {
66
85
  free_zkrb_instance_data,
67
86
  zk_local_ctx);
68
87
  zk_local_ctx->queue = zkrb_queue_alloc();
69
-
70
- zoo_set_debug_level(ZOO_LOG_LEVEL_INFO);
88
+
71
89
  zoo_deterministic_conn_order(0);
72
-
90
+
73
91
  zkrb_calling_context *ctx =
74
92
  zkrb_calling_context_alloc(ZKRB_GLOBAL_REQ, zk_local_ctx->queue);
75
93
 
@@ -440,7 +458,7 @@ static void zkrb_define_methods(void) {
440
458
  #define DEFINE_CLASS_METHOD(method, args) { \
441
459
  rb_define_singleton_method(Zookeeper, #method, method_ ## method, args); }
442
460
 
443
- DEFINE_METHOD(init, 1);
461
+ DEFINE_METHOD(init, -1);
444
462
  DEFINE_METHOD(get_children, 4);
445
463
  DEFINE_METHOD(exists, 4);
446
464
  DEFINE_METHOD(create, 6);
data/zookeeper.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{zookeeper}
5
- s.version = "0.4.1"
5
+ s.version = "0.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Phillip Pearson, Eric Maland, Evan Weaver, Brian Wickman"]
9
- s.date = %q{2010-12-14}
9
+ s.date = %q{2011-01-06}
10
10
  s.description = %q{An interface to the Zookeeper distributed configuration server.}
11
11
  s.email = %q{}
12
12
  s.extensions = ["ext/extconf.rb"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zookeeper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Phillip Pearson, Eric Maland, Evan Weaver, Brian Wickman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-14 00:00:00 -08:00
18
+ date: 2011-01-06 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21