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

Interface for sentinel commands

## 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`)

    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

### + (`::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`)

    36
    37
    38
    39
    40
    41
    42
    43
    # 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) && !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

    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.

Parameters:

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

Yields:

- Handler for the result of this call

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

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

    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`)

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

    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