using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Text; using SuperSocket.SocketBase; using SuperSocket.SocketBase.Config; using SuperSocket.SocketBase.Logging; using System.Net; namespace SuperSocket.SocketBase { /// /// The bootstrap start result /// public enum StartResult { /// /// No appserver has been set in the bootstrap, so nothing was started /// None, /// /// All appserver instances were started successfully /// Success, /// /// Some appserver instances were started successfully, but some of them failed /// PartialSuccess, /// /// All appserver instances failed to start /// Failed } /// /// SuperSocket bootstrap /// public interface IBootstrap { /// /// Gets all the app servers running in this bootstrap /// IEnumerable AppServers { get; } /// /// Gets the config. /// IRootConfig Config { get; } /// /// Initializes the bootstrap with the configuration /// /// bool Initialize(); /// /// Initializes the bootstrap with a listen endpoint replacement dictionary /// /// The listen end point replacement. /// bool Initialize(IDictionary listenEndPointReplacement); /// /// Initializes the bootstrap with the configuration /// /// The server config resolver. /// bool Initialize(Func serverConfigResolver); /// /// Initializes the bootstrap with the configuration /// /// The log factory. /// bool Initialize(ILogFactory logFactory); /// /// Initializes the bootstrap with the configuration /// /// The server config resolver. /// The log factory. /// bool Initialize(Func serverConfigResolver, ILogFactory logFactory); /// /// Starts this bootstrap. /// /// StartResult Start(); /// /// Stops this bootstrap. /// void Stop(); /// /// Gets the startup config file. /// string StartupConfigFile { get; } /// /// Gets the base directory. /// /// /// The base directory. /// string BaseDirectory { get; } } /// /// The bootstrap interface to support add new server instance in runtime /// public interface IDynamicBootstrap { /// /// Adds a new server into the bootstrap. /// /// The new server's config. /// bool Add(IServerConfig config); /// /// Adds a new server into the bootstrap and then start it. /// /// The new server's config. /// bool AddAndStart(IServerConfig config); /// /// Removes the server instance which is specified by name. /// /// The name of the server instance to be removed. void Remove(string name); } }