Interface NodeValueCodec


public interface NodeValueCodec
Decode and encode between list of zNode value strings and list of Endpoints.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static NodeValueCodec DEFAULT
    Deprecated.
  • Method Summary

    Modifier and Type Method Description
    default com.linecorp.armeria.client.Endpoint decode​(byte[] zNodeValue)
    Decodes a zNode value to a Endpoint.
    com.linecorp.armeria.client.Endpoint decode​(String zNodeValue)
    Decodes a zNode value to a Endpoint.
    default Set<com.linecorp.armeria.client.Endpoint> decodeAll​(byte[] zNodeValue)
    Decodes a zNode value into a set of Endpoints.
    Set<com.linecorp.armeria.client.Endpoint> decodeAll​(String zNodeValue)
    Decodes a zNode value into a set of Endpoints.
    byte[] encode​(com.linecorp.armeria.client.Endpoint endpoint)
    Encodes a single Endpoint into a byte array representation.
    byte[] encodeAll​(Iterable<com.linecorp.armeria.client.Endpoint> endpoints)
    Encodes a set of Endpoints into a byte array representation.
    static NodeValueCodec ofDefault()
    Returns the default NodeValueCodec implementation which assumes zNode value is a comma-separated string.
  • Field Details

    • DEFAULT

      @Deprecated static final NodeValueCodec DEFAULT
      Deprecated.
      Default NodeValueCodec implementation which assumes zNode value is a comma-separated string. Each element of the zNode value represents an endpoint whose format is <host>[:<port_number>[:weight]], such as:
      • "foo.com" - default port number, default weight (1000)
      • "bar.com:8080 - port number 8080, default weight (1000)
      • "10.0.2.15:0:500 - default port number, weight 500
      • "192.168.1.2:8443:700 - port number 8443, weight 700
      the segment and field delimiter can be specified, default will be "," and ":" Note that the port number must be specified when you want to specify the weight.
  • Method Details

    • ofDefault

      static NodeValueCodec ofDefault()
      Returns the default NodeValueCodec implementation which assumes zNode value is a comma-separated string. Each element of the zNode value represents an endpoint whose format is <host>[:<port_number>[:weight]], such as:
      • "foo.com" - default port number, default weight (1000)
      • "bar.com:8080 - port number 8080, default weight (1000)
      • "10.0.2.15:0:500 - default port number, weight 500
      • "192.168.1.2:8443:700 - port number 8443, weight 700
      the segment and field delimiter can be specified, default will be "," and ":" Note that the port number must be specified when you want to specify the weight.
    • decodeAll

      default Set<com.linecorp.armeria.client.Endpoint> decodeAll​(byte[] zNodeValue)
      Decodes a zNode value into a set of Endpoints.
      Parameters:
      zNodeValue - zNode value
      Returns:
      the list of Endpoints
    • decodeAll

      Set<com.linecorp.armeria.client.Endpoint> decodeAll​(String zNodeValue)
      Decodes a zNode value into a set of Endpoints.
      Parameters:
      zNodeValue - zNode value
      Returns:
      the list of Endpoints
    • decode

      @Nullable default com.linecorp.armeria.client.Endpoint decode​(byte[] zNodeValue)
      Decodes a zNode value to a Endpoint.
      Parameters:
      zNodeValue - ZooKeeper node value
      Returns:
      an Endpoint or null if value needs to be skipped
    • decode

      @Nullable com.linecorp.armeria.client.Endpoint decode​(String zNodeValue)
      Decodes a zNode value to a Endpoint.
      Parameters:
      zNodeValue - ZooKeeper node value
      Returns:
      an Endpoint or null if value needs to be skipped
    • encodeAll

      byte[] encodeAll​(Iterable<com.linecorp.armeria.client.Endpoint> endpoints)
      Encodes a set of Endpoints into a byte array representation.
      Parameters:
      endpoints - set of Endpoints
      Returns:
      a byte array
    • encode

      byte[] encode​(com.linecorp.armeria.client.Endpoint endpoint)
      Encodes a single Endpoint into a byte array representation.
      Parameters:
      endpoint - an Endpoint
      Returns:
      a byte array