[VOL-4178, VOL-3952] This commit removes flows/groups/meters persistency
This commit removes flows/groups/meters persistency from rw-core.
As part of this change, it also fixes a bug where devices were not
being loaded on an rw-core restart. This is a necessary condition
to allow the non-persistency of flows/groups/meters to work.
This commit also renames "loader" to "cache" for the flows/groups/
meters to differentiate between data that is loaded from the KV
store and the one in cache.
Change-Id: Ib14e1450021abe30b17673c2910768fb740dba51
diff --git a/rw_core/core/device/transientstate/loader.go b/rw_core/core/device/transientstate/loader.go
index f8710cc..411515f 100644
--- a/rw_core/core/device/transientstate/loader.go
+++ b/rw_core/core/device/transientstate/loader.go
@@ -58,11 +58,16 @@
defer loader.lock.Unlock()
var deviceTransientState voltha.DeviceTransientState
- if have, err := loader.dbProxy.Get(ctx, loader.deviceTransientState.deviceID, &deviceTransientState); err != nil || !have {
+ have, err := loader.dbProxy.Get(ctx, loader.deviceTransientState.deviceID, &deviceTransientState)
+ if err != nil {
logger.Errorw(ctx, "failed-to-get-device-transient-state-from-cluster-data-proxy", log.Fields{"error": err})
return
}
- loader.deviceTransientState.transientState = deviceTransientState.TransientState
+ if have {
+ loader.deviceTransientState.transientState = deviceTransientState.TransientState
+ return
+ }
+ loader.deviceTransientState.transientState = voltha.DeviceTransientState_NONE
}
// Lock acquires the lock for deviceTransientStateLoader, and returns a handle