package com.atlassian.bitbucket.mesh.management;

import com.atlassian.bitbucket.mesh.rpc.v1.RpcSidebandFollowerFragment;

import javax.annotation.Nonnull;
import java.io.Closeable;

/**
 * Sends {@link RpcSidebandFollowerFragment sideband fragments} to the control plane.
 */
public interface SidebandSender extends Closeable {

    /**
     * Closes the sideband channel and terminates the underlying request if it is still running.
     */
    @Override
    void close();

    /**
     * Sends the provided {@link RpcSidebandFollowerFragment fragment} to the control plane.
     *
     * @param fragment the fragment to send
     */
    void send(@Nonnull RpcSidebandFollowerFragment fragment);
}
