blob: 246ece851992aa1cbd42b4f67ef690c82dec19cc [file] [log] [blame]
Brian O'Connorfa81eae2014-10-30 13:20:05 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onlab.onos.net.intent;
17
Brian O'Connor72a034c2014-11-26 18:24:23 -080018import org.onlab.onos.core.ApplicationId;
19
Brian O'Connorfa81eae2014-10-30 13:20:05 -070020import java.util.Set;
21
22/**
23 * Service for tracking and delegating batches of intent operations.
24 */
25public interface IntentBatchService {
26
27 /**
28 * Submits a batch of intent operations.
29 *
30 * @param operations batch of operations
31 */
32 void addIntentOperations(IntentOperations operations);
33
34 /**
35 * Removes the specified batch of intent operations after completion.
36 *
37 * @param operations batch of operations
38 */
39 void removeIntentOperations(IntentOperations operations);
40
41 /**
Brian O'Connor427a1762014-11-19 18:40:32 -080042 * Returns the set of intent batches that are pending.
Brian O'Connorfa81eae2014-10-30 13:20:05 -070043 * @return set of batches
44 */
Brian O'Connor427a1762014-11-19 18:40:32 -080045 Set<IntentOperations> getPendingOperations();
46
47 /**
Brian O'Connor72a034c2014-11-26 18:24:23 -080048 * Return true if this instance is the local leader for batch
49 * processing a given application id.
50 *
alshabiba9819bf2014-11-30 18:15:52 -080051 * @param applicationId an application id
52 * @return true if this instance is the local leader for batch
Brian O'Connor72a034c2014-11-26 18:24:23 -080053 */
54 boolean isLocalLeader(ApplicationId applicationId);
55
56 /**
Brian O'Connorfa81eae2014-10-30 13:20:05 -070057 * Sets the batch service delegate.
58 *
59 * @param delegate delegate to apply
60 */
61 void setDelegate(IntentBatchDelegate delegate);
62
63 /**
64 * Unsets the batch service delegate.
65 *
66 * @param delegate delegate to unset
67 */
68 void unsetDelegate(IntentBatchDelegate delegate);
69
Brian O'Connor86f6f7f2014-12-01 17:02:45 -080070 /**
71 * Adds the specified listener for intent batch leadership events.
72 *
73 * @param listener listener to be added
74 */
75 void addListener(IntentBatchListener listener);
76
77 /**
78 * Removes the specified listener for intent batch leadership events.
79 *
80 * @param listener listener to be removed
81 */
82 void removeListener(IntentBatchListener listener);
Brian O'Connorfa81eae2014-10-30 13:20:05 -070083}