Interface P2PHeader<LOCATOR>

  • Type Parameters:
    LOCATOR - The locator defines the type which identifies a source and a destination (or stop-overs) of a P2PMessage.
    All Superinterfaces:
    org.refcodes.mixin.DestinationAccessor<LOCATOR>, HopsAccessor<LOCATOR>, org.refcodes.mixin.SourceAccessor<LOCATOR>
    All Known Implementing Classes:
    AbstractP2PHeader

    public interface P2PHeader<LOCATOR>
    extends org.refcodes.mixin.SourceAccessor<LOCATOR>, org.refcodes.mixin.DestinationAccessor<LOCATOR>, HopsAccessor<LOCATOR>
    The P2PHeader defines the least required attributes describing a P2PMessage.
    • Method Detail

      • getHops

        LOCATOR[] getHops()
        Retrieves the trail of peers already passed.
        Specified by:
        getHops in interface HopsAccessor<LOCATOR>
        Returns:
        The trail of peers already passed (in order to avoid turning circles when determining the hop count).
      • appendHop

        void appendHop​(LOCATOR aLocator)
        Adds a stop-over peer, being the peer which received the message for dispatching to the next peer. The stop-over will be prepended to the trail of peers.
        Parameters:
        aLocator - the stop-over peer while dispatching the message.
      • containsHop

        default boolean containsHop​(LOCATOR aLocator)
        Tests whether the providing P2PMessage has already stopped over the given Peer.
        Parameters:
        aLocator - The locator of the Peer in question.
        Returns:
        True in case the according P2PMessage has already stopped over the Peer in question.