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

io.vertx.reactivex.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.reactivex.redis.sentinel;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.core.json.JsonArray;
import io.vertx.redis.RedisOptions;
import io.vertx.reactivex.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.reactivex.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.reactivex.TypeArg __TYPE_ARG = new io.vertx.lang.reactivex.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 */ public Completable rxClose() { return new io.vertx.reactivex.core.impl.AsyncResultCompletable(handler -> { close(handler); }); } /** * 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 */ public Single rxMasters() { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { masters(handler); }); } /** * 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 */ public Single rxMaster(String name) { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { master(name, handler); }); } /** * 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 */ public Single rxSlaves(String name) { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { slaves(name, handler); }); } /** * 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 */ public Single rxSentinels(String name) { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { sentinels(name, 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 * @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 */ public Single rxGetMasterAddrByName(String name) { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { getMasterAddrByName(name, 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 * @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 */ public Completable rxReset(String pattern) { return new io.vertx.reactivex.core.impl.AsyncResultCompletable(handler -> { reset(pattern, 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 * @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 */ public Single rxFailover(String name) { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { failover(name, 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 * @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 */ public Single rxCkquorum(String name) { return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> { ckquorum(name, 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. * @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 */ public Completable rxFlushConfig() { return new io.vertx.reactivex.core.impl.AsyncResultCompletable(handler -> { flushConfig(handler); }); } public static RedisSentinel newInstance(io.vertx.redis.sentinel.RedisSentinel arg) { return arg != null ? new RedisSentinel(arg) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy