Interface MeterStore

    • 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 id
        scope - 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 operation
        reason - 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 id
        meterScope - 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 interface
        Frees the given meter id.
        Parameters:
        deviceId - the device id
        meterId - 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 id
        appId - 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.