// Copyright Epic Games, Inc. All Rights Reserved. using EpicGames.Core; using Microsoft.Extensions.Configuration; namespace HordeServer { /// /// Type of run mode this process should use. Each carry different types of workloads. /// More than one mode can be active. But not all modes are not guaranteed to be compatible with each other and will /// raise an error if combined in such a way. /// public enum RunMode { /// /// Default no-op value (ASP.NET config will default to this for enums that cannot be parsed) /// None, /// /// Handle and respond to incoming external requests, such as HTTP REST and gRPC calls. /// These requests are time-sensitive and short-lived, typically less than 5 secs. /// If processes handling requests are unavailable, it will be very visible for users. /// Server, /// /// Run non-request facing workloads. Such as background services, processing queues, running work /// based on timers etc. Short periods of downtime or high CPU usage due to bursts are fine for this mode. /// No user requests will be impacted directly. If auto-scaling is used, a much more aggressive policy can be /// applied (tighter process packing, higher avg CPU usage). /// Worker } /// /// Provides access to server deployment information /// public interface IServerInfo { /// /// Current version of the server /// SemVer Version { get; } /// /// Environment that the server is deployed to /// string Environment { get; } /// /// Unique session id /// string SessionId { get; } /// /// Directory containing the server executable /// DirectoryReference AppDir { get; } /// /// Directory to store server data files /// DirectoryReference DataDir { get; } /// /// Global configuration settings /// IConfiguration Configuration { get; } /// /// Whether the server is running in read-only mode /// bool ReadOnlyMode { get; } /// /// Whether to enable endpoints which are for debugging purposes /// bool EnableDebugEndpoints { get; } /// /// Url to use for generating links back to the server /// Uri ServerUrl { get; } /// /// Url to use for generating links back to the dashboard. /// Uri DashboardUrl { get; } /// /// Helper method to check if this process has activated the given mode /// /// Run mode /// True if mode is active bool IsRunModeActive(RunMode mode); } }