Высокопроизводительная индексация клиентов внутри протокола

This commit is contained in:
RoyceDa
2026-02-04 06:01:12 +02:00
parent 6a5c01bf25
commit cd1e6e6b14
5 changed files with 301 additions and 16 deletions

View File

@@ -0,0 +1,44 @@
package com.rosetta.im.client;
import java.util.HashSet;
import com.rosetta.im.client.tags.ECIAuthentificate;
import io.orprotocol.Server;
import io.orprotocol.client.Client;
import io.orprotocol.index.ClientIndexer;
/**
* Менеджер клиентов
*/
public class ClientManager {
private Server server;
private ClientIndexer clientIndexer;
public ClientManager(Server server) {
this.server = server;
this.clientIndexer = server.getClientIndexer();
}
public Server getServer() {
return this.server;
}
public boolean isClientConnected(String publicKey) {
HashSet<Client> clients = this.clientIndexer.getClients(ECIAuthentificate.class, "publicKey", publicKey);
if(clients.size() > 0){
/**
* Есть клиенты с таким публичным ключом
*/
return true;
}
/**
* Нет клиентов с таким ключом
*/
return false;
}
}