// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace EpicGames.Horde.Compute { /// /// Full-duplex channel for sending and receiving messages /// public interface IComputeLease : IAsyncDisposable { /// /// Compute cluster ID /// ClusterId Cluster { get; } /// /// Properties of the remote machine /// IReadOnlyList Properties { get; } /// /// Resources assigned to this lease /// IReadOnlyDictionary AssignedResources { get; } /// /// Socket to communicate with the remote /// RemoteComputeSocket Socket { get; } /// /// IP address of the remote agent machine running the compute task /// When using relay connection mode, this may be the IP of the relay rather than the remote machine itself. /// public string Ip { get; } /// /// How to establish a connection to the remote machine (when not using the default socket) /// public ConnectionMode ConnectionMode { get; } /// /// Assigned ports (externally visible port -> local port on agent) /// /// Key is an arbitrary name identifying the port (same as was given when requesting the lease>) /// When relay mode is used, ports can mapped to a different externally visible port. /// If compute task uses and listens to port 7000, that port can be externally represented as something else. /// For example, port 32743 can be pointed to port 7000. /// This makes no difference for the compute task process, but the client/initiator making connections must /// pay attention to this mapping. /// IReadOnlyDictionary Ports { get; } /// /// Relinquish the lease gracefully /// /// Cancellation token for the operation ValueTask CloseAsync(CancellationToken cancellationToken = default); } }