3using System.Threading.Tasks;
65 BaseProvider = baseProvider ??
throw new ArgumentNullException(nameof(baseProvider));
66 IOManager = ioManager ??
throw new ArgumentNullException(nameof(ioManager));
67 LinkFactory = symlinkFactory ??
throw new ArgumentNullException(nameof(symlinkFactory));
81 public ValueTask
MakeActive(CancellationToken cancellationToken)
83 if (Interlocked.Exchange(ref
swapped, 1) != 0)
84 throw new InvalidOperationException(
"Already swapped!");
86 return DoSwap(cancellationToken);
101 protected abstract ValueTask
DoSwap(CancellationToken cancellationToken);
Information about an engine installation.
A IDmbProvider that uses filesystem links to change directory structure underneath the server process...
string DmbName
The file name of the .dmb.
string Directory
The primary game directory.
volatile int swapped
Backing field for Swapped.
ValueTask DoSwap(CancellationToken cancellationToken)
Perform the swapping action.
Models.CompileJob CompileJob
The CompileJob of the .dmb.
IIOManager IOManager
The IIOManager to use.
SwappableDmbProvider(IDmbProvider baseProvider, IIOManager ioManager, IFilesystemLinkFactory symlinkFactory)
Initializes a new instance of the SwappableDmbProvider class.
Task FinishActivationPreparation(CancellationToken cancellationToken)
Should be awaited. before calling MakeActive(CancellationToken) to ensure the SwappableDmbProvider is...
void KeepAlive()
Disposing the IDmbProvider won't cause a cleanup of the working directory.
bool Swapped
If MakeActive(CancellationToken) has been run.
IDmbProvider BaseProvider
The IDmbProvider we are swapping for.
const string LiveGameDirectory
The directory where the BaseProvider is symlinked to.
ValueTask MakeActive(CancellationToken cancellationToken)
Make the SwappableDmbProvider active by replacing the live link with our CompileJob.
IFilesystemLinkFactory LinkFactory
The IFilesystemLinkFactory to use.
virtual ValueTask DisposeAsync()
Provides absolute paths to the latest compiled .dmbs.
void KeepAlive()
Disposing the IDmbProvider won't cause a cleanup of the working directory.
EngineVersion EngineVersion
The Api.Models.EngineVersion used to build the .dmb.
string DmbName
The file name of the .dmb.
Models.CompileJob CompileJob
The CompileJob of the .dmb.
For creating filesystem symbolic links.
Interface for using filesystems.
string ResolvePath()
Retrieve the full path of the current working directory.