Пример #1
0
        internal override async Task BootstrapAsync(IClusterNode node)
        {
            try
            {
                node.Owner = this;
                await node.SelectBucket(this.Name);

                if (Context.SupportsCollections)
                {
                    Manifest = await node.GetManifest().ConfigureAwait(false);
                }

                //we still need to add a default collection
                LoadManifest();

                BucketConfig = await node.GetClusterMap().ConfigureAwait(false);

                KeyMapper = new VBucketKeyMapper(BucketConfig);

                await Context.ProcessClusterMapAsync(this, BucketConfig);
            }
            catch (Exception e)
            {
                CaptureException(e);
            }
        }
        internal override async Task BootstrapAsync(IClusterNode node)
        {
            try
            {
                Logger.LogInformation("Bootstrapping: server negotiation started for {name}.", Redactor.UserData(Name));
                if (Context.ClusterOptions.HasNetworkResolution)
                {
                    //Network resolution determined at the GCCCP level
#pragma warning disable CS8602 // Dereference of a possibly null reference.
                    CurrentConfig.NetworkResolution = Context.ClusterOptions.EffectiveNetworkResolution;
#pragma warning restore CS8602 // Dereference of a possibly null reference.
                }
                else
                {
                    //A non-GCCCP cluster
#pragma warning disable CS8602 // Dereference of a possibly null reference.
                    CurrentConfig.SetEffectiveNetworkResolution(Context.ClusterOptions);
#pragma warning restore CS8602 // Dereference of a possibly null reference.
                }
                if (SupportsCollections)
                {
                    Manifest = await node.GetManifest().ConfigureAwait(false);
                }

                await node.HelloHello().ConfigureAwait(false);

                KeyMapper = _vBucketKeyMapperFactory.Create(CurrentConfig);

                Nodes.Add(node);
                await Context.ProcessClusterMapAsync(this, CurrentConfig).ConfigureAwait(false);

                var nodes = Context.GetNodes(Name);

                //update the local nodes collection
                lock (Nodes)
                {
                    foreach (var clusterNode in nodes)
                    {
                        if (!Nodes.TryGet(clusterNode.EndPoint, out _))
                        {
                            Nodes.Add(clusterNode);
                        }
                    }
                }

                ClearErrors();

                Logger.LogInformation("Bootstrapping: server negotiation completed for {name}.", Redactor.UserData(Name));
            }
            catch (Exception e)
            {
                if (e is CouchbaseException ce)
                {
                    if (ce.Context is KeyValueErrorContext {
                        Status : ResponseStatus.NotSupported
                    })
        internal override async Task BootstrapAsync(IClusterNode node)
        {
            try
            {
                await node.SelectBucketAsync(this).ConfigureAwait(false);

                if (Context.SupportsCollections)
                {
                    Manifest = await node.GetManifest().ConfigureAwait(false);
                }

                BucketConfig = await node.GetClusterMap().ConfigureAwait(false);

                if (Context.ClusterOptions.HasNetworkResolution)
                {
                    //Network resolution determined at the GCCCP level
                    BucketConfig.NetworkResolution = Context.ClusterOptions.EffectiveNetworkResolution;
                }
                else
                {
                    //A non-GCCCP cluster
                    BucketConfig.SetEffectiveNetworkResolution(node.BootstrapEndpoint, Context.ClusterOptions);
                }

                KeyMapper = await _vBucketKeyMapperFactory.CreateAsync(BucketConfig).ConfigureAwait(false);

                Nodes.Add(node);
                await Context.ProcessClusterMapAsync(this, BucketConfig).ConfigureAwait(false);

                ClearErrors();
            }
            catch (Exception e)
            {
                if (e is CouchbaseException ce)
                {
                    if (ce.Context is KeyValueErrorContext {
                        Status : ResponseStatus.NotSupported
                    })