Class: VertxRedis::RedisSentinel
- Inherits:
-
Object
- Object
- VertxRedis::RedisSentinel
show all
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb
Overview
Interface for sentinel commands
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Class Method Details
+ (Boolean) accept?(obj)
18
19
20
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 18
def @@j_api_type.accept?(obj)
obj.class == RedisSentinel
end
|
36
37
38
39
40
41
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 36
def self.create(vertx=nil,config=nil)
if vertx.class.method_defined?(:j_del) && config.class == Hash && !block_given?
return ::Vertx::Util::Utils.safe_create(Java::IoVertxRedisSentinel::RedisSentinel.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxRedis::RedisOptions.java_class]).call(vertx.j_del,Java::IoVertxRedis::RedisOptions.new(::Vertx::Util::Utils.to_json_object(config))),::VertxRedis::RedisSentinel)
end
raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{config})"
end
|
+ (Object) j_api_type
27
28
29
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 27
def self.j_api_type
@@j_api_type
end
|
+ (Object) j_class
30
31
32
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 30
def self.j_class
Java::IoVertxRedisSentinel::RedisSentinel.java_class
end
|
+ (Object) unwrap(obj)
24
25
26
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 24
def @@j_api_type.unwrap(obj)
obj.j_del
end
|
+ (Object) wrap(obj)
21
22
23
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 21
def @@j_api_type.wrap(obj)
RedisSentinel.new(obj)
end
|
Instance Method Details
- (self) ckquorum(name = nil) { ... }
Check if the current Sentinel configuration is able to reach the quorum needed to failover a master,
and the majority needed to authorize the failover. This command should be used in monitoring systems
to check if a Sentinel deployment is ok.
139
140
141
142
143
144
145
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 139
def ckquorum(name=nil)
if name.class == String && block_given?
@j_del.java_method(:ckquorum, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling ckquorum(#{name})"
end
|
- (void) close { ... }
This method returns an undefined value.
Close the client - when it is fully closed the handler will be called.
45
46
47
48
49
50
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 45
def close
if block_given?
return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
end
raise ArgumentError, "Invalid arguments when calling close()"
end
|
- (self) failover(name = nil) { ... }
Force a failover as if the master was not reachable, and without asking for agreement to other Sentinels
(however a new version of the configuration will be published so that the other Sentinels
will update their configurations)
126
127
128
129
130
131
132
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 126
def failover(name=nil)
if name.class == String && block_given?
@j_del.java_method(:failover, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling failover(#{name})"
end
|
- (self) flush_config { ... }
Force Sentinel to rewrite its configuration on disk, including the current Sentinel state.
Normally Sentinel rewrites the configuration every time something changes in its state
(in the context of the subset of the state which is persisted on disk across restart).
However sometimes it is possible that the configuration file is lost because of operation errors,
disk failures, package upgrade scripts or configuration managers. In those cases a way to to force Sentinel to
rewrite the configuration file is handy. This command works even if the previous configuration file
is completely missing.
155
156
157
158
159
160
161
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 155
def flush_config
if block_given?
@j_del.java_method(:flushConfig, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling flush_config()"
end
|
- (self) get_master_addr_by_name(name = nil) { ... }
Return the ip and port number of the master with that name.
If a failover is in progress or terminated successfully for this master
it returns the address and port of the promoted slave
100
101
102
103
104
105
106
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 100
def get_master_addr_by_name(name=nil)
if name.class == String && block_given?
@j_del.java_method(:getMasterAddrByName, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling get_master_addr_by_name(#{name})"
end
|
- (self) master(name = nil) { ... }
Show the state and info of the specified master
65
66
67
68
69
70
71
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 65
def master(name=nil)
if name.class == String && block_given?
@j_del.java_method(:master, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling master(#{name})"
end
|
- (self) masters { ... }
Show a list of monitored masters and their state
54
55
56
57
58
59
60
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 54
def masters
if block_given?
@j_del.java_method(:masters, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling masters()"
end
|
- (self) reset(pattern = nil) { ... }
Reset all the masters with matching name.
The pattern argument is a glob-style pattern.
The reset process clears any previous state in a master (including a failover in pro
113
114
115
116
117
118
119
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 113
def reset(pattern=nil)
if pattern.class == String && block_given?
@j_del.java_method(:reset, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(pattern,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling reset(#{pattern})"
end
|
- (self) sentinels(name = nil) { ... }
Show a list of sentinel instances for this master, and their state
87
88
89
90
91
92
93
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 87
def sentinels(name=nil)
if name.class == String && block_given?
@j_del.java_method(:sentinels, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling sentinels(#{name})"
end
|
- (self) slaves(name = nil) { ... }
Show a list of slaves for this master, and their state
76
77
78
79
80
81
82
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 76
def slaves(name=nil)
if name.class == String && block_given?
@j_del.java_method(:slaves, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
return self
end
raise ArgumentError, "Invalid arguments when calling slaves(#{name})"
end
|