blob: 0d2b3cae1a546dbb07d81535a46b414e8151de10 [file] [log] [blame]
Jonathan Hart9a426f82015-09-03 15:43:13 +02001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Jonathan Hart9a426f82015-09-03 15:43:13 +02003 *
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 */
16
Jonathan Hart470ed4f2017-01-31 16:52:28 -080017package org.onosproject.intentsync;
Jonathan Hart9a426f82015-09-03 15:43:13 +020018
Luca Prete2705d662016-04-29 15:30:23 -070019import org.onosproject.core.ApplicationId;
Jonathan Hart9a426f82015-09-03 15:43:13 +020020import org.onosproject.net.intent.Intent;
21
22/**
23 * Submits and withdraws intents to the IntentService from a single point in
24 * the cluster at any one time. The provided intents will be synchronized with
25 * the IntentService on leadership change.
Jonathan Hart470ed4f2017-01-31 16:52:28 -080026 * <p>
27 * This is a sample utility and not part of the core ONOS API. This means it is
28 * subject to change or to be removed. It is recommended to consider using one
29 * of the built-in ONOS distributed primitives such as the
30 * {@link org.onosproject.store.service.WorkQueue} instead of using this.
31 * </p>
Jonathan Hart9a426f82015-09-03 15:43:13 +020032 */
33public interface IntentSynchronizationService {
34
35 /**
36 * Submits and intent to the synchronizer.
37 * <p>
38 * The intent will be submitted directly to the IntentService if this node
39 * is the leader, otherwise it will be stored in the synchronizer for
40 * synchronization if this node becomes the leader.
41 * </p>
42 *
43 * @param intent intent to submit
44 */
45 void submit(Intent intent);
46
47 /**
48 * Withdraws an intent from the synchronizer.
49 * <p>
50 * The intent will be withdrawn directly from the IntentService if this node
51 * is the leader. The intent will be removed from the synchronizer's
52 * in-memory storage.
53 * </p>
54 *
55 * @param intent intent to withdraw
56 */
57 void withdraw(Intent intent);
Luca Prete2705d662016-04-29 15:30:23 -070058
59 /**
60 * Withdraws intents by app Id.
61 *
62 * @param applicationId the Id of the application that created the intents
63 * to be removed
64 */
65 void removeIntentsByAppId(ApplicationId applicationId);
Jonathan Hart9a426f82015-09-03 15:43:13 +020066}