Interface NetworkProtocol

  • All Known Implementing Classes:
    DefaultNetworkProtocol

    public interface NetworkProtocol
    Network protocol abstraction for distributed cache communication.

    This interface provides a pluggable network layer that supports different protocols (TCP, UDP, HTTP) and serialization formats (Java, JSON, Protocol Buffers). The protocol handles node-to-node communication for cache operations, cluster management, and failure detection.

    Key Features:

    • Protocol Agnostic: Supports TCP, UDP, HTTP, WebSocket
    • Pluggable Serialization: Java, JSON, Avro, Protocol Buffers
    • Compression Support: GZIP, LZ4, Snappy compression
    • Security: TLS encryption and authentication
    • Flow Control: Backpressure and rate limiting

    Usage Examples:

    
     // TCP with Java serialization
     NetworkProtocol protocol = NetworkProtocol.tcp()
             .serialization(SerializationType.JAVA)
             .compression(CompressionType.GZIP)
             .encryption(true)
             .port(8080)
             .build();
    
     // Send cache operation
     CacheOperation operation = new PutOperation("key1", "value1");
     protocol.send("node-2", operation).thenAccept(response -> {
         System.out.println("Operation completed: " + response);
     });
    
     // HTTP with JSON for cross-platform compatibility
     NetworkProtocol httpProtocol = NetworkProtocol.http()
             .serialization(SerializationType.JSON)
             .port(8080)
             .build();
     
    Since:
    1.0.0