Class List Method List File List

# 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

This factory is deprecated use Redis instead, or for a typed API RedisAPI.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxRedis::RedisSentinel) create(vertx = nil, config = nil)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (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.
- - (void) close { ... }
  Close the client - when it is fully closed the handler will be called.
- - (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).
- - (self) flush_config { ... }
  Force Sentinel to rewrite its configuration on disk, including the current Sentinel state.
- - (self) get_master_addr_by_name(name = nil) { ... }
  Return the ip and port number of the master with that name.
- - (self) master(name = nil) { ... }
  Show the state and info of the specified master.
- - (self) masters { ... }
  Show a list of monitored masters and their state.
- - (self) reset(pattern = nil) { ... }
  Reset all the masters with matching name.
- - (self) sentinels(name = nil) { ... }
  Show a list of sentinel instances for this master, and their state.
- - (self) slaves(name = nil) { ... }
  Show a list of slaves for this master, and their state.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 19

    def @@j_api_type.accept?(obj)
      obj.class == RedisSentinel
    end

### + (`::VertxRedis::RedisSentinel`) create(vertx = nil, config = nil)

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- config (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`::VertxRedis::RedisSentinel`)

Raises:

- (`ArgumentError`)

    37
    38
    39
    40
    41
    42
    43
    44
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 37

    def self.create(vertx=nil,config=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && config == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxRedisSentinel::RedisSentinel.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxRedis::RedisSentinel)
      elsif 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::IoVertxCoreJson::JsonObject.java_class]).call(vertx.j_del,::Vertx::Util::Utils.to_json_object(config)),::VertxRedis::RedisSentinel)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{config})"
    end

### + (`Object`) j_api_type

    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 28

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    31
    32
    33
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 31

    def self.j_class
      Java::IoVertxRedisSentinel::RedisSentinel.java_class
    end

### + (`Object`) unwrap(obj)

    25
    26
    27
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 25

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    22
    23
    24
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 22

    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.

Parameters:

- name (`String`) (defaults to: `nil`) —
  master name

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    142
    143
    144
    145
    146
    147
    148
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 142

    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.

Yields:

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 48

    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)

Parameters:

- name (`String`) (defaults to: `nil`) —
  master name

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    129
    130
    131
    132
    133
    134
    135
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 129

    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.

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    158
    159
    160
    161
    162
    163
    164
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 158

    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

Parameters:

- name (`String`) (defaults to: `nil`) —
  master name

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    103
    104
    105
    106
    107
    108
    109
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 103

    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

Parameters:

- name (`String`) (defaults to: `nil`) —
  master name

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    68
    69
    70
    71
    72
    73
    74
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 68

    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

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    57
    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 57

    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

Parameters:

- pattern (`String`) (defaults to: `nil`) —
  pattern String

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    116
    117
    118
    119
    120
    121
    122
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 116

    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

Parameters:

- name (`String`) (defaults to: `nil`) —
  master name

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    90
    91
    92
    93
    94
    95
    96
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 90

    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

Parameters:

- name (`String`) (defaults to: `nil`) —
  master name

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/redis_sentinel.rb', line 79

    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