예제 #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);