io.github.mfvanek.pg.connection.PgHost Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pg-index-health-jdbc-connection Show documentation
Show all versions of pg-index-health-jdbc-connection Show documentation
pg-index-health-jdbc-connection is an abstraction of a connection to a high availability PostgreSQL cluster.
The newest version!
/*
* Copyright (c) 2019-2024. Ivan Vakhrushev and others.
* https://github.com/mfvanek/pg-index-health
*
* This file is a part of "pg-index-health" - a Java library for
* analyzing and maintaining indexes health in PostgreSQL databases.
*
* Licensed under the Apache License 2.0
*/
package io.github.mfvanek.pg.connection;
import javax.annotation.Nonnull;
/**
* An abstraction of database host.
*
* This is a real server where your queries will be executed.
*
*
* @author Ivan Vakhrushev
*/
public interface PgHost {
/**
* Gets a valid connection string to this host.
*
* @return connection url to the host
*/
@Nonnull
String getPgUrl();
/**
* Gets the name of this host.
*
* @return host name
*/
@Nonnull
String getName();
/**
* Gets the port of this host.
*
* @return port
*/
int getPort();
/**
* Determines whether this host can be a primary host.
*
* @return {@code true} if this host can be a primary host
*/
boolean canBePrimary();
default boolean cannotBePrimary() {
return !canBePrimary();
}
}