blob: 4b9499758015d0713037bc2e74f8961d24af30c7 [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 */
21public interface PreCommitService<T, E> {
22
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)
37 * @param className target class name
38 */
39 void unsubscribePreCommit(T subject, E eventType, String className);
40
41 /**
42 * Obtains the count value of subscribers for the given subject and event type.
43 *
44 * @param subject subject to subscribe
45 * @param eventType event type (update or remove)
46 * @return subscriber count
47 */
48 int subscriberCountByEventType(T subject, E eventType);
49
50 /**
51 * Obtains the count value of subscribers for the given subject.
52 *
53 * @param subject subject to subscribe
54 * @return subscriber count
55 */
56 int subscriberCount(T subject);
57}