public RoundRobinRoutingStrategy(ClientConfig config, Cluster cluster)
 {
     if (null == config) throw new ArgumentNullException("config", "config cannot be null.");
     if (null == cluster) throw new ArgumentNullException("cluster", "cluster cannot be null.");
     _Config = config;
     _Cluster = cluster;
 }
Exemplo n.º 2
0
        public static void Save(Cluster cluster, string FilePath)
        {
            if (null == cluster) throw new ArgumentNullException("cluster", "cluster cannot be null.");
            if (string.IsNullOrEmpty(FilePath)) throw new ArgumentNullException("FilePath", "FilePath cannot be null.");

            using (System.IO.FileStream iostr = new System.IO.FileStream(FilePath, FileMode.Create, FileAccess.Write))
            {
                Save(cluster, iostr);
            }
        }
Exemplo n.º 3
0
        public RoutedStore(string storeName,
                    ClientConfig config,
                    Cluster cluster,
                    IDictionary<int, Store> clusterMap,
                    RoutingStrategy routingStrategy)
        {
            if (string.IsNullOrEmpty(storeName)) throw new ArgumentNullException("storeName", "storeName cannot be null.");
            if (null == config) throw new ArgumentNullException("config", "config cannot be null.");
            if (null == cluster) throw new ArgumentNullException("cluster", "cluster cannot be null.");
            if (null == clusterMap) throw new ArgumentNullException("clusterMap", "clusterMap cannot be null.");
            if (null == routingStrategy) throw new ArgumentNullException("routingStrategy", "routingStrategy cannot be null.");


            _storeName = storeName;
            _config = config;
            _cluster = cluster;
            _clusterMap = clusterMap;
            _routingStrategy = routingStrategy;
        }
Exemplo n.º 4
0
 public static void Save(Cluster cluster, Stream stream)
 {
     if (null == cluster) throw new ArgumentNullException("cluster", "cluster cannot be null.");
     if (null == stream) throw new ArgumentNullException("stream", "stream cannot be null.");
     Serializer.Serialize(stream, cluster);
 }