mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-05-07 09:59:28 +00:00
* ci(docker): build dist-tests images * Update to .net 10, kubernetes client 18.0.13 Kubernetes client 18.0.13 is compatible with Kubernetes 1.34.x. The Kubernetes version is selected automatically by kubeadm in docker desktop (v1.34.1). See https://github.com/kubernetes-client/csharp#version-compatibility for a compatibility table. * Updates to support Kubernetes upgrade * bump openapi.yaml to match openapi.yaml in the logos-storage-nim docker image * bump doc to .net 10 * bump docker to .net 10 * Build image with latest tag always Always build an image with a latest tag (as well as a sha commit hash) when there's a push to master * docker image tag as "latest" only when pushing to master * Update docker image to install doctl * Remove doctl install kubeconfig is now created and uses a plain bearer token instead of using doctl as a credential mgr * Rename and remove all instances of Codex * Further remove CodexNetDeployer as it is no longer needed --------- Co-authored-by: Adam Uhlíř <adam@uhlir.dev>
143 lines
3.9 KiB
C#
143 lines
3.9 KiB
C#
using LogosStorageClient;
|
|
using OverwatchTranscript;
|
|
|
|
namespace StoragePlugin.OverwatchSupport
|
|
{
|
|
[Serializable]
|
|
public class OverwatchLogosStorageHeader
|
|
{
|
|
public StorageNodeIdentity[] Nodes { get; set; } = Array.Empty<StorageNodeIdentity>();
|
|
}
|
|
|
|
[Serializable]
|
|
public class OverwatchLogosStorageEvent
|
|
{
|
|
public int NodeIdentity { get; set; } = -1;
|
|
public ScenarioFinishedEvent? ScenarioFinished { get; set; }
|
|
public NodeStartingEvent? NodeStarting { get; set; }
|
|
public NodeStartedEvent? NodeStarted { get; set; }
|
|
public NodeStoppingEvent? NodeStopping { get; set; }
|
|
public BootstrapConfigEvent? BootstrapConfig { get; set; }
|
|
public FileUploadingEvent? FileUploading { get; set; }
|
|
public FileUploadedEvent? FileUploaded { get; set; }
|
|
public FileDownloadingEvent? FileDownloading { get; set; }
|
|
public FileDownloadedEvent? FileDownloaded { get; set; }
|
|
public BlockReceivedEvent? BlockReceived { get; set; }
|
|
public PeerDialSuccessfulEvent? DialSuccessful { get; set; }
|
|
public PeerDroppedEvent? PeerDropped { get; set; }
|
|
|
|
public void Write(DateTime utc, ITranscriptWriter writer)
|
|
{
|
|
if (NodeIdentity == -1 && ScenarioFinished == null)
|
|
{
|
|
throw new Exception("NodeIdentity not set, and event is not ScenarioFinished.");
|
|
}
|
|
if (AllNull()) throw new Exception("No event data was set");
|
|
|
|
writer.Add(utc, this);
|
|
}
|
|
|
|
private bool AllNull()
|
|
{
|
|
var props = GetType()
|
|
.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
|
|
.Where(p => p.PropertyType != typeof(string)).ToArray();
|
|
|
|
return props.All(p => p.GetValue(this) == null);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class StorageNodeIdentity
|
|
{
|
|
public string Name { get; set; } = string.Empty;
|
|
public string PeerId { get; set; } = string.Empty;
|
|
public string NodeId { get; set; } = string.Empty;
|
|
public float KademliaNormalizedPosition { get; set; } = 0.0f;
|
|
}
|
|
|
|
#region Scenario Generated Events
|
|
|
|
[Serializable]
|
|
public class ScenarioFinishedEvent
|
|
{
|
|
public bool Success { get; set; }
|
|
public string Result { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class NodeStartingEvent
|
|
{
|
|
public string Image { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class NodeStartedEvent
|
|
{
|
|
}
|
|
|
|
[Serializable]
|
|
public class NodeStoppingEvent
|
|
{
|
|
}
|
|
|
|
[Serializable]
|
|
public class BootstrapConfigEvent
|
|
{
|
|
public string BootstrapPeerId { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class FileUploadingEvent
|
|
{
|
|
public string UniqueId { get; set;} = string.Empty;
|
|
public long ByteSize { get; set; }
|
|
}
|
|
|
|
[Serializable]
|
|
public class FileDownloadingEvent
|
|
{
|
|
public string Cid { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class FileUploadedEvent
|
|
{
|
|
public string UniqueId { get; set; } = string.Empty;
|
|
public long ByteSize { get; set; }
|
|
public string Cid { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class FileDownloadedEvent
|
|
{
|
|
public string Cid { get; set; } = string.Empty;
|
|
public long ByteSize { get; set; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Logos Storage Generated Events
|
|
|
|
[Serializable]
|
|
public class BlockReceivedEvent
|
|
{
|
|
public string BlockAddress { get; set; } = string.Empty;
|
|
public string SenderPeerId { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class PeerDialSuccessfulEvent
|
|
{
|
|
public string TargetPeerId { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public class PeerDroppedEvent
|
|
{
|
|
public string DroppedPeerId { get; set; } = string.Empty;
|
|
}
|
|
|
|
#endregion
|
|
}
|