Jian Li | 8f64feb | 2018-07-24 13:20:16 +0900 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.openstacknetworking.api; |
| 17 | |
| 18 | /** |
| 19 | * Handles precommit request. |
| 20 | */ |
Jian Li | 628a7cb | 2018-08-11 23:04:24 +0900 | [diff] [blame] | 21 | public interface PreCommitService<T, E, S> { |
Jian Li | 8f64feb | 2018-07-24 13:20:16 +0900 | [diff] [blame] | 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) |
Jian Li | 628a7cb | 2018-08-11 23:04:24 +0900 | [diff] [blame] | 37 | * @param service service instance |
Jian Li | 8f64feb | 2018-07-24 13:20:16 +0900 | [diff] [blame] | 38 | * @param className target class name |
| 39 | */ |
Jian Li | 628a7cb | 2018-08-11 23:04:24 +0900 | [diff] [blame] | 40 | void unsubscribePreCommit(T subject, E eventType, S service, String className); |
Jian Li | 8f64feb | 2018-07-24 13:20:16 +0900 | [diff] [blame] | 41 | |
| 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 | } |