alshabib | 7bb0501 | 2015-08-05 10:15:09 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2015 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 | */ |
| 16 | package org.onosproject.incubator.net.meter; |
| 17 | |
| 18 | import org.onosproject.store.Store; |
| 19 | |
| 20 | import java.util.Collection; |
| 21 | |
| 22 | /** |
| 23 | * Entity that stores and distributed meter objects. |
| 24 | */ |
| 25 | public interface MeterStore extends Store<MeterEvent, MeterStoreDelegate> { |
| 26 | |
| 27 | /** |
| 28 | * Adds a meter to the store. |
| 29 | * |
| 30 | * @param meter a meter |
| 31 | */ |
| 32 | void storeMeter(Meter meter); |
| 33 | |
| 34 | /** |
| 35 | * Deletes a meter from the store. |
| 36 | * |
| 37 | * @param meter a meter |
| 38 | */ |
| 39 | void deleteMeter(Meter meter); |
| 40 | |
| 41 | /** |
| 42 | * Updates a meter whose meter id is the same as the passed meter. |
| 43 | * |
| 44 | * @param meter a new meter |
| 45 | */ |
| 46 | void updateMeter(Meter meter); |
| 47 | |
| 48 | /** |
| 49 | * Updates a given meter's state with the provided state. |
| 50 | * @param meter a meter |
| 51 | */ |
| 52 | void updateMeterState(Meter meter); |
| 53 | |
| 54 | /** |
| 55 | * Obtains a meter matching the given meter id. |
| 56 | * |
| 57 | * @param meterId a meter id |
| 58 | * @return a meter |
| 59 | */ |
| 60 | Meter getMeter(MeterId meterId); |
| 61 | |
| 62 | /** |
| 63 | * Returns all meters stored in the store. |
| 64 | * |
| 65 | * @return a collection of meters |
| 66 | */ |
| 67 | Collection<Meter> getAllMeters(); |
| 68 | |
| 69 | /** |
| 70 | * Update the store by deleting the failed meter. |
| 71 | * Notifies the delegate that the meter failed to allow it |
| 72 | * to nofity the app. |
| 73 | * |
| 74 | * @param op a failed meter operation |
| 75 | * @param reason a failure reason |
| 76 | */ |
| 77 | void failedMeter(MeterOperation op, MeterFailReason reason); |
| 78 | } |