All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.rxjava.redis.sentinel.RedisSentinel Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava.redis.sentinel;

import java.util.Map;
import rx.Observable;
import rx.Single;
import io.vertx.core.json.JsonArray;
import io.vertx.redis.RedisOptions;
import io.vertx.rxjava.core.Vertx;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

/**
 * Interface for sentinel commands
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.redis.sentinel.RedisSentinel original} non RX-ified interface using Vert.x codegen. */ @io.vertx.lang.rxjava.RxGen(io.vertx.redis.sentinel.RedisSentinel.class) public class RedisSentinel { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RedisSentinel that = (RedisSentinel) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.rxjava.TypeArg __TYPE_ARG = new io.vertx.lang.rxjava.TypeArg<>( obj -> new RedisSentinel((io.vertx.redis.sentinel.RedisSentinel) obj), RedisSentinel::getDelegate ); private final io.vertx.redis.sentinel.RedisSentinel delegate; public RedisSentinel(io.vertx.redis.sentinel.RedisSentinel delegate) { this.delegate = delegate; } public io.vertx.redis.sentinel.RedisSentinel getDelegate() { return delegate; } public static RedisSentinel create(Vertx vertx, RedisOptions config) { RedisSentinel ret = RedisSentinel.newInstance(io.vertx.redis.sentinel.RedisSentinel.create(vertx.getDelegate(), config)); return ret; } /** * Close the client - when it is fully closed the handler will be called. * @param handler */ public void close(Handler> handler) { delegate.close(handler); } /** * Close the client - when it is fully closed the handler will be called. * @return * @deprecated use {@link #rxClose} instead */ @Deprecated() public Observable closeObservable() { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); close(handler.toHandler()); return handler; } /** * Close the client - when it is fully closed the handler will be called. * @return */ public Single rxClose() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { close(fut); })); } /** * Show a list of monitored masters and their state * @param handler Handler for the result of this call * @return */ public RedisSentinel masters(Handler> handler) { delegate.masters(handler); return this; } /** * Show a list of monitored masters and their state * @return * @deprecated use {@link #rxMasters} instead */ @Deprecated() public Observable mastersObservable() { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); masters(handler.toHandler()); return handler; } /** * Show a list of monitored masters and their state * @return */ public Single rxMasters() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { masters(fut); })); } /** * Show the state and info of the specified master * @param name master name * @param handler Handler for the result of this call * @return */ public RedisSentinel master(String name, Handler> handler) { delegate.master(name, handler); return this; } /** * Show the state and info of the specified master * @param name master name * @return * @deprecated use {@link #rxMaster} instead */ @Deprecated() public Observable masterObservable(String name) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); master(name, handler.toHandler()); return handler; } /** * Show the state and info of the specified master * @param name master name * @return */ public Single rxMaster(String name) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { master(name, fut); })); } /** * Show a list of slaves for this master, and their state * @param name master name * @param handler Handler for the result of this call * @return */ public RedisSentinel slaves(String name, Handler> handler) { delegate.slaves(name, handler); return this; } /** * Show a list of slaves for this master, and their state * @param name master name * @return * @deprecated use {@link #rxSlaves} instead */ @Deprecated() public Observable slavesObservable(String name) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); slaves(name, handler.toHandler()); return handler; } /** * Show a list of slaves for this master, and their state * @param name master name * @return */ public Single rxSlaves(String name) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { slaves(name, fut); })); } /** * Show a list of sentinel instances for this master, and their state * @param name master name * @param handler Handler for the result of this call * @return */ public RedisSentinel sentinels(String name, Handler> handler) { delegate.sentinels(name, handler); return this; } /** * Show a list of sentinel instances for this master, and their state * @param name master name * @return * @deprecated use {@link #rxSentinels} instead */ @Deprecated() public Observable sentinelsObservable(String name) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); sentinels(name, handler.toHandler()); return handler; } /** * Show a list of sentinel instances for this master, and their state * @param name master name * @return */ public Single rxSentinels(String name) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { sentinels(name, fut); })); } /** * 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 * @param name master name * @param handler Handler for the result of this call * @return */ public RedisSentinel getMasterAddrByName(String name, Handler> handler) { delegate.getMasterAddrByName(name, handler); return this; } /** * 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 * @param name master name * @return * @deprecated use {@link #rxGetMasterAddrByName} instead */ @Deprecated() public Observable getMasterAddrByNameObservable(String name) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); getMasterAddrByName(name, handler.toHandler()); return handler; } /** * 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 * @param name master name * @return */ public Single rxGetMasterAddrByName(String name) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { getMasterAddrByName(name, fut); })); } /** * 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 * @param pattern pattern String * @param handler Handler for the result of this call * @return */ public RedisSentinel reset(String pattern, Handler> handler) { delegate.reset(pattern, handler); return this; } /** * 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 * @param pattern pattern String * @return * @deprecated use {@link #rxReset} instead */ @Deprecated() public Observable resetObservable(String pattern) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); reset(pattern, handler.toHandler()); return handler; } /** * 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 * @param pattern pattern String * @return */ public Single rxReset(String pattern) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { reset(pattern, fut); })); } /** * 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) * @param name master name * @param handler Handler for the result of this call * @return */ public RedisSentinel failover(String name, Handler> handler) { delegate.failover(name, handler); return this; } /** * 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) * @param name master name * @return * @deprecated use {@link #rxFailover} instead */ @Deprecated() public Observable failoverObservable(String name) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); failover(name, handler.toHandler()); return handler; } /** * 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) * @param name master name * @return */ public Single rxFailover(String name) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { failover(name, fut); })); } /** * 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. * @param name master name * @param handler Handler for the result of this call * @return */ public RedisSentinel ckquorum(String name, Handler> handler) { delegate.ckquorum(name, handler); return this; } /** * 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. * @param name master name * @return * @deprecated use {@link #rxCkquorum} instead */ @Deprecated() public Observable ckquorumObservable(String name) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); ckquorum(name, handler.toHandler()); return handler; } /** * 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. * @param name master name * @return */ public Single rxCkquorum(String name) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { ckquorum(name, fut); })); } /** * 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. * @param handler Handler for the result of this call * @return */ public RedisSentinel flushConfig(Handler> handler) { delegate.flushConfig(handler); return this; } /** * 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. * @return * @deprecated use {@link #rxFlushConfig} instead */ @Deprecated() public Observable flushConfigObservable() { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); flushConfig(handler.toHandler()); return handler; } /** * 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. * @return */ public Single rxFlushConfig() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { flushConfig(fut); })); } public static RedisSentinel newInstance(io.vertx.redis.sentinel.RedisSentinel arg) { return arg != null ? new RedisSentinel(arg) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy