Exemplo 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);
 }
Exemplo 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;
 }
Exemplo 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));
            }
        }
Exemplo 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));
            }
        }
Exemplo 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);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Ctor
 /// </summary>
 public RedisClusterImpl(ClusterConfig config)
 {
     this.config = config;
 }
Exemplo n.º 7
0
 /// <summary>
 /// ICluster factory provider
 /// </summary>
 /// <param name="config">ClusterConfig</param>
 /// <returns>ICluster</returns>
 private static ICluster factory(ClusterConfig config)
 {
     return(new RedisClusterImpl(config));
 }