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

org.postgresql.hostchooser.HostRequirement Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version
/*
 * Copyright (c) 2014, PostgreSQL Global Development Group
 * See the LICENSE file in the project root for more information.
 */

package org.postgresql.hostchooser;

/**
 * Describes the required server type.
 */
public enum HostRequirement {
  any {
    public boolean allowConnectingTo(HostStatus status) {
      return status != HostStatus.ConnectFail;
    }
  },
  master {
    public boolean allowConnectingTo(HostStatus status) {
      return status == HostStatus.Master || status == HostStatus.ConnectOK;
    }
  },
  slave {
    public boolean allowConnectingTo(HostStatus status) {
      return status == HostStatus.Slave || status == HostStatus.ConnectOK;
    }
  },
  preferSlave {
    public boolean allowConnectingTo(HostStatus status) {
      return status != HostStatus.ConnectFail;
    }
  };

  public abstract boolean allowConnectingTo(HostStatus status);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy