Exemplo n.º 1
0
        public static async Task <ICluster> ConnectAsync(ClusterOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (options.ConnectionString == null)
            {
                throw new ArgumentException($"{nameof(options)} must have a connection string.",
                                            nameof(options));
            }

            //try to bootstrap for GC3P; if pre-6.6 this will fail and bootstrapping will
            //happen at the bucket level. In this case the caller can open a bucket and
            //resubmit the cluster level request.
            var cluster = new Cluster(options);

            await((IBootstrappable)cluster).BootStrapAsync().ConfigureAwait(false);
            cluster.StartBootstrapper();

            return(cluster);
        }