Class ODistributedConfiguration

java.lang.Object
com.orientechnologies.orient.server.distributed.ODistributedConfiguration
Direct Known Subclasses:
OModifiableDistributedConfiguration

public class ODistributedConfiguration extends Object
Immutable Distributed configuration. It uses an ODocument object to store the configuration. Every changes must be done by obtaining a modifiable verson of the object through the method `modify()`.
Author:
Luca Garulli (l.garulli--(at)--orientdb.com)
  • Field Details

  • Constructor Details

    • ODistributedConfiguration

      public ODistributedConfiguration(ODocument iConfiguration)
  • Method Details

    • modify

    • isReplicationActive

      public boolean isReplicationActive(String iClusterName, String iLocalNode)
      Returns true if the replication is active, otherwise false.
      Parameters:
      iClusterName - Cluster name, or null for *
    • hasDataCenterConfiguration

      public boolean hasDataCenterConfiguration()
      Returns true if the configuration per data centers is specified.
    • isAutoDeploy

      public boolean isAutoDeploy()
    • getNewNodeStrategy

      public ODistributedConfiguration.NEW_NODE_STRATEGIES getNewNodeStrategy()
      Returns the new node strategy between "dynamic" and "static". If static, the node is registered under the "server" tag.
      Returns:
      NEW_NODE_STRATEGIES enum
    • isExecutionModeSynchronous

      public Boolean isExecutionModeSynchronous(String iClusterName)
      Returns the execution mode if synchronous.
      Parameters:
      iClusterName - Cluster name, or null for *
      Returns:
      true = synchronous, false = asynchronous, null = undefined
    • isReadYourWrites

      public Boolean isReadYourWrites(String iClusterName)
      Reads your writes.
      Parameters:
      iClusterName - Cluster name, or null for *
    • getServerClusterMap

      public Map<String,Collection<String>> getServerClusterMap(Collection<String> iClusterNames, String iLocalNode, boolean optimizeForLocalOnly)
      Returns the list of servers that can manage a list of clusters. The algorithm makes its best to involve the less servers as it can.
      Parameters:
      iClusterNames - Set of cluster names to find
      iLocalNode - Local node name
    • getOwnedClustersByServer

      public List<String> getOwnedClustersByServer(Collection<String> iClusterNames, String iNode)
      Returns the clusters where a server is owner. This is used when a cluster must be selected: locality is always the best choice.
      Parameters:
      iClusterNames - Set of cluster names
      iNode - Node
    • getServers

      public Set<String> getServers(Collection<String> iClusterNames)
      Returns the set of server names involved on the passed cluster collection.
      Parameters:
      iClusterNames - Collection of cluster names to find
    • getServers

      public Set<String> getServers()
    • isServerContainingAllClusters

      public boolean isServerContainingAllClusters(String server, Collection<String> clusters)
      Returns true if the local server has all the requested clusters.
      Parameters:
      server - Server name
      clusters - Collection of cluster names to find
    • isServerContainingCluster

      public boolean isServerContainingCluster(String server, String cluster)
      Returns true if the local server has the requested cluster.
      Parameters:
      server - Server name
      cluster - cluster names to find
    • getServers

      public List<String> getServers(String iClusterName, String iExclude)
      Returns the server list for the requested cluster cluster excluding any tags like and iExclude if any.
      Parameters:
      iClusterName - Cluster name, or null for *
      iExclude - Node to exclude
    • getMasterServers

      public List<String> getMasterServers()
      Returns an ordered list of master server. The first in the list is the first found in configuration. This is used to determine the cluster leader.
    • getAllConfiguredServers

      public Set<String> getAllConfiguredServers()
      Returns the complete list of servers found in configuration.
    • getClustersOwnedByServer

      public Set<String> getClustersOwnedByServer(String iNodeName)
      Returns the set of clusters where server is the owner.
      Parameters:
      iNodeName - Server name
    • getClusterOwner

      public String getClusterOwner(String iClusterName)
      Returns the owner server for the given cluster excluding the passed node. The Owner server is the first in server list.
      Parameters:
      iClusterName - Cluster name, or null for *
    • getConfiguredClusterOwner

      public String getConfiguredClusterOwner(String iClusterName)
      Returns the static owner server for the given cluster.
      Parameters:
      iClusterName - Cluster name, or null for *
    • getConfiguredServers

      public List<String> getConfiguredServers(String iClusterName)
      Returns the configured server list for the requested cluster.
      Parameters:
      iClusterName - Cluster name, or null for *
    • getClusterNames

      public String[] getClusterNames()
      Returns the array of configured clusters
    • getDefaultServerRole

      public ODistributedConfiguration.ROLES getDefaultServerRole()
      Returns the default server role between MASTER (default) and REPLICA.
    • getServerRole

      public ODistributedConfiguration.ROLES getServerRole(String iServerName)
      Returns the server role between MASTER (default) and REPLICA.
    • getRegisteredServers

      public Set<String> getRegisteredServers()
      Returns the registered servers.
    • getDocument

      public ODocument getDocument()
    • getDataCenters

      public Set<String> getDataCenters()
      Returns all the configured data centers' names, if any.
    • getDataCenterWriteQuorum

      public int getDataCenterWriteQuorum(String dataCenter)
      Returns the data center write quorum.
      Parameters:
      dataCenter - Data center name
    • getDataCenterServers

      public List<String> getDataCenterServers(String dataCenter)
      Returns the list of servers in a data center.
      Parameters:
      dataCenter - Data center name
      Throws:
      OConfigurationException - if the list of servers is not found in data center configuration
    • getDataCenterOfServer

      public String getDataCenterOfServer(String server)
      Returns the data center where the server belongs.
      Parameters:
      server - Server name
    • getVersion

      public int getVersion()
    • isLocalDataCenterWriteQuorum

      public boolean isLocalDataCenterWriteQuorum()
      Returns true if the global write quorum is "localDataCenter".
    • getGlobalReadQuorum

      public Object getGlobalReadQuorum(String iClusterName)
      Returns the global read quorum.
      Parameters:
      iClusterName - Cluster name, or null for *
    • getReadQuorum

      public int getReadQuorum(int totalConfiguredServers, String server)
      Returns the read quorum.
      Parameters:
      totalConfiguredServers - Total node available
    • getWriteQuorum

      public int getWriteQuorum(int totalConfiguredMasterServers, String server)
      Returns the write quorum.
      Parameters:
      totalConfiguredMasterServers - Total node available
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getClusterConfiguration

      protected ODocument getClusterConfiguration(String iClusterName)
      Gets the document representing the cluster configuration.
      Parameters:
      iClusterName - Cluster name, or null for *
      Returns:
      Always a ODocument
      Throws:
      OConfigurationException - in case "clusters" field is not found in configuration
    • forceWriteQuorum

      public void forceWriteQuorum(int quorum)
    • clearForceWriteQuorum

      public void clearForceWriteQuorum()