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;
 }
예제 #2
0
 public ClientConfig Clone()
 {
     ClientConfig config = new ClientConfig();
     config.BootstrapUrls.AddRange(this.BootstrapUrls);
     config.MaxConnectionsPerNode = this.MaxConnectionsPerNode;
     config.MaxTotalConnections = this.MaxTotalConnections;
     config.RequestFormatType = this.RequestFormatType;
     config.SocketTimeoutMs = this.SocketTimeoutMs;
     return config;
 }
예제 #3
0
        public DefaultStoreClient(Store store, InconsistencyResolver resolver, ClientConfig config, AbstractStoreClientFactory factory)
        {
            if (null == store) throw new ArgumentNullException("store", "store cannot be null.");
            //if(null==resolver)throw new ArgumentNullException("resolver", "resolver cannot be null.");
            if (null == config) throw new ArgumentNullException("config", "config cannot be null.");
            if (null == factory) throw new ArgumentNullException("factory", "factory cannot be null.");

            _Factory = factory;
            _Store = store;
            _config = config;
            _Resolver = resolver;
        }
예제 #4
0
        static ConnectionPool GetPool(ClientConfig config, Uri uri)
        {
            ConnectionPool pool = Pools[uri] as ConnectionPool;

            if (null == pool)
            {
                pool = new ConnectionPool(config);

                lock (Pools)
                {
                    Pools.Add(uri, pool);
                }
            }

            return pool;
        }
예제 #5
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;
        }
예제 #6
0
        public static Pool GetPool(Uri uri, ClientConfig config)
        {
            if (null == uri) throw new ArgumentNullException("uri", "uri cannot be null.");

            Pool pool = Pools[uri] as Pool;

            if (null == pool)
            {
                lock (Pools)
                {
                    pool = Pools[uri] as Pool;

                    if (null == pool)
                    {
                        pool = new Pool(uri, config);
                        Pools.Add(uri, pool);
                    }
                }
            }

            return pool;
        }
예제 #7
0
        public SocketStore(string storeName,
                       string host,
                       int port,
                       ClientConfig config,
                       ConnectionPool connPool,
                       RequestFormatType type,
                       bool shouldReroute)
        {
            if (string.IsNullOrEmpty(storeName)) throw new ArgumentNullException("storeName", "storeName cannot be null.");
            if (string.IsNullOrEmpty(host)) throw new ArgumentNullException("host", "host cannot be null.");
            if (null == config) throw new ArgumentNullException("config", "config cannot be null.");
            if (null == connPool) throw new ArgumentNullException("connPool", "connPool cannot be null.");
            
            this.Name = storeName;
            this.Host = host;
            this.Port = port;
            this.Config = config;
            this.Pool = connPool;
            this.Type = type;
            this.ShouldReroute = shouldReroute;

            this.request = RequestFormat.newRequestFormat(type);
        }
예제 #8
0
 public ConnectionPool(ClientConfig config)
 {
     if (null == config) throw new ArgumentNullException("config", "config cannot be null.");
     this.Config = config;
 }
예제 #9
0
 private Pool(Uri uri, ClientConfig config)
 {
     _Uri = uri;
     _Config = config;
 }
 public SocketStoreClientFactory(ClientConfig config):base(config)
 {
     _ConnPool = new ConnectionPool(this.ClientConfig);
 }