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

org.voltdb.catalog.Cluster Maven / Gradle / Ivy

There is a newer version: 10.1.1
Show newest version
/* This file is part of VoltDB.
 * Copyright (C) 2008-2020 VoltDB Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with VoltDB.  If not, see .
 */

/* WARNING: THIS FILE IS AUTO-GENERATED
            DO NOT MODIFY THIS SOURCE
            ALL CHANGES MUST BE MADE IN THE CATALOG GENERATOR */

package org.voltdb.catalog;

/**
 * A set of connected hosts running one or more database application contexts
 */
public class Cluster extends CatalogType {

    CatalogMap m_databases;
    CatalogMap m_deployment;
    int m_localepoch;
    boolean m_securityEnabled;
    int m_httpdportno;
    boolean m_jsonapi;
    boolean m_networkpartition;
    CatalogMap m_logconfig;
    int m_heartbeatTimeout;
    boolean m_useddlschema;
    boolean m_drConsumerEnabled;
    boolean m_drProducerEnabled;
    String m_drRole = new String();
    int m_drClusterId;
    int m_drProducerPort;
    String m_drMasterHost = new String();
    String m_drConsumerSslPropertyFile = new String();
    int m_globalFlushInterval;
    int m_drFlushInterval;
    int m_exportFlushInterval;
    int m_preferredSource;

    @Override
    void initChildMaps() {
        m_databases = new CatalogMap(getCatalog(), this, "databases", Database.class, m_parentMap.m_depth + 1);
        m_deployment = new CatalogMap(getCatalog(), this, "deployment", Deployment.class, m_parentMap.m_depth + 1);
        m_logconfig = new CatalogMap(getCatalog(), this, "logconfig", CommandLog.class, m_parentMap.m_depth + 1);
    }

    public String[] getFields() {
        return new String[] {
            "localepoch",
            "securityEnabled",
            "httpdportno",
            "jsonapi",
            "networkpartition",
            "heartbeatTimeout",
            "useddlschema",
            "drConsumerEnabled",
            "drProducerEnabled",
            "drRole",
            "drClusterId",
            "drProducerPort",
            "drMasterHost",
            "drConsumerSslPropertyFile",
            "globalFlushInterval",
            "drFlushInterval",
            "exportFlushInterval",
            "preferredSource",
        };
    };

    String[] getChildCollections() {
        return new String[] {
            "databases",
            "deployment",
            "logconfig",
        };
    };

    public Object getField(String field) {
        switch (field) {
        case "databases":
            return getDatabases();
        case "deployment":
            return getDeployment();
        case "localepoch":
            return getLocalepoch();
        case "securityEnabled":
            return getSecurityenabled();
        case "httpdportno":
            return getHttpdportno();
        case "jsonapi":
            return getJsonapi();
        case "networkpartition":
            return getNetworkpartition();
        case "logconfig":
            return getLogconfig();
        case "heartbeatTimeout":
            return getHeartbeattimeout();
        case "useddlschema":
            return getUseddlschema();
        case "drConsumerEnabled":
            return getDrconsumerenabled();
        case "drProducerEnabled":
            return getDrproducerenabled();
        case "drRole":
            return getDrrole();
        case "drClusterId":
            return getDrclusterid();
        case "drProducerPort":
            return getDrproducerport();
        case "drMasterHost":
            return getDrmasterhost();
        case "drConsumerSslPropertyFile":
            return getDrconsumersslpropertyfile();
        case "globalFlushInterval":
            return getGlobalflushinterval();
        case "drFlushInterval":
            return getDrflushinterval();
        case "exportFlushInterval":
            return getExportflushinterval();
        case "preferredSource":
            return getPreferredsource();
        default:
            throw new CatalogException("Unknown field");
        }
    }

    /** GETTER: The set of databases the cluster is running */
    public CatalogMap getDatabases() {
        return m_databases;
    }

    /** GETTER: Storage for settings passed in on deployment */
    public CatalogMap getDeployment() {
        return m_deployment;
    }

    /** GETTER: The number of seconds since the epoch that we're calling our local epoch */
    public int getLocalepoch() {
        return m_localepoch;
    }

    /** GETTER: Whether security and authentication should be enabled/disabled */
    public boolean getSecurityenabled() {
        return m_securityEnabled;
    }

    /** GETTER: The port number httpd will listen on. A 0 value implies 8080. */
    public int getHttpdportno() {
        return m_httpdportno;
    }

    /** GETTER: Is the http/json interface enabled? */
    public boolean getJsonapi() {
        return m_jsonapi;
    }

    /** GETTER: Is network partition detection enabled? */
    public boolean getNetworkpartition() {
        return m_networkpartition;
    }

    /** GETTER: Command log configuration */
    public CatalogMap getLogconfig() {
        return m_logconfig;
    }

    /** GETTER: How long to wait, in seconds, between messages before deciding a host is dead */
    public int getHeartbeattimeout() {
        return m_heartbeatTimeout;
    }

    /** GETTER: Manage the database schemas via catalog updates or live DDL */
    public boolean getUseddlschema() {
        return m_useddlschema;
    }

    /** GETTER: Manage whether this consumer cluster will pull local DR transactions */
    public boolean getDrconsumerenabled() {
        return m_drConsumerEnabled;
    }

    /** GETTER: Manage whether this producer cluster will log and distribute local DR transactions */
    public boolean getDrproducerenabled() {
        return m_drProducerEnabled;
    }

    /** GETTER: DR role of the cluster, can be master, replica, or xdcr */
    public String getDrrole() {
        return m_drRole;
    }

    /** GETTER: Unique inter-cluster ID used to distinguish DR clusters */
    public int getDrclusterid() {
        return m_drClusterId;
    }

    /** GETTER: DR port the this producer cluster will listen on (change only when !drProdEnabled) */
    public int getDrproducerport() {
        return m_drProducerPort;
    }

    /** GETTER: Hostname[:port] of producer cluster this consumer cluster will get transactions from */
    public String getDrmasterhost() {
        return m_drMasterHost;
    }

    /** GETTER: Path to DR consumer property file containing path to trust store and the trust store password */
    public String getDrconsumersslpropertyfile() {
        return m_drConsumerSslPropertyFile;
    }

    /** GETTER: Time interval in milliseconds between flushing either DR or Export buffers */
    public int getGlobalflushinterval() {
        return m_globalFlushInterval;
    }

    /** GETTER: Time interval in milliseconds between flushing partially filled DR buffers (depends on globalFlushInterval) */
    public int getDrflushinterval() {
        return m_drFlushInterval;
    }

    /** GETTER: Time interval in milliseconds between flushing partially filled Export buffers (depends on globalFlushInterval) */
    public int getExportflushinterval() {
        return m_exportFlushInterval;
    }

    /** GETTER: The cluster id from which this joining cluster should request snapshot */
    public int getPreferredsource() {
        return m_preferredSource;
    }

    /** SETTER: The number of seconds since the epoch that we're calling our local epoch */
    public void setLocalepoch(int value) {
        m_localepoch = value;
    }

    /** SETTER: Whether security and authentication should be enabled/disabled */
    public void setSecurityenabled(boolean value) {
        m_securityEnabled = value;
    }

    /** SETTER: The port number httpd will listen on. A 0 value implies 8080. */
    public void setHttpdportno(int value) {
        m_httpdportno = value;
    }

    /** SETTER: Is the http/json interface enabled? */
    public void setJsonapi(boolean value) {
        m_jsonapi = value;
    }

    /** SETTER: Is network partition detection enabled? */
    public void setNetworkpartition(boolean value) {
        m_networkpartition = value;
    }

    /** SETTER: How long to wait, in seconds, between messages before deciding a host is dead */
    public void setHeartbeattimeout(int value) {
        m_heartbeatTimeout = value;
    }

    /** SETTER: Manage the database schemas via catalog updates or live DDL */
    public void setUseddlschema(boolean value) {
        m_useddlschema = value;
    }

    /** SETTER: Manage whether this consumer cluster will pull local DR transactions */
    public void setDrconsumerenabled(boolean value) {
        m_drConsumerEnabled = value;
    }

    /** SETTER: Manage whether this producer cluster will log and distribute local DR transactions */
    public void setDrproducerenabled(boolean value) {
        m_drProducerEnabled = value;
    }

    /** SETTER: DR role of the cluster, can be master, replica, or xdcr */
    public void setDrrole(String value) {
        m_drRole = value;
    }

    /** SETTER: Unique inter-cluster ID used to distinguish DR clusters */
    public void setDrclusterid(int value) {
        m_drClusterId = value;
    }

    /** SETTER: DR port the this producer cluster will listen on (change only when !drProdEnabled) */
    public void setDrproducerport(int value) {
        m_drProducerPort = value;
    }

    /** SETTER: Hostname[:port] of producer cluster this consumer cluster will get transactions from */
    public void setDrmasterhost(String value) {
        m_drMasterHost = value;
    }

    /** SETTER: Path to DR consumer property file containing path to trust store and the trust store password */
    public void setDrconsumersslpropertyfile(String value) {
        m_drConsumerSslPropertyFile = value;
    }

    /** SETTER: Time interval in milliseconds between flushing either DR or Export buffers */
    public void setGlobalflushinterval(int value) {
        m_globalFlushInterval = value;
    }

    /** SETTER: Time interval in milliseconds between flushing partially filled DR buffers (depends on globalFlushInterval) */
    public void setDrflushinterval(int value) {
        m_drFlushInterval = value;
    }

    /** SETTER: Time interval in milliseconds between flushing partially filled Export buffers (depends on globalFlushInterval) */
    public void setExportflushinterval(int value) {
        m_exportFlushInterval = value;
    }

    /** SETTER: The cluster id from which this joining cluster should request snapshot */
    public void setPreferredsource(int value) {
        m_preferredSource = value;
    }

    @Override
    void set(String field, String value) {
        if ((field == null) || (value == null)) {
            throw new CatalogException("Null value where it shouldn't be.");
        }

        switch (field) {
        case "localepoch":
            assert(value != null);
            m_localepoch = Integer.parseInt(value);
            break;
        case "securityEnabled":
            assert(value != null);
            m_securityEnabled = Boolean.parseBoolean(value);
            break;
        case "httpdportno":
            assert(value != null);
            m_httpdportno = Integer.parseInt(value);
            break;
        case "jsonapi":
            assert(value != null);
            m_jsonapi = Boolean.parseBoolean(value);
            break;
        case "networkpartition":
            assert(value != null);
            m_networkpartition = Boolean.parseBoolean(value);
            break;
        case "heartbeatTimeout":
            assert(value != null);
            m_heartbeatTimeout = Integer.parseInt(value);
            break;
        case "useddlschema":
            assert(value != null);
            m_useddlschema = Boolean.parseBoolean(value);
            break;
        case "drConsumerEnabled":
            assert(value != null);
            m_drConsumerEnabled = Boolean.parseBoolean(value);
            break;
        case "drProducerEnabled":
            assert(value != null);
            m_drProducerEnabled = Boolean.parseBoolean(value);
            break;
        case "drRole":
            value = value.trim();
            if (value.startsWith("null")) value = null;
            if (value != null) {
                assert(value.startsWith("\"") && value.endsWith("\""));
                value = value.substring(1, value.length() - 1);
            }
            m_drRole = value;
            break;
        case "drClusterId":
            assert(value != null);
            m_drClusterId = Integer.parseInt(value);
            break;
        case "drProducerPort":
            assert(value != null);
            m_drProducerPort = Integer.parseInt(value);
            break;
        case "drMasterHost":
            value = value.trim();
            if (value.startsWith("null")) value = null;
            if (value != null) {
                assert(value.startsWith("\"") && value.endsWith("\""));
                value = value.substring(1, value.length() - 1);
            }
            m_drMasterHost = value;
            break;
        case "drConsumerSslPropertyFile":
            value = value.trim();
            if (value.startsWith("null")) value = null;
            if (value != null) {
                assert(value.startsWith("\"") && value.endsWith("\""));
                value = value.substring(1, value.length() - 1);
            }
            m_drConsumerSslPropertyFile = value;
            break;
        case "globalFlushInterval":
            assert(value != null);
            m_globalFlushInterval = Integer.parseInt(value);
            break;
        case "drFlushInterval":
            assert(value != null);
            m_drFlushInterval = Integer.parseInt(value);
            break;
        case "exportFlushInterval":
            assert(value != null);
            m_exportFlushInterval = Integer.parseInt(value);
            break;
        case "preferredSource":
            assert(value != null);
            m_preferredSource = Integer.parseInt(value);
            break;
        default:
            throw new CatalogException("Unknown field");
        }
    }

    @Override
    public void copyFields(CatalogType obj) {
        // this is safe from the caller
        Cluster other = (Cluster) obj;

        other.m_databases.copyFrom(m_databases);
        other.m_deployment.copyFrom(m_deployment);
        other.m_localepoch = m_localepoch;
        other.m_securityEnabled = m_securityEnabled;
        other.m_httpdportno = m_httpdportno;
        other.m_jsonapi = m_jsonapi;
        other.m_networkpartition = m_networkpartition;
        other.m_logconfig.copyFrom(m_logconfig);
        other.m_heartbeatTimeout = m_heartbeatTimeout;
        other.m_useddlschema = m_useddlschema;
        other.m_drConsumerEnabled = m_drConsumerEnabled;
        other.m_drProducerEnabled = m_drProducerEnabled;
        other.m_drRole = m_drRole;
        other.m_drClusterId = m_drClusterId;
        other.m_drProducerPort = m_drProducerPort;
        other.m_drMasterHost = m_drMasterHost;
        other.m_drConsumerSslPropertyFile = m_drConsumerSslPropertyFile;
        other.m_globalFlushInterval = m_globalFlushInterval;
        other.m_drFlushInterval = m_drFlushInterval;
        other.m_exportFlushInterval = m_exportFlushInterval;
        other.m_preferredSource = m_preferredSource;
    }

    public boolean equals(Object obj) {
        // this isn't really the convention for null handling
        if ((obj == null) || (obj.getClass().equals(getClass()) == false))
            return false;

        // Do the identity check
        if (obj == this)
            return true;

        // this is safe because of the class check
        // it is also known that the childCollections var will be the same
        //  from the class check
        Cluster other = (Cluster) obj;

        // are the fields / children the same? (deep compare)
        if ((m_databases == null) != (other.m_databases == null)) return false;
        if ((m_databases != null) && !m_databases.equals(other.m_databases)) return false;
        if ((m_deployment == null) != (other.m_deployment == null)) return false;
        if ((m_deployment != null) && !m_deployment.equals(other.m_deployment)) return false;
        if (m_localepoch != other.m_localepoch) return false;
        if (m_securityEnabled != other.m_securityEnabled) return false;
        if (m_httpdportno != other.m_httpdportno) return false;
        if (m_jsonapi != other.m_jsonapi) return false;
        if (m_networkpartition != other.m_networkpartition) return false;
        if ((m_logconfig == null) != (other.m_logconfig == null)) return false;
        if ((m_logconfig != null) && !m_logconfig.equals(other.m_logconfig)) return false;
        if (m_heartbeatTimeout != other.m_heartbeatTimeout) return false;
        if (m_useddlschema != other.m_useddlschema) return false;
        if (m_drConsumerEnabled != other.m_drConsumerEnabled) return false;
        if (m_drProducerEnabled != other.m_drProducerEnabled) return false;
        if ((m_drRole == null) != (other.m_drRole == null)) return false;
        if ((m_drRole != null) && !m_drRole.equals(other.m_drRole)) return false;
        if (m_drClusterId != other.m_drClusterId) return false;
        if (m_drProducerPort != other.m_drProducerPort) return false;
        if ((m_drMasterHost == null) != (other.m_drMasterHost == null)) return false;
        if ((m_drMasterHost != null) && !m_drMasterHost.equals(other.m_drMasterHost)) return false;
        if ((m_drConsumerSslPropertyFile == null) != (other.m_drConsumerSslPropertyFile == null)) return false;
        if ((m_drConsumerSslPropertyFile != null) && !m_drConsumerSslPropertyFile.equals(other.m_drConsumerSslPropertyFile)) return false;
        if (m_globalFlushInterval != other.m_globalFlushInterval) return false;
        if (m_drFlushInterval != other.m_drFlushInterval) return false;
        if (m_exportFlushInterval != other.m_exportFlushInterval) return false;
        if (m_preferredSource != other.m_preferredSource) return false;

        return true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy