public MiniClusterNode( string pathname, int debugIndex, IPEndPoint internalTcp, IPEndPoint internalTcpSec, IPEndPoint internalHttp, IPEndPoint externalTcp, IPEndPoint externalTcpSec, IPEndPoint externalHttp, IPEndPoint[] gossipSeeds, ISubsystem[] subsystems = null, int? chunkSize = null, int? cachedChunkSize = null, bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true, int memTableSize = 1000, bool inMemDb = true, bool disableFlushToDisk = false) { RunningTime.Start(); RunCount += 1; _dbPath = Path.Combine( pathname, string.Format( "mini-cluster-node-db-{0}-{1}-{2}", externalTcp.Port, externalTcpSec.Port, externalHttp.Port)); Directory.CreateDirectory(_dbPath); FileStreamExtensions.ConfigureFlush(disableFlushToDisk); Db = new TFChunkDb( CreateDbConfig(chunkSize ?? ChunkSize, _dbPath, cachedChunkSize ?? CachedChunkSize, inMemDb)); InternalTcpEndPoint = internalTcp; InternalTcpSecEndPoint = internalTcpSec; InternalHttpEndPoint = internalHttp; ExternalTcpEndPoint = externalTcp; ExternalTcpSecEndPoint = externalTcpSec; ExternalHttpEndPoint = externalHttp; var singleVNodeSettings = new ClusterVNodeSettings( Guid.NewGuid(), debugIndex, InternalTcpEndPoint, InternalTcpSecEndPoint, ExternalTcpEndPoint, ExternalTcpSecEndPoint, InternalHttpEndPoint, ExternalHttpEndPoint, new Data.GossipAdvertiseInfo(InternalTcpEndPoint, InternalTcpSecEndPoint, ExternalTcpEndPoint, ExternalTcpSecEndPoint, InternalHttpEndPoint, ExternalHttpEndPoint), new[] {InternalHttpEndPoint.ToHttpUrl()}, new[]{ExternalHttpEndPoint.ToHttpUrl()}, enableTrustedAuth, ssl_connections.GetCertificate(), 1, false, "", gossipSeeds, TFConsts.MinFlushDelayMs, 3, 2, 2, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2), false, "", false, TimeSpan.FromHours(1), StatsStorage.None, 0, new InternalAuthenticationProviderFactory(), disableScavengeMerging: true, adminOnPublic: true, statsOnPublic: true, gossipOnPublic: true, gossipInterval: TimeSpan.FromSeconds(1), gossipAllowedTimeDifference: TimeSpan.FromSeconds(1), gossipTimeout: TimeSpan.FromSeconds(1), extTcpHeartbeatTimeout: TimeSpan.FromSeconds(10), extTcpHeartbeatInterval: TimeSpan.FromSeconds(10), intTcpHeartbeatTimeout: TimeSpan.FromSeconds(10), intTcpHeartbeatInterval: TimeSpan.FromSeconds(10), verifyDbHash: false, maxMemtableEntryCount: memTableSize, developmentMode: false); Log.Info( "\n{0,-25} {1} ({2}/{3}, {4})\n" + "{5,-25} {6} ({7})\n" + "{8,-25} {9} ({10}-bit)\n" + "{11,-25} {12}\n" + "{13,-25} {14}\n" + "{15,-25} {16}\n" + "{17,-25} {18}\n" + "{19,-25} {20}\n\n", "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp, "OS:", OS.OsFlavor, Environment.OSVersion, "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof (IntPtr))*8, "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1), "DBPATH:", _dbPath, "ExTCP ENDPOINT:", ExternalTcpEndPoint, "ExTCP SECURE ENDPOINT:", ExternalTcpSecEndPoint, "ExHTTP ENDPOINT:", ExternalHttpEndPoint); Node = new ClusterVNode(Db, singleVNodeSettings, infoController: new InfoController(null, ProjectionType.None), subsystems: subsystems, gossipSeedSource: new KnownEndpointGossipSeedSource(gossipSeeds)); Node.ExternalHttpService.SetupController(new TestController(Node.MainQueue)); }
public MiniNode(string pathname, int? tcpPort = null, int? tcpSecPort = null, int? httpPort = null, ISubsystem[] subsystems = null, int? chunkSize = null, int? cachedChunkSize = null, bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true) { if (_running) throw new Exception("Previous MiniNode is still running!!!"); _running = true; RunningTime.Start(); RunCount += 1; IPAddress ip = IPAddress.Loopback; //GetLocalIp(); int extTcpPort = tcpPort ?? PortsHelper.GetAvailablePort(ip); int extSecTcpPort = tcpSecPort ?? PortsHelper.GetAvailablePort(ip); int extHttpPort = httpPort ?? PortsHelper.GetAvailablePort(ip); _dbPath = Path.Combine(pathname, string.Format("mini-node-db-{0}-{1}-{2}", extTcpPort, extSecTcpPort, extHttpPort)); Directory.CreateDirectory(_dbPath); Db = new TFChunkDb(CreateDbConfig(chunkSize ?? ChunkSize, _dbPath, cachedChunkSize ?? CachedChunkSize)); TcpEndPoint = new IPEndPoint(ip, extTcpPort); TcpSecEndPoint = new IPEndPoint(ip, extSecTcpPort); HttpEndPoint = new IPEndPoint(ip, extHttpPort); var singleVNodeSettings = new SingleVNodeSettings(TcpEndPoint, TcpSecEndPoint, HttpEndPoint, new[] { HttpEndPoint.ToHttpUrl() }, enableTrustedAuth, ssl_connections.GetCertificate(), 1, TFConsts.MinFlushDelayMs, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2), TimeSpan.FromHours(1), StatsStorage.None, skipInitializeStandardUsersCheck: skipInitializeStandardUsersCheck); Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n" + "{5,-25} {6} ({7})\n" + "{8,-25} {9} ({10}-bit)\n" + "{11,-25} {12}\n" + "{13,-25} {14}\n" + "{15,-25} {16}\n" + "{17,-25} {18}\n" + "{19,-25} {20}\n\n", "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp, "OS:", OS.OsFlavor, Environment.OSVersion, "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8, "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1), "DBPATH:", _dbPath, "TCP ENDPOINT:", TcpEndPoint, "TCP SECURE ENDPOINT:", TcpSecEndPoint, "HTTP ENDPOINT:", HttpEndPoint); Node = new SingleVNode(Db, singleVNodeSettings, dbVerifyHashes: true, memTableEntryCount: 1000, subsystems: subsystems); Node.HttpService.SetupController(new TestController(Node.MainQueue, Node.NetworkSendService)); }
public ProjectModule(ISubsystem prodjectSubsystem) { if (prodjectSubsystem.Type() != SubsystemType.Project) throw new ModuleLoadException("Неправильный тип подсистемы"); _prodjectSubsystem = (Projectubsystem)prodjectSubsystem; context = (DBModelUnitOfWork)Kernel.GetKernel. SendMessage(new ServiceMessage(KernelTypes.ServiceKernel, SubsystemType.Project, SubsystemType.DataBase, DbSubsystemMessages.GetContext, new object[] { })).Message[0]; }
public AccessModule(ISubsystem accessSubsystem) { if (accessSubsystem.Type() != SubsystemType.Access) throw new ModuleLoadException("Неправильный тип подсистемы"); _accessSubsystem = (AccessSubsystem)accessSubsystem; var result = Kernel.GetKernel. SendMessage(new ServiceMessage(KernelTypes.ServiceKernel, SubsystemType.Access, SubsystemType.DataBase, DbSubsystemMessages.GetContext, new object[] {})); _context = (DBModelUnitOfWork)result.Message[0]; }
private static void RegisterSubsystem(SubsystemInfo subsystemInfo, ISubsystem proxy) { if (proxy.Id == Guid.Empty) { throw new ArgumentException( StringUtil.Format( SubsystemStrings.EmptyImplementationId, subsystemInfo.Kind.ToString()), nameof(proxy)); } if (string.IsNullOrEmpty(proxy.Name)) { throw new ArgumentException( StringUtil.Format( SubsystemStrings.NullOrEmptyImplementationName, subsystemInfo.Kind.ToString()), nameof(proxy)); } if (string.IsNullOrEmpty(proxy.Description)) { throw new ArgumentException( StringUtil.Format( SubsystemStrings.NullOrEmptyImplementationDescription, subsystemInfo.Kind.ToString()), nameof(proxy)); } if (subsystemInfo.RequiredCmdlets.Count > 0 || subsystemInfo.RequiredFunctions.Count > 0) { // Process 'proxy.CmdletImplementationAssembly' and 'proxy.FunctionsToDefine' // Functions are added to global scope. // Cmdlets are loaded in a way like a snapin, making the 'Source' of the cmdlets to be 'Microsoft.PowerShell.Core'. // // For example, let's say the Job adapter is made a subsystem, then all `*-Job` cmdlets will be moved out of S.M.A // into a subsystem implementation DLL. After registration, all `*-Job` cmdlets should be back in the // 'Microsoft.PowerShell.Core' namespace to keep backward compatibility. // // Both cmdlets and functions are added to the default InitialSessionState used for creating a new Runspace, // so the subsystem works for all subsequent new runspaces after it's registered. // Take the Job adapter subsystem as an instance again, so when creating another Runspace after the registration, // all '*-Job' cmdlets should be available in the 'Microsoft.PowerShell.Core' namespace by default. } subsystemInfo.RegisterImplementation(proxy); }
private protected override void AddImplementation(ISubsystem rawImpl) { lock (_syncObj) { var impl = (TConcreteSubsystem)rawImpl; if (_registeredImpls.Count == 0) { _registeredImpls = new ReadOnlyCollection <TConcreteSubsystem>(new[] { impl }); _cachedImplInfos = new ReadOnlyCollection <ImplementationInfo>(new[] { new ImplementationInfo(impl) }); return; } if (!AllowMultipleRegistration) { throw new InvalidOperationException( StringUtil.Format( SubsystemStrings.MultipleRegistrationNotAllowed, Kind.ToString())); } foreach (TConcreteSubsystem item in _registeredImpls) { if (item.Id == impl.Id) { throw new InvalidOperationException( StringUtil.Format( SubsystemStrings.ImplementationAlreadyRegistered, impl.Id, Kind.ToString())); } } var list = new List <TConcreteSubsystem>(_registeredImpls.Count + 1); list.AddRange(_registeredImpls); list.Add(impl); _registeredImpls = new ReadOnlyCollection <TConcreteSubsystem>(list); _cachedImplInfos = new ReadOnlyCollection <ImplementationInfo>(list.ConvertAll(s => new ImplementationInfo(s))); } }
private static void UnregisterSubsystem(SubsystemInfo subsystemInfo, Guid id) { if (subsystemInfo.RequiredCmdlets.Count > 0 || subsystemInfo.RequiredFunctions.Count > 0) { throw new NotSupportedException("NotSupported yet: unregister subsystem that introduced new cmdlets/functions."); } ISubsystem impl = subsystemInfo.UnregisterImplementation(id); if (impl is IDisposable disposable) { try { disposable.Dispose(); } catch { // It's OK to ignore all exceptions when disposing the object. } } }
public void RenderSectors(SectorScanType scanType, ISubsystem subsystem) { var location = subsystem.ShipConnectedTo.GetLocation(); Region Region = Regions.Get(subsystem.Game.Map, location.Region); var shieldsAutoRaised = Shields.For(subsystem.ShipConnectedTo).AutoRaiseShieldsIfNeeded(Region); var printSector = (new Render(this, subsystem.Game.Config)); int totalHostiles = subsystem.Game.Map.Regions.GetHostileCount(); var isNebula = (Region.Type == RegionType.Nebulae); string RegionDisplayName = Region.Name; var sectorScanStringBuilder = new StringBuilder(); if (isNebula) { RegionDisplayName += " Nebula"; //todo: resource out. } this.Line(""); switch (scanType) { case SectorScanType.CombinedRange: printSector.CreateCRSViewScreen(Region, subsystem.Game.Map, location, totalHostiles, RegionDisplayName, isNebula, sectorScanStringBuilder); break; case SectorScanType.ShortRange: printSector.CreateSRSViewScreen(Region, subsystem.Game.Map, location, totalHostiles, RegionDisplayName, isNebula, sectorScanStringBuilder); break; default: throw new NotImplementedException(); } printSector.OutputScanWarnings(Region, subsystem.Game.Map, shieldsAutoRaised); Region.ClearSectorsWithItem(SectorItem.Debug); //Clears any debug Markers that might have been set Region.Scanned = true; }
static void DestroySubsystem(ISubsystem subsystem)
public SubsystemStateEventArgs(ISubsystem subsystem, object state) { CodeContract.Requires(subsystem != null); Subsystem = subsystem; State = state; }
public NetworkModule(ISubsystem networkSubsystem) { if (networkSubsystem.Type() != SubsystemType.Network) throw new ModuleLoadException("Неправильный тип подсистемыы"); _networkSubsystem = networkSubsystem; }
/// <summary> /// Регистрация подсистемы в ядре /// </summary> /// <param name="subsystem">Регистрируемая подсистема</param> public void RegisterSubsystem(ISubsystem subsystem) { if (Subsystems.Any(tmpsubsystem => tmpsubsystem.Type() == subsystem.Type())) { throw new SubsystemRegistredException("Такая подсистема уже зарегистрирована"); } try { Subsystems.Add(subsystem); Logger.Log.Write(LogLevels.Debug, "Регитсрация подсистемы типа " + subsystem.Type().ToString()); StartSubsystem(subsystem); } catch (SubsystemException ex) { Logger.Log.Write(LogLevels.Error, "Ошибка регистрации подсистемы" + subsystem.Type() + ":\n\n" + ex); } }
public ReportModule(ISubsystem reportSubsystem) { if (reportSubsystem.Type() != SubsystemType.Report) throw new ModuleLoadException("Неправильный тип подсистемы"); _reportSubsystem = reportSubsystem; }
public MiniNode(string pathname, int? tcpPort = null, int? tcpSecPort = null, int? httpPort = null, ISubsystem[] subsystems = null, int? chunkSize = null, int? cachedChunkSize = null, bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true, int memTableSize = 1000, bool inMemDb = true, bool disableFlushToDisk = false, IPAddress advertisedExtIPAddress = null, int advertisedExtHttpPort = 0) { if (_running) throw new Exception("Previous MiniNode is still running!!!"); _running = true; RunningTime.Start(); RunCount += 1; IPAddress ip = IPAddress.Loopback; //GetLocalIp(); int extTcpPort = tcpPort ?? PortsHelper.GetAvailablePort(ip); int extSecTcpPort = tcpSecPort ?? PortsHelper.GetAvailablePort(ip); int extHttpPort = httpPort ?? PortsHelper.GetAvailablePort(ip); int intTcpPort = PortsHelper.GetAvailablePort(ip); int intSecTcpPort = PortsHelper.GetAvailablePort(ip); int intHttpPort = PortsHelper.GetAvailablePort(ip); _dbPath = Path.Combine(pathname, string.Format("mini-node-db-{0}-{1}-{2}", extTcpPort, extSecTcpPort, extHttpPort)); TcpEndPoint = new IPEndPoint(ip, extTcpPort); TcpSecEndPoint = new IPEndPoint(ip, extSecTcpPort); IntTcpEndPoint = new IPEndPoint(ip,intTcpPort); IntSecTcpEndPoint = new IPEndPoint(ip, intSecTcpPort); IntHttpEndPoint = new IPEndPoint(ip, intHttpPort); ExtHttpEndPoint = new IPEndPoint(ip, extHttpPort); var builder = TestVNodeBuilder.AsSingleNode(); if(inMemDb) builder.RunInMemory(); else builder.RunOnDisk(_dbPath); builder.WithInternalTcpOn(IntTcpEndPoint) .WithInternalSecureTcpOn(IntSecTcpEndPoint) .WithExternalTcpOn(TcpEndPoint) .WithExternalSecureTcpOn(TcpSecEndPoint) .WithInternalHttpOn(IntHttpEndPoint) .WithExternalHttpOn(ExtHttpEndPoint) .WithTfChunkSize(chunkSize ?? ChunkSize) .WithTfChunksCacheSize(cachedChunkSize ?? CachedChunkSize) .WithServerCertificate(ssl_connections.GetCertificate()) .WithWorkerThreads(1) .DisableDnsDiscovery() .WithPrepareTimeout(TimeSpan.FromSeconds(2)) .WithCommitTimeout(TimeSpan.FromSeconds(2)) .WithStatsPeriod(TimeSpan.FromHours(1)) .DisableScavengeMerging() .NoGossipOnPublicInterface() .WithInternalHeartbeatInterval(TimeSpan.FromSeconds(10)) .WithInternalHeartbeatTimeout(TimeSpan.FromSeconds(10)) .WithExternalHeartbeatInterval(TimeSpan.FromSeconds(10)) .WithExternalHeartbeatTimeout(TimeSpan.FromSeconds(10)) .MaximumMemoryTableSizeOf(memTableSize) .DoNotVerifyDbHashes() .WithStatsStorage(StatsStorage.None) .AdvertiseExternalIPAs(advertisedExtIPAddress) .AdvertiseExternalHttpPortAs(advertisedExtHttpPort); if(enableTrustedAuth) builder.EnableTrustedAuth(); if(disableFlushToDisk) builder.WithUnsafeDisableFlushToDisk(); if(subsystems != null) { foreach(var subsystem in subsystems) { builder.AddCustomSubsystem(subsystem); } } Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n" + "{5,-25} {6} ({7})\n" + "{8,-25} {9} ({10}-bit)\n" + "{11,-25} {12}\n" + "{13,-25} {14}\n" + "{15,-25} {16}\n" + "{17,-25} {18}\n" + "{19,-25} {20}\n\n", "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp, "OS:", OS.OsFlavor, Environment.OSVersion, "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8, "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1), "DBPATH:", _dbPath, "TCP ENDPOINT:", TcpEndPoint, "TCP SECURE ENDPOINT:", TcpSecEndPoint, "HTTP ENDPOINT:", ExtHttpEndPoint); Node = builder.Build(); Db = ((TestVNodeBuilder)builder).GetDb(); Node.ExternalHttpService.SetupController(new TestController(Node.MainQueue)); }
private protected abstract void AddImplementation(ISubsystem rawImpl);
public Facade() { subsystemA = new SubsystemA(); subsystemB = new SubsystemB(); }
public void AddSubsystem(string name, ISubsystem subsystem) { Subsystems[name] = subsystem; subsystem.Setup(Context, name); }
/// <summary> /// Регистрация подсистемы в ядре /// </summary> /// <param name="subsystem">Регистрируемая подсистема</param> public void RegisterSubsystem(ISubsystem subsystem) { //try //{ Subsystems.Add(subsystem); StartSubsystem(subsystem); //} //catch (Exception ex) //{ // MessageBox.Show(ex.ToString()); // throw ex; //} }
private protected override ISubsystem RemoveImplementation(Guid id) { if (!AllowUnregistration) { throw new InvalidOperationException( StringUtil.Format( SubsystemStrings.UnregistrationNotAllowed, Kind.ToString())); } lock (_syncObj) { if (_registeredImpls.Count == 0) { throw new InvalidOperationException( StringUtil.Format( SubsystemStrings.NoImplementationRegistered, Kind.ToString())); } int index = -1; for (int i = 0; i < _registeredImpls.Count; i++) { if (_registeredImpls[i].Id == id) { index = i; break; } } if (index == -1) { throw new InvalidOperationException( StringUtil.Format( SubsystemStrings.ImplementationNotFound, id.ToString())); } ISubsystem target = _registeredImpls[index]; if (_registeredImpls.Count == 1) { _registeredImpls = Utils.EmptyReadOnlyCollection <TConcreteSubsystem>(); _cachedImplInfos = Utils.EmptyReadOnlyCollection <ImplementationInfo>(); } else { var list = new List <TConcreteSubsystem>(_registeredImpls.Count - 1); for (int i = 0; i < _registeredImpls.Count; i++) { if (index == i) { continue; } list.Add(_registeredImpls[i]); } _registeredImpls = new ReadOnlyCollection <TConcreteSubsystem>(list); _cachedImplInfos = new ReadOnlyCollection <ImplementationInfo>(list.ConvertAll(s => new ImplementationInfo(s))); } return(target); } }
static void SetRunning(ISubsystem subsystem, bool shouldBeRunning)
public MiniNode(string pathname, int? tcpPort = null, int? tcpSecPort = null, int? httpPort = null, ISubsystem[] subsystems = null, int? chunkSize = null, int? cachedChunkSize = null, bool enableTrustedAuth = false, bool skipInitializeStandardUsersCheck = true, int memTableSize = 1000, bool inMemDb = true, bool disableFlushToDisk = false) { if (_running) throw new Exception("Previous MiniNode is still running!!!"); _running = true; RunningTime.Start(); RunCount += 1; IPAddress ip = IPAddress.Loopback; //GetLocalIp(); int extTcpPort = tcpPort ?? PortsHelper.GetAvailablePort(ip); int extSecTcpPort = tcpSecPort ?? PortsHelper.GetAvailablePort(ip); int extHttpPort = httpPort ?? PortsHelper.GetAvailablePort(ip); int intTcpPort = PortsHelper.GetAvailablePort(ip); int intSecTcpPort = PortsHelper.GetAvailablePort(ip); int intHttpPort = PortsHelper.GetAvailablePort(ip); _dbPath = Path.Combine(pathname, string.Format("mini-node-db-{0}-{1}-{2}", extTcpPort, extSecTcpPort, extHttpPort)); Directory.CreateDirectory(_dbPath); FileStreamExtensions.ConfigureFlush(disableFlushToDisk); Db = new TFChunkDb(CreateDbConfig(chunkSize ?? ChunkSize, _dbPath, cachedChunkSize ?? CachedChunkSize, inMemDb)); TcpEndPoint = new IPEndPoint(ip, extTcpPort); TcpSecEndPoint = new IPEndPoint(ip, extSecTcpPort); IntTcpEndPoint = new IPEndPoint(ip,intTcpPort); IntSecTcpEndPoint = new IPEndPoint(ip, intSecTcpPort); IntHttpEndPoint = new IPEndPoint(ip, intHttpPort); ExtHttpEndPoint = new IPEndPoint(ip, extHttpPort); var vNodeSettings = new ClusterVNodeSettings(Guid.NewGuid(), 0, IntTcpEndPoint, IntSecTcpEndPoint, TcpEndPoint, TcpSecEndPoint, IntHttpEndPoint, ExtHttpEndPoint, new Data.GossipAdvertiseInfo(IntTcpEndPoint, IntSecTcpEndPoint, TcpEndPoint, TcpSecEndPoint, IntHttpEndPoint, ExtHttpEndPoint), new [] {IntHttpEndPoint.ToHttpUrl()}, new [] {ExtHttpEndPoint.ToHttpUrl()}, enableTrustedAuth, ssl_connections.GetCertificate(), 1, false, "whatever", new IPEndPoint[] {}, TFConsts.MinFlushDelayMs, 1, 1, 1, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2), false, "", false, TimeSpan.FromHours(1), StatsStorage.None, 1, new InternalAuthenticationProviderFactory(), true, true, true, false, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), false, memTableSize, false, false); Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n" + "{5,-25} {6} ({7})\n" + "{8,-25} {9} ({10}-bit)\n" + "{11,-25} {12}\n" + "{13,-25} {14}\n" + "{15,-25} {16}\n" + "{17,-25} {18}\n" + "{19,-25} {20}\n\n", "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp, "OS:", OS.OsFlavor, Environment.OSVersion, "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8, "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1), "DBPATH:", _dbPath, "TCP ENDPOINT:", TcpEndPoint, "TCP SECURE ENDPOINT:", TcpSecEndPoint, "HTTP ENDPOINT:", ExtHttpEndPoint); Node = new ClusterVNode(Db, vNodeSettings, new KnownEndpointGossipSeedSource(new [] {ExtHttpEndPoint}), new InfoController(null, ProjectionType.None), subsystems); Node.ExternalHttpService.SetupController(new TestController(Node.MainQueue)); }
/// <summary> /// Отключение подсистемы из ядра /// </summary> /// <param name="subsystem">Отключаемая подсистема</param> public void UnRegisterSubsystem(ISubsystem subsystem) { Subsystems.Remove(subsystem); subsystem.Stop(); }
internal void RegisterImplementation(ISubsystem impl) { AddImplementation(impl); }
public void Update(UpdateType updateSource) { if (Active) { if (Context.Frame % 100 == 0 && Context.WCAPI == null) { Context.WCAPI = new WcPbApi(); if (!Context.WCAPI.Activate(Context.Program.Me)) { Context.WCAPI = null; } } while (GeneralListener.HasPendingMessage) { var msg = GeneralListener.AcceptMessage(); var data = msg.Data.ToString(); if (commandLine.TryParse(data)) { CommandV2(commandLine); } } if (OutputMode == OutputMode.Profile) { profiler.StartSectionWatch("Setup frequencies"); } if (OutputMode == OutputMode.Profile) { profiler.UpdateRuntime(); } Context.Frame++; UpdateFrequency updateFrequency = UpdateFrequency.None; if ((updateSource & UpdateType.Update1) != 0) { updateFrequency |= UpdateFrequency.Update1; } if ((updateSource & UpdateType.Update10) != 0) { updateFrequency |= UpdateFrequency.Update10; } if ((updateSource & UpdateType.Update100) != 0) { updateFrequency |= UpdateFrequency.Update100; } UpdateFrequency targetFrequency = UpdateFrequency.Update1; if (OutputMode == OutputMode.Profile) { profiler.StopSectionWatch("Setup frequencies"); } foreach (var subsystem in Subsystems) { if (OutputMode == OutputMode.Profile) { profiler.StartSectionWatch(subsystem.Key); } ISubsystem system = subsystem.Value; if ((system.UpdateFrequency & updateFrequency) != 0) { system.Update(Context.LocalTime, updateFrequency); } targetFrequency |= system.UpdateFrequency; if (OutputMode == OutputMode.Profile) { profiler.StopSectionWatch(subsystem.Key); } } Context.Program.Runtime.UpdateFrequency = targetFrequency; } else if (Activating) { Activating = false; Activate(); } }
private static void ReloadSubsytem(ISubsystem subsystem) { subsystem.Reload(); }
private static void StartSubsystem(ISubsystem subsystem) { subsystem.Start(); }
private static void StopSubsystem(ISubsystem subsystem) { subsystem.Stop(); }
public TextModule(ISubsystem wordProcessorSubsystem) { if (wordProcessorSubsystem.Type() != SubsystemType.WordProcessor) throw new ModuleLoadException("Неправилььный тип подсистемы"); _textSubsystem = wordProcessorSubsystem; }
/// <summary> /// Registers the specified subsystem in this context /// </summary> protected void RegisterSubsystem(ISubsystem subsystem) { if(_subsystems.ContainsKey(subsystem.SubsystemIdentifier)) throw new ArgumentException(string.Format("The specified subsystem '{0}' is already registered in this Context", subsystem.SubsystemIdentifier)); _subsystems.Add(subsystem.SubsystemIdentifier, subsystem); }
/// <summary> /// Adds a custom subsystem to the builder. NOTE: This is an advanced use case that most people will never need! /// </summary> /// <param name="subsystem">The subsystem to add</param> /// <returns>A <see cref="EmbeddedVNodeBuilder"/> with the options set</returns> public EmbeddedVNodeBuilder AddCustomSubsystem(ISubsystem subsystem) { _subsystems.Add(subsystem); return(this); }
public VcsModule(ISubsystem vcsSubsystem) { if (vcsSubsystem.Type() != SubsystemType.Vcs) throw new ModuleLoadException("Неправильный тип подсистемы"); _vcsSubsystem = vcsSubsystem; }
public ChatModule(ISubsystem chatSubsystem) { if (chatSubsystem.Type() != SubsystemType.Chat) throw new ModuleLoadException("Неправильный тип подсистемы"); _chatSubsystem = chatSubsystem; }
public virtual bool HasRequirement(ISubsystem requirement) { return(Requirements.Contains(requirement)); }
/// <summary> /// Adds a custom subsystem to the builder. NOTE: This is an advanced use case that most people will never need! /// </summary> /// <param name="subsystem">The subsystem to add</param> /// <returns>A <see cref="EmbeddedVNodeBuilder"/> with the options set</returns> public EmbeddedVNodeBuilder AddCustomSubsystem(ISubsystem subsystem) { _subsystems.Add(subsystem); return this; }
/// <summary> /// Отключение подсистемы из ядра /// </summary> /// <param name="subsystem">Отключаемая подсистема</param> public void UnRegisterSubsystem(ISubsystem subsystem) { Subsystems.Remove(subsystem); subsystem.Stop(); Logger.Log.Write(LogLevels.Debug, "Отключение подсистемы типа " + subsystem.Type().ToString()); }