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 Deprecated Methods Modifier and Type Method Description CompletableFuture<MeterStoreResult>
addOrUpdateMeter(Meter meter)
Adds a meter to the store or updates a meter in the store.MeterCellId
allocateMeterId(DeviceId deviceId, MeterScope meterScope)
Allocates the first available MeterId.CompletableFuture<MeterStoreResult>
deleteMeter(Meter meter)
Deletes a meter from the store.MeterStoreResult
deleteMeterFeatures(Collection<MeterFeatures> meterfeatures)
Deletes a collection of meter features from the store.MeterStoreResult
deleteMeterFeatures(DeviceId deviceId)
Deletes the meter features from the store.void
failedMeter(MeterOperation op, MeterFailReason reason)
Update the store by deleting the failed meter.void
freeMeterId(DeviceId deviceId, MeterId meterId)
Deprecated.in onos-2.5, freeing an ID is closely related to removal of a meter so, this function is no longer exposed on interfaceCollection<Meter>
getAllMeters()
Returns all meters stored in the store.Collection<Meter>
getAllMeters(DeviceId deviceId)
Returns all meters stored in the store for a precise device.Collection<Meter>
getAllMeters(DeviceId deviceId, MeterScope scope)
Returns all meters stored in the store for a precise device and scope.Meter
getMeter(MeterKey key)
Obtains a meter matching the given meter key.void
purgeMeter(Meter m)
Delete this meter immediately.void
purgeMeters(DeviceId deviceId)
Removes all meters of given device from store.void
purgeMeters(DeviceId deviceId, ApplicationId appId)
Removes all meters of given device and for the given application from store.MeterStoreResult
storeMeterFeatures(Collection<MeterFeatures> meterfeatures)
Adds a collection of meter features to the store.MeterStoreResult
storeMeterFeatures(MeterFeatures meterfeatures)
Adds the meter features to the store.Meter
updateMeterState(Meter meter)
Updates a given meter's state with the provided state.boolean
userDefinedIndexMode(boolean enable)
Enables/disables user defined index mode for the store.-
Methods inherited from interface org.onosproject.store.Store
hasDelegate, setDelegate, unsetDelegate
-
-
-
-
Method Detail
-
addOrUpdateMeter
CompletableFuture<MeterStoreResult> addOrUpdateMeter(Meter meter)
Adds a meter to the store or updates a meter in the store.- Parameters:
meter
- a meter- Returns:
- a future indicating the result of the store operation
-
deleteMeter
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
-
storeMeterFeatures
MeterStoreResult storeMeterFeatures(Collection<MeterFeatures> meterfeatures)
Adds a collection of meter features to the store.- Parameters:
meterfeatures
- the collection of 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
-
deleteMeterFeatures
MeterStoreResult deleteMeterFeatures(Collection<MeterFeatures> meterfeatures)
Deletes a collection of meter features from the store.- Parameters:
meterfeatures
- a collection of meter features- 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
Collection<Meter> getAllMeters()
Returns all meters stored in the store.- Returns:
- an immutable copy of all meters
-
getAllMeters
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
-
getAllMeters
Collection<Meter> getAllMeters(DeviceId deviceId, MeterScope scope)
Returns all meters stored in the store for a precise device and scope.- Parameters:
deviceId
- a device idscope
- meters scope- Returns:
- an immutable copy of the meters stored for a given device withing a given scope
-
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
-
purgeMeter
void purgeMeter(Meter m)
Delete this meter immediately.- Parameters:
m
- a meter
-
allocateMeterId
MeterCellId allocateMeterId(DeviceId deviceId, MeterScope meterScope)
Allocates the first available MeterId.- Parameters:
deviceId
- the device idmeterScope
- the meter scope- Returns:
- the meter Id or null if it was not possible to allocate a meter id
-
freeMeterId
@Deprecated void freeMeterId(DeviceId deviceId, MeterId meterId)
Deprecated.in onos-2.5, freeing an ID is closely related to removal of a meter so, this function is no longer exposed on interfaceFrees the given meter id.- Parameters:
deviceId
- the device idmeterId
- the id to be freed
-
purgeMeters
void purgeMeters(DeviceId deviceId)
Removes all meters of given device from store. This API is typically used when the device is offline.- Parameters:
deviceId
- the device id
-
purgeMeters
void purgeMeters(DeviceId deviceId, ApplicationId appId)
Removes all meters of given device and for the given application from store. This API is typically used when the device is offline.- Parameters:
deviceId
- the device idappId
- the application id
-
userDefinedIndexMode
boolean userDefinedIndexMode(boolean enable)
Enables/disables user defined index mode for the store. In this mode users can provide an index for the meter. Store may reject switching mode requests at run time if meters were already allocated.- Parameters:
enable
- to enable/disable the user defined index mode.- Returns:
- true if user defined index mode is enabled. False otherwise.
-
-