adjust grpc api for idents

This commit is contained in:
Stanley Dimant
2022-10-09 14:32:44 +02:00
parent c14577302e
commit b5325b9c50
9 changed files with 344 additions and 153 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -45,6 +46,16 @@ internal class IdentityHandler
return cachedIdentities.Count(c => c.Value.ServerId == serverId);
}
internal Dictionary<string, ServerIdentity> GetIdentsForAllExcept(string serverId)
{
return cachedIdentities.Where(k => k.Value.ServerId != serverId).ToDictionary(k => k.Key, k => k.Value);
}
internal Dictionary<string, ServerIdentity> GetIdentsForServer(string serverId)
{
return cachedIdentities.Where(k => k.Value.ServerId == serverId).ToDictionary(k => k.Key, k => k.Value);
}
internal void ClearIdentsForServer(string serverId)
{
var serverIdentities = cachedIdentities.Where(i => i.Value.ServerId == serverId);