Interface CommunicationProtocol<K,​V>

  • Type Parameters:
    K - the type of keys
    V - the type of values
    All Known Implementing Classes:
    AbstractCommunicationProtocol, TcpCommunicationProtocol

    public interface CommunicationProtocol<K,​V>
    Simple interface for inter-node communication protocols in distributed cache.

    This interface provides a clean, focused API for distributed cache communication without unnecessary complexity. Currently supports TCP-based communication with plans for additional protocols as needed.

    Supported Operations:

    • PUT: Store key-value pair on remote node
    • GET: Retrieve value for key from remote node
    • REMOVE: Delete key from remote node
    • HEALTH_CHECK: Check if remote node is healthy
    • INVALIDATION: Broadcast invalidation to multiple nodes
    • MIGRATION: Request key migration during rebalancing
    • CLUSTER_INFO: Get cluster topology information

    Usage Examples:

    
     // Create TCP communication protocol
     CommunicationProtocol<String, User> protocol = TcpCommunicationProtocol.<String, User>builder()
             .port(8080)
             .timeout(5000)
             .maxConnections(100)
             .build();
    
     // Cache operations
     protocol.sendPut("node-2:8080", "user123", user);
     User retrieved = protocol.sendGet("node-2:8080", "user123").get().getResult();
    
     // Broadcasting
     protocol.broadcastInvalidation(Arrays.asList("node-1:8080", "node-2:8080"), "user123");
     
    Since:
    1.0.0