/// <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()); }
/// <inheritdoc /> public void Remove(INodeInternal node) { Should.NotBeNull(node, nameof(node)); lock (this.nodes) { this.nodes.Remove(node); } }
/// <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); }
/// <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()); }
/// <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; } } }
/// <inheritdoc /> public abstract void Do(INodeInternal node);