Package org.onosproject.net.meter
Interface MeterStore
-
- All Superinterfaces:
Store<MeterEvent,MeterStoreDelegate>
public interface MeterStore extends Store<MeterEvent,MeterStoreDelegate>
Entity that stores and distributed meter objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MeterId
allocateMeterId(DeviceId deviceId)
Allocates the first available MeterId.java.util.concurrent.CompletableFuture<MeterStoreResult>
deleteMeter(Meter meter)
Deletes a meter from the store.MeterStoreResult
deleteMeterFeatures(DeviceId deviceId)
Deletes the meter features from the store.void
deleteMeterNow(Meter m)
Delete this meter immediately.void
failedMeter(MeterOperation op, MeterFailReason reason)
Update the store by deleting the failed meter.void
freeMeterId(DeviceId deviceId, MeterId meterId)
Frees the given meter id.java.util.Collection<Meter>
getAllMeters()
Returns all meters stored in the store.java.util.Collection<Meter>
getAllMeters(DeviceId deviceId)
Returns all meters stored in the store for a precise device.long
getMaxMeters(MeterFeaturesKey key)
Retrieve maximum meters available for the device.Meter
getMeter(MeterKey key)
Obtains a meter matching the given meter key.void
purgeMeter(DeviceId deviceId)
Removes all meters of given device from store.java.util.concurrent.CompletableFuture<MeterStoreResult>
storeMeter(Meter meter)
Adds a meter to the store.MeterStoreResult
storeMeterFeatures(MeterFeatures meterfeatures)
Adds the meter features to the store.java.util.concurrent.CompletableFuture<MeterStoreResult>
updateMeter(Meter meter)
Updates a meter whose meter id is the same as the passed meter.Meter
updateMeterState(Meter meter)
Updates a given meter's state with the provided state.-
Methods inherited from interface org.onosproject.store.Store
hasDelegate, setDelegate, unsetDelegate
-
-
-
-
Method Detail
-
storeMeter
java.util.concurrent.CompletableFuture<MeterStoreResult> storeMeter(Meter meter)
Adds a meter to the store.- Parameters:
meter
- a meter- Returns:
- a future indicating the result of the store operation
-
deleteMeter
java.util.concurrent.CompletableFuture<MeterStoreResult> deleteMeter(Meter meter)
Deletes a meter from the store.- Parameters:
meter
- a meter- Returns:
- a future indicating the result of the store operation
-
storeMeterFeatures
MeterStoreResult storeMeterFeatures(MeterFeatures meterfeatures)
Adds the meter features to the store.- Parameters:
meterfeatures
- the meter features- Returns:
- the result of the store operation
-
deleteMeterFeatures
MeterStoreResult deleteMeterFeatures(DeviceId deviceId)
Deletes the meter features from the store.- Parameters:
deviceId
- the device id- Returns:
- a future indicating the result of the store operation
-
updateMeter
java.util.concurrent.CompletableFuture<MeterStoreResult> updateMeter(Meter meter)
Updates a meter whose meter id is the same as the passed meter.- Parameters:
meter
- a new meter- Returns:
- a future indicating the result of the store operation
-
updateMeterState
Meter updateMeterState(Meter meter)
Updates a given meter's state with the provided state.- Parameters:
meter
- a meter- Returns:
- the updated meter
-
getMeter
Meter getMeter(MeterKey key)
Obtains a meter matching the given meter key.- Parameters:
key
- a meter key- Returns:
- a meter
-
getAllMeters
java.util.Collection<Meter> getAllMeters()
Returns all meters stored in the store.- Returns:
- an immutable copy of all meters
-
getAllMeters
java.util.Collection<Meter> getAllMeters(DeviceId deviceId)
Returns all meters stored in the store for a precise device.- Parameters:
deviceId
- the device to get the meter list from- Returns:
- an immutable copy of the meters stored for a given device
-
failedMeter
void failedMeter(MeterOperation op, MeterFailReason reason)
Update the store by deleting the failed meter. Notifies the delegate that the meter failed to allow it to nofity the app.- Parameters:
op
- a failed meter operationreason
- a failure reason
-
deleteMeterNow
void deleteMeterNow(Meter m)
Delete this meter immediately.- Parameters:
m
- a meter
-
getMaxMeters
long getMaxMeters(MeterFeaturesKey key)
Retrieve maximum meters available for the device.- Parameters:
key
- the meter features key- Returns:
- the maximum number of meters supported by the device
-
allocateMeterId
MeterId allocateMeterId(DeviceId deviceId)
Allocates the first available MeterId.- Parameters:
deviceId
- the device id- Returns:
- the meter Id or null if it was not possible to allocate a meter id
-
freeMeterId
void freeMeterId(DeviceId deviceId, MeterId meterId)
Frees the given meter id.- Parameters:
deviceId
- the device idmeterId
- the id to be freed
-
purgeMeter
void purgeMeter(DeviceId deviceId)
Removes all meters of given device from store.- Parameters:
deviceId
- the device id
-
-