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

io.lettuce.core.masterreplica.TopologyProvider Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
package io.lettuce.core.masterreplica;

import java.util.List;
import java.util.concurrent.CompletableFuture;

import io.lettuce.core.RedisException;
import io.lettuce.core.models.role.RedisNodeDescription;

/**
 * Topology provider for Master-Replica topology discovery during runtime. Implementors of this interface return an unordered
 * list of {@link RedisNodeDescription} instances.
 *
 * @author Mark Paluch
 * @since 4.1
 */
@FunctionalInterface
interface TopologyProvider {

    /**
     * Lookup nodes within the topology.
     *
     * @return list of {@link RedisNodeDescription} instances
     * @throws RedisException on errors that occurred during the lookup
     */
    List getNodes();

    /**
     * Lookup nodes asynchronously within the topology.
     *
     * @return list of {@link RedisNodeDescription} instances
     * @throws RedisException on errors that occurred during the lookup
     * @since 5.1
     */
    default CompletableFuture> getNodesAsync() {
        return CompletableFuture.completedFuture(getNodes());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy