示例#1
0
        public static async Task <IClusterNode> CreateAsync(ClusterContext context, IPEndPoint endPoint)
        {
            var connection     = endPoint.GetConnection(context.ClusterOptions);
            var serverFeatures = await connection.Hello().ConfigureAwait(false);

            var errorMap = await connection.GetErrorMap().ConfigureAwait(false);

            await connection.Authenticate(context.ClusterOptions, null).ConfigureAwait(false);

            var clusterNode = new ClusterNode(context)
            {
                EndPoint       = endPoint,
                Connection     = connection,
                ServerFeatures = serverFeatures,
                ErrorMap       = errorMap
            };

            clusterNode.BuildServiceUris();
            return(clusterNode);
        }
示例#2
0
        private async Task <ClusterNode> GetClusterNode(IPEndPoint endPoint)
        {
            var connection = endPoint.GetConnection();

            var serverFeatures = await connection.Hello().ConfigureAwait(false);

            var errorMap = await connection.GetErrorMap().ConfigureAwait(false);

            await connection.Authenticate(_configuration, null).ConfigureAwait(false);

            var clusterNode = new ClusterNode
            {
                EndPoint       = endPoint,
                Connection     = connection,
                ServerFeatures = serverFeatures,
                ErrorMap       = errorMap
            };

            return(clusterNode);
        }