Exemplo n.º 1
0
 /// <inheritdoc/>
 public IRiakConnection CreateConnection(IRiakNodeConfiguration nodeConfig, IRiakAuthenticationConfiguration authConfig)
 {
     // As pointless as this seems, it serves the purpose of decoupling the
     // creation of the connections to the node itself. Also means we can
     // pull it apart to test it
     return(new RiakConnection(nodeConfig, authConfig));
 }
 /// <inheritdoc/>
 public IRiakConnection CreateConnection(IRiakNodeConfiguration nodeConfig, IRiakAuthenticationConfiguration authConfig)
 {
     // As pointless as this seems, it serves the purpose of decoupling the
     // creation of the connections to the node itself. Also means we can
     // pull it apart to test it
     return new RiakConnection(nodeConfig, authConfig);
 }
Exemplo n.º 3
0
 public RiakOnTheFlyConnection(
     IRiakNodeConfiguration nodeConfig,
     IRiakAuthenticationConfiguration authConfig,
     IRiakConnectionFactory connFactory)
 {
     this.nodeConfig  = nodeConfig;
     this.authConfig  = authConfig;
     this.connFactory = connFactory;
 }
Exemplo n.º 4
0
 public RiakPbcSocket(IRiakNodeConfiguration nodeConfig, IRiakAuthenticationConfiguration authConfig)
 {
     server                     = nodeConfig.HostAddress;
     port                       = nodeConfig.PbcPort;
     readTimeout                = nodeConfig.NetworkReadTimeout;
     writeTimeout               = nodeConfig.NetworkWriteTimeout;
     connectTimeout             = nodeConfig.NetworkConnectTimeout;
     securityManager            = new RiakSecurityManager(server, authConfig);
     checkCertificateRevocation = authConfig.CheckCertificateRevocation;
 }
Exemplo n.º 5
0
        public RiakConnectionPool(
            IRiakNodeConfiguration nodeConfig,
            IRiakAuthenticationConfiguration authConfig,
            IRiakConnectionFactory connFactory)
        {
            int poolSize = nodeConfig.PoolSize;

            for (var i = 0; i < poolSize; ++i)
            {
                var conn = connFactory.CreateConnection(nodeConfig, authConfig);
                allResources.Add(conn);
                resources.Push(conn);
            }
        }
Exemplo n.º 6
0
 public RiakNode(
     IRiakNodeConfiguration nodeConfig,
     IRiakAuthenticationConfiguration authConfig,
     IRiakConnectionFactory connectionFactory)
 {
     // assume that if the node has a pool size of 0 then the intent is to have the connections
     // made on the fly
     if (nodeConfig.PoolSize == 0)
     {
         connections = new RiakOnTheFlyConnection(nodeConfig, authConfig, connectionFactory);
     }
     else
     {
         connections = new RiakConnectionPool(nodeConfig, authConfig, connectionFactory);
     }
 }
        // Interesting discussion:
        // http://stackoverflow.com/questions/3780801/whats-the-difference-between-a-public-constructor-in-an-internal-class-and-an-i
        // http://stackoverflow.com/questions/9302236/why-use-a-public-method-in-an-internal-class
        internal RiakSecurityManager(string targetHost, IRiakAuthenticationConfiguration authConfig)
        {
            if (string.IsNullOrWhiteSpace(targetHost))
            {
                throw new ArgumentNullException("targetHost");
            }

            targetHostCommonName = string.Format("CN={0}", targetHost);
            this.authConfig = authConfig;

            if (IsSecurityEnabled)
            {
                clientCertificates = GetClientCertificates();
                certificateAuthorityCert = GetCertificateAuthorityCert();
            }
        }
Exemplo n.º 8
0
        // Interesting discussion:
        // http://stackoverflow.com/questions/3780801/whats-the-difference-between-a-public-constructor-in-an-internal-class-and-an-i
        // http://stackoverflow.com/questions/9302236/why-use-a-public-method-in-an-internal-class
        internal RiakSecurityManager(string targetHost, IRiakAuthenticationConfiguration authConfig)
        {
            if (string.IsNullOrWhiteSpace(targetHost))
            {
                throw new ArgumentNullException("targetHost");
            }

            targetHostCommonName = string.Format("CN={0}", targetHost);
            this.authConfig      = authConfig;

            if (IsSecurityEnabled)
            {
                clientCertificates       = GetClientCertificates();
                certificateAuthorityCert = GetCertificateAuthorityCert();
            }
        }
 public RiakConnection(IRiakNodeConfiguration nodeConfiguration, IRiakAuthenticationConfiguration authConfiguration)
 {
     socket = new RiakPbcSocket(nodeConfiguration, authConfiguration);
 }