Started reimplementing server feature because we use a new project structure now. This is way cleaner than the last implementation

This commit is contained in:
Marcel Baumgartner
2024-01-26 20:09:53 +01:00
parent 19001e5836
commit 33c1ffa0ba
19 changed files with 569 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using Moonlight.Features.Servers.Entities;
using Moonlight.Features.Servers.Models.Abstractions;
namespace Moonlight.Features.Servers.Services;
public class NodeService
{
private readonly Dictionary<int, NodeMeta> MetaCache = new();
public Task UpdateMeta(ServerNode node, Action<NodeMeta> metaAction)
{
lock (MetaCache)
{
NodeMeta? meta = null;
if (MetaCache.ContainsKey(node.Id))
meta = MetaCache[node.Id];
if (meta == null)
{
meta = new();
MetaCache.Add(node.Id, meta);
}
metaAction.Invoke(meta);
}
return Task.CompletedTask;
}
}