Пример #1
0
        /// <summary>
        /// Where we create a new Ketama Server based on the ketama value, add it to the KetamaServers object (which keeps track of the servers),
        /// and we generate the hash values for the server being added.
        /// </summary>
        /// <param name="server">A string array containing the server 'name weight'
        /// Allows for multiple server values to be passed in a time</param>
        public void AddServerConnection(string server)
        {
            string[] serverSplit = server.Split(new char[] { ' ' });
            string   serverName  = serverSplit[0];

            ketamaServers.AddServerToServers(serverName);
            AddHashValuesForServerToContinuum(serverName);
        }
Пример #2
0
 /// <summary>
 /// Where the the server gets added to the continuum.
 /// What happens is the passed in server IP:port string is given a generic name, like 'redis1' or 'redis2.'
 /// Then that generic name gets hashed several number of times (the number of times equal to factor), where the first time the name (e.g. 'redis1')
 /// is hashed the offset is just the default algorithm offset. The next time the generic name is hashed, the hash value from the previous time is used
 /// as the offset (aka salt), so basically the name keeps on getting hashed over and over until we've created the correct number of factor's/replicas.
 /// </summary>
 /// <param name="serverIP">A string array containing the server IP:port.
 /// Allows for multiple IP:port values to be passed in a time</param>
 public void AddServerConnection(string serverIP)
 {
     ketamaServers.AddServerToServers(serverIP);
     AddHashValuesForServerToContinuum(serverIP);
 }