package meerkat.bulletinboard;

import com.google.common.util.concurrent.FutureCallback;
import meerkat.protobuf.BulletinBoardApi.*;

import java.util.List;

/**
 * Created by Arbel Deutsch Peled on 03-Mar-16.
 * This interface defines the behaviour required from a subscription service to Bulletin Board messages
 */
public interface BulletinBoardSubscriber {

    /**
     * Subscribes to a notifier that will return any new messages on the server that match the given filters
     * In case of communication error: the subscription is terminated
     * @param filterList defines the set of filters for message retrieval
     * @param callback defines how to handle new messages received and/or a failures in communication
     */
    public void subscribe(MessageFilterList filterList, FutureCallback<List<BulletinBoardMessage>> callback);

    /**
     * Subscribes to a notifier that will return any new messages on the server that match the given filters
     * In case of communication error: the subscription is terminated
     * @param filterList defines the set of filters for message retrieval
     * @param startEntry defines the first entry number to consider
     * @param callback defines how to handle new messages received and/or a failures in communication
     */
    public void subscribe(MessageFilterList filterList, long startEntry, FutureCallback<List<BulletinBoardMessage>> callback);

}
