Пример #1
0
            /// <summary>
            ///     Initializes a new instance of the <see cref="GridionInternal" /> class.
            /// </summary>
            /// <param name="nodeConfiguration">
            ///     The configuration of <see cref="IGridion" /> instance.
            /// </param>
            /// <param name="curator">
            ///     The cluster curator.
            /// </param>
            internal GridionInternal(NodeConfiguration nodeConfiguration, IClusterCurator curator)
            {
                Should.NotBeNull(nodeConfiguration, nameof(nodeConfiguration));
                nodeConfiguration.Validate();

                this.nodeConfiguration = nodeConfiguration;
                this.node = new Node(nodeConfiguration.ServerConfiguration, curator, new ConsoleLogger());
            }
Пример #2
0
        /// <inheritdoc />
        public void Remove(INodeInternal node)
        {
            Should.NotBeNull(node, nameof(node));

            lock (this.nodes)
            {
                this.nodes.Remove(node);
            }
        }
Пример #3
0
        /// <inheritdoc />
        public override void Do(INodeInternal node)
        {
            var type = typeof(DistributedDictionary <,>);

            Type[] arguments   = { this.keyType, this.valType };
            var    constructed = type.MakeGenericType(arguments);
            var    instance    =
                Activator.CreateInstance(constructed, BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] { this.name }, null);

            node.AddCollection(instance);
        }
Пример #4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="GridionInternal" /> class.
        /// </summary>
        /// <param name="configuration">
        ///     The configuration of <see cref="IGridion" /> instance.
        /// </param>
        /// <param name="curator">
        ///     The cluster curator.
        /// </param>
        internal GridionInternal(GridionConfiguration configuration, IClusterCurator curator)
        {
            GridionConfigurationValidator.Validate(configuration);

            this.configuration = configuration;

            this.node = new Node(
                configuration.ServerConfiguration,
                curator,
                new ConsoleLogger());
        }
Пример #5
0
        /// <inheritdoc />
        public void Join(INodeInternal node)
        {
            Should.NotBeNull(node, nameof(node));

            lock (this.nodes)
            {
                if (this.nodes.Contains(node))
                {
                    throw new InvalidOperationException(SR.NodeWasAdded);
                }

                this.nodes.Add(node);

                var master = this.FindTheMasterNode();
                if (master == null)
                {
                    node.IsMasterNode = true;
                }
            }
        }
Пример #6
0
 /// <inheritdoc />
 public abstract void Do(INodeInternal node);