Files
UnrealEngineUWP/Engine/Source/Programs/Horde/HordeCommon/HordeRpc.cs
Ben Marsh 5abbc95b6e Add missing copyright notices.
[CL 16160939 by Ben Marsh in ue5-main branch]
2021-04-29 15:35:57 -04:00

190 lines
3.9 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using Google.Protobuf;
using Google.Protobuf.Collections;
using Google.Protobuf.WellKnownTypes;
using HordeCommon;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
namespace HordeCommon.Rpc
{
#pragma warning disable CS1591
public partial class Property
{
public Property(string Name, string Value)
{
this.Name = Name;
this.Value = Value;
}
public Property(KeyValuePair<string, string> Pair)
{
this.Name = Pair.Key;
this.Value = Pair.Value;
}
}
public partial class PropertyUpdate
{
public PropertyUpdate(string Name, string? Value)
{
this.Name = Name;
this.Value = Value;
}
}
public static class PropertyExtensions
{
public static string GetValue(this RepeatedField<Property> Properties, string Name)
{
return Properties.First(x => x.Name == Name).Value;
}
public static bool TryGetValue(this RepeatedField<Property> Properties, string Name, [MaybeNullWhen(false)] out string Result)
{
Property? Property = Properties.FirstOrDefault(x => x.Name == Name);
if (Property == null)
{
Result = null!;
return false;
}
else
{
Result = Property.Value;
return true;
}
}
}
public partial class GetStreamRequest
{
public GetStreamRequest(string StreamId)
{
this.StreamId = StreamId;
}
}
public partial class UpdateStreamRequest
{
public UpdateStreamRequest(string StreamId, Dictionary<string, string?> Properties)
{
this.StreamId = StreamId;
this.Properties.AddRange(Properties.Select(x => new PropertyUpdate(x.Key, x.Value)));
}
}
public partial class GetJobRequest
{
public GetJobRequest(string JobId)
{
this.JobId = JobId;
}
}
public partial class BeginBatchRequest
{
public BeginBatchRequest(string JobId, string BatchId, string LeaseId)
{
this.JobId = JobId;
this.BatchId = BatchId;
this.LeaseId = LeaseId;
}
}
public partial class FinishBatchRequest
{
public FinishBatchRequest(string JobId, string BatchId, string LeaseId)
{
this.JobId = JobId;
this.BatchId = BatchId;
this.LeaseId = LeaseId;
}
}
public partial class BeginStepRequest
{
public BeginStepRequest(string JobId, string BatchId, string LeaseId)
{
this.JobId = JobId;
this.BatchId = BatchId;
this.LeaseId = LeaseId;
}
}
public partial class UpdateStepRequest
{
public UpdateStepRequest(string JobId, string BatchId, string StepId, JobStepState State, JobStepOutcome Outcome)
{
this.JobId = JobId;
this.BatchId = BatchId;
this.StepId = StepId;
this.State = State;
this.Outcome = Outcome;
}
}
public partial class GetStepRequest
{
public GetStepRequest(string JobId, string BatchId, string StepId)
{
this.JobId = JobId;
this.BatchId = BatchId;
this.StepId = StepId;
}
}
public partial class GetStepResponse
{
public GetStepResponse(JobStepOutcome Outcome, JobStepState State, bool AbortRequested)
{
this.Outcome = Outcome;
this.State = State;
this.AbortRequested = AbortRequested;
}
}
public partial class CreateEventRequest
{
public CreateEventRequest(EventSeverity Severity, string LogId, int LineIndex, int LineCount)
{
this.Severity = Severity;
this.LogId = LogId;
this.LineIndex = LineIndex;
this.LineCount = LineCount;
}
}
public partial class CreateEventsRequest
{
public CreateEventsRequest(IEnumerable<CreateEventRequest> Events)
{
this.Events.AddRange(Events);
}
}
public partial class WriteOutputRequest
{
public WriteOutputRequest(string LogId, long Offset, int LineIndex, byte[] Data, bool Flush)
{
this.LogId = LogId;
this.Offset = Offset;
this.LineIndex = LineIndex;
this.Data = ByteString.CopyFrom(Data);
this.Flush = Flush;
}
}
public partial class DownloadSoftwareRequest
{
public DownloadSoftwareRequest(string Version)
{
this.Version = Version;
}
}
#pragma warning restore CS1591
}