Esempio n. 1
0
 /// <summary>
 /// Connect to a cluster
 /// </summary>
 /// <param name="providerName">Provider name is a unique name for the persistence layer 
 /// type, for example: "redis"</param>
 /// <param name="config">Cluster config</param>
 /// <returns></returns>
 public static Unit connect(
     string providerName, 
     ClusterConfig config)
 {
     var cluster = ClusterFactory.CreateCluster(providerName, config);
     cluster.Connect();
     return ActorContext.RegisterCluster(cluster);
 }
Esempio n. 2
0
 /// <summary>
 /// Connect to a cluster
 /// </summary>
 /// <param name="providerName">Provider name is a unique name for the persistence layer 
 /// type, for example: "redis"</param>
 /// <param name="config">Cluster config</param>
 public static ICluster connect(
     string providerName, 
     ClusterConfig config)
 {
     var cluster = ClusterFactory.CreateCluster(providerName, config);
     cluster.Connect();
     return cluster;
 }
Esempio n. 3
0
        /// <summary>
        /// Create a process cluster
        /// </summary>
        /// <param name="providerName"></param>
        /// <param name="config"></param>
        /// <returns>ICluster</returns>
        public static ICluster CreateCluster(string providerName, ClusterConfig config)
        {
            if (providerName == null) throw new ArgumentNullException(nameof(providerName));
            if (config == null) throw new ArgumentNullException(nameof(config));

            if (providers.ContainsKey(providerName))
            {
                return providers[providerName](config);
            }
            else
            {
                throw new ArgumentException("'" + providerName + "' isn't a registered provider",nameof(providerName));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Create a process cluster
        /// </summary>
        /// <param name="providerName"></param>
        /// <param name="config"></param>
        /// <returns>ICluster</returns>
        public static ICluster CreateCluster(string providerName, ClusterConfig config)
        {
            if (providerName == null)
            {
                throw new ArgumentNullException(nameof(providerName));
            }
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (providers.ContainsKey(providerName))
            {
                return(providers[providerName](config));
            }
            else
            {
                throw new ArgumentException($"'{providerName}' isn't a registered provider", nameof(providerName));
            }
        }
Esempio n. 5
0
 /// <summary>
 /// ICluster factory provider
 /// </summary>
 /// <param name="config">ClusterConfig</param>
 /// <returns>ICluster</returns>
 private static ICluster factory(ClusterConfig config)
 {
     return new RedisClusterImpl(config);
 }
Esempio n. 6
0
 /// <summary>
 /// Ctor
 /// </summary>
 public RedisClusterImpl(ClusterConfig config)
 {
     this.config = config;
 }
 /// <summary>
 /// ICluster factory provider
 /// </summary>
 /// <param name="config">ClusterConfig</param>
 /// <returns>ICluster</returns>
 private static ICluster factory(ClusterConfig config)
 {
     return(new RedisClusterImpl(config));
 }