blob: c5f26cdb1a692fcaea8419787e5c78fe50566f26 [file] [log] [blame]
Jian Li8f64feb2018-07-24 13:20:16 +09001/*
2 * Copyright 2018-present Open Networking Foundation
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.onosproject.openstacknetworking.api;
17
18/**
19 * Handles precommit request.
20 */
Jian Li628a7cb2018-08-11 23:04:24 +090021public interface PreCommitService<T, E, S> {
Jian Li8f64feb2018-07-24 13:20:16 +090022
23 /**
24 * Subscribes pre-update event for the given subject inside the given class.
25 *
26 * @param subject subject to subscribe
27 * @param eventType event type (update or remove)
28 * @param className target class name
29 */
30 void subscribePreCommit(T subject, E eventType, String className);
31
32 /**
33 * Unsubscribes pre-update event for the given subject inside the given class.
34 *
35 * @param subject subject to unsubscribe
36 * @param eventType event type (update or remove)
Jian Li628a7cb2018-08-11 23:04:24 +090037 * @param service service instance
Jian Li8f64feb2018-07-24 13:20:16 +090038 * @param className target class name
39 */
Jian Li628a7cb2018-08-11 23:04:24 +090040 void unsubscribePreCommit(T subject, E eventType, S service, String className);
Jian Li8f64feb2018-07-24 13:20:16 +090041
42 /**
43 * Obtains the count value of subscribers for the given subject and event type.
44 *
45 * @param subject subject to subscribe
46 * @param eventType event type (update or remove)
47 * @return subscriber count
48 */
49 int subscriberCountByEventType(T subject, E eventType);
50
51 /**
52 * Obtains the count value of subscribers for the given subject.
53 *
54 * @param subject subject to subscribe
55 * @return subscriber count
56 */
57 int subscriberCount(T subject);
58}