Interface Protocol

All Known Implementing Classes:
SimpleProtocol

public interface Protocol
Interface implemented by the concrete application message protocol.
Author:
bratseth, Simon Thoresen Hult
  • Method Summary

    Modifier and Type
    Method
    Description
    createPolicy(String name, String param)
    Create a policy of the named type with the named param passed to the constructor of that policy.
    decode(com.yahoo.component.Version version, byte[] payload)
    Decodes the protocol specific data into a routable of the correct type.
    byte[]
    encode(com.yahoo.component.Version version, Routable routable)
    Encodes the protocol specific data of a routable into a byte array.
    Returns a global unique name for this protocol.
  • Method Details

    • getName

      String getName()
      Returns a global unique name for this protocol.
    • encode

      byte[] encode(com.yahoo.component.Version version, Routable routable)
      Encodes the protocol specific data of a routable into a byte array.
      Parameters:
      version - the version to encode for
      routable - the routable to encode
      Returns:
      the encoded data
    • decode

      Routable decode(com.yahoo.component.Version version, byte[] payload)
      Decodes the protocol specific data into a routable of the correct type.
      Parameters:
      version - the version of the serialized routable
      payload - the payload to decode from
      Returns:
      the decoded routable, or null if it could not be decoded
    • createPolicy

      RoutingPolicy createPolicy(String name, String param)
      Create a policy of the named type with the named param passed to the constructor of that policy.
      Parameters:
      name - the name of the policy to create
      param - the parameter to that policy's constructor
      Returns:
      the created policy