예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasicWatchdog"/> <see langword="class"/>.
 /// </summary>
 /// <param name="chat">The <see cref="IChatManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="sessionControllerFactory">The <see cref="ISessionControllerFactory"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="dmbFactory">The <see cref="IDmbFactory"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="sessionPersistor">The <see cref="ISessionPersistor"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="jobManager">The <see cref="IJobManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="serverControl">The <see cref="IServerControl"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="asyncDelayer">The <see cref="IAsyncDelayer"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="diagnosticsIOManager">The <see cref="IIOManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="eventConsumer">The <see cref="IEventConsumer"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="gitHubDeploymentManager">The <see cref="IGitHubDeploymentManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="initialLaunchParameters">The <see cref="DreamDaemonLaunchParameters"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="instance">The <see cref="Api.Models.Instance"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="autoStart">The autostart value for the <see cref="WatchdogBase"/>.</param>
 public BasicWatchdog(
     IChatManager chat,
     ISessionControllerFactory sessionControllerFactory,
     IDmbFactory dmbFactory,
     ISessionPersistor sessionPersistor,
     IJobManager jobManager,
     IServerControl serverControl,
     IAsyncDelayer asyncDelayer,
     IIOManager diagnosticsIOManager,
     IEventConsumer eventConsumer,
     IGitHubDeploymentManager gitHubDeploymentManager,
     ILogger <BasicWatchdog> logger,
     DreamDaemonLaunchParameters initialLaunchParameters,
     Api.Models.Instance instance,
     bool autoStart)
     : base(
         chat,
         sessionControllerFactory,
         dmbFactory,
         sessionPersistor,
         jobManager,
         serverControl,
         asyncDelayer,
         diagnosticsIOManager,
         eventConsumer,
         gitHubDeploymentManager,
         logger,
         initialLaunchParameters,
         instance,
         autoStart)
 {
 }
예제 #2
0
        /// <summary>
        /// Construct <see cref="DreamMaker"/>
        /// </summary>
        /// <param name="byond">The value of <see cref="byond"/></param>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="configuration">The value of <see cref="configuration"/></param>
        /// <param name="sessionControllerFactory">The value of <see cref="sessionControllerFactory"/></param>
        /// <param name="eventConsumer">The value of <see cref="eventConsumer"/></param>
        /// <param name="chatManager">The value of <see cref="chatManager"/></param>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/>.</param>
        /// <param name="compileJobConsumer">The value of <see cref="compileJobConsumer"/>.</param>
        /// <param name="repositoryManager">The value of <see cref="repositoryManager"/>.</param>
        /// <param name="gitHubDeploymentManager">The value of <see cref="gitHubDeploymentManager"/>.</param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        /// <param name="metadata">The value of <see cref="metadata"/>.</param>
        public DreamMaker(
            IByondManager byond,
            IIOManager ioManager,
            StaticFiles.IConfiguration configuration,
            ISessionControllerFactory sessionControllerFactory,
            IEventConsumer eventConsumer,
            IChatManager chatManager,
            IProcessExecutor processExecutor,
            IGitHubClientFactory gitHubClientFactory,
            ICompileJobSink compileJobConsumer,
            IRepositoryManager repositoryManager,
            IGitHubDeploymentManager gitHubDeploymentManager,
            ILogger <DreamMaker> logger,
            Api.Models.Instance metadata)
        {
            this.byond                    = byond ?? throw new ArgumentNullException(nameof(byond));
            this.ioManager                = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.configuration            = configuration ?? throw new ArgumentNullException(nameof(configuration));
            this.sessionControllerFactory = sessionControllerFactory ?? throw new ArgumentNullException(nameof(sessionControllerFactory));
            this.eventConsumer            = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
            this.chatManager              = chatManager ?? throw new ArgumentNullException(nameof(chatManager));
            this.processExecutor          = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
            this.gitHubClientFactory      = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
            this.compileJobConsumer       = compileJobConsumer ?? throw new ArgumentNullException(nameof(compileJobConsumer));
            this.repositoryManager        = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager));
            this.gitHubDeploymentManager  = gitHubDeploymentManager ?? throw new ArgumentNullException(nameof(gitHubDeploymentManager));
            this.logger                   = logger ?? throw new ArgumentNullException(nameof(logger));
            this.metadata                 = metadata ?? throw new ArgumentNullException(nameof(metadata));

            deploymentLock = new object();
        }
예제 #3
0
 /// <inheritdoc />
 public virtual IWatchdog CreateWatchdog(
     IChatManager chat,
     IDmbFactory dmbFactory,
     ISessionPersistor sessionPersistor,
     ISessionControllerFactory sessionControllerFactory,
     IIOManager gameIOManager,
     IIOManager diagnosticsIOManager,
     IEventConsumer eventConsumer,
     IGitHubDeploymentManager gitHubDeploymentManager,
     Api.Models.Instance instance,
     DreamDaemonSettings settings)
 => new BasicWatchdog(
예제 #4
0
        /// <summary>
        /// Construct a <see cref="DmbFactory"/>
        /// </summary>
        /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="gitHubDeploymentManager">The value of <see cref="gitHubDeploymentManager"/>.</param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        /// <param name="instance">The value of <see cref="instance"/></param>
        public DmbFactory(
            IDatabaseContextFactory databaseContextFactory,
            IIOManager ioManager,
            IGitHubDeploymentManager gitHubDeploymentManager,
            ILogger <DmbFactory> logger,
            Api.Models.Instance instance)
        {
            this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
            this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.gitHubDeploymentManager = gitHubDeploymentManager ?? throw new ArgumentNullException(nameof(gitHubDeploymentManager));
            this.logger   = logger ?? throw new ArgumentNullException(nameof(logger));
            this.instance = instance ?? throw new ArgumentNullException(nameof(instance));

            cleanupTask   = Task.CompletedTask;
            newerDmbTcs   = new TaskCompletionSource <object>();
            cleanupCts    = new CancellationTokenSource();
            jobLockCounts = new Dictionary <long, int>();
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowsWatchdog"/> <see langword="class"/>.
 /// </summary>
 /// <param name="chat">The <see cref="IChatManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="sessionControllerFactory">The <see cref="ISessionControllerFactory"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="dmbFactory">The <see cref="IDmbFactory"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="sessionPersistor">The <see cref="ISessionPersistor"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="jobManager">The <see cref="IJobManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="serverControl">The <see cref="IServerControl"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="asyncDelayer">The <see cref="IAsyncDelayer"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="diagnosticsIOManager">The <see cref="IIOManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="eventConsumer">The <see cref="IEventConsumer"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="gitHubDeploymentManager">The <see cref="IGitHubDeploymentManager"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="gameIOManager">The value of <see cref="GameIOManager"/>.</param>
 /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="initialLaunchParameters">The <see cref="DreamDaemonLaunchParameters"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="instance">The <see cref="Api.Models.Instance"/> for the <see cref="WatchdogBase"/>.</param>
 /// <param name="autoStart">The autostart value for the <see cref="WatchdogBase"/>.</param>
 public WindowsWatchdog(
     IChatManager chat,
     ISessionControllerFactory sessionControllerFactory,
     IDmbFactory dmbFactory,
     ISessionPersistor sessionPersistor,
     IJobManager jobManager,
     IServerControl serverControl,
     IAsyncDelayer asyncDelayer,
     IIOManager diagnosticsIOManager,
     IEventConsumer eventConsumer,
     IGitHubDeploymentManager gitHubDeploymentManager,
     IIOManager gameIOManager,
     ISymlinkFactory symlinkFactory,
     ILogger <WindowsWatchdog> logger,
     DreamDaemonLaunchParameters initialLaunchParameters,
     Api.Models.Instance instance, bool autoStart)
     : base(
         chat,
         sessionControllerFactory,
         dmbFactory,
         sessionPersistor,
         jobManager,
         serverControl,
         asyncDelayer,
         diagnosticsIOManager,
         eventConsumer,
         gitHubDeploymentManager,
         logger,
         initialLaunchParameters,
         instance,
         autoStart)
 {
     try
     {
         GameIOManager       = gameIOManager ?? throw new ArgumentNullException(nameof(gameIOManager));
         this.symlinkFactory = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
     }
     catch
     {
         var _ = DisposeAsync();
         throw;
     }
 }