mirror of
https://github.com/Stone-Red-Code/RemoteExec.git
synced 2026-09-04 09:06:20 +02:00
Add infrastructure to support multiple execution environments
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using RemoteExec.Server.Utilities;
|
||||
using RemoteExec.Shared;
|
||||
|
||||
namespace RemoteExec.Server.Services;
|
||||
|
||||
public abstract class ExecutionEnvironment
|
||||
{
|
||||
public event EventHandler<CompletableEventArgs<string, byte[]>>? RequestAssembly;
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract Task PrepareEnvironmentAsync(CancellationToken cancellationToken);
|
||||
|
||||
public abstract Task<RemoteExecutionResult> ExecuteTaskAsync(RemoteExecutionRequest request);
|
||||
|
||||
public abstract Task CleanupEnvironmentAsync(CancellationToken cancellationToken);
|
||||
|
||||
protected async Task<byte[]> RequestAssemblyAsync(string assemblyName)
|
||||
{
|
||||
CompletableEventArgs<string, byte[]> args = new CompletableEventArgs<string, byte[]>(assemblyName);
|
||||
RequestAssembly?.Invoke(this, args);
|
||||
return await args.WaitAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user