[VOL-4211] Persist meters in the Core
Change-Id: I0f9a2914996a69be080bd8f77b3c7ae6cc902cb3
diff --git a/rw_core/core/device/logical_agent.go b/rw_core/core/device/logical_agent.go
index a12bd2d..b9ad95a 100644
--- a/rw_core/core/device/logical_agent.go
+++ b/rw_core/core/device/logical_agent.go
@@ -58,10 +58,10 @@
startOnce sync.Once
stopOnce sync.Once
- flowCache *flow.Cache
- meterCache *meter.Cache
- groupCache *group.Cache
- portLoader *port.Loader
+ flowCache *flow.Cache
+ meterLoader *meter.Loader
+ groupCache *group.Cache
+ portLoader *port.Loader
}
func newLogicalAgent(ctx context.Context, id string, sn string, deviceID string, ldeviceMgr *LogicalManager,
@@ -78,10 +78,10 @@
defaultTimeout: defaultTimeout,
requestQueue: coreutils.NewRequestQueue(),
- flowCache: flow.NewCache(),
- groupCache: group.NewCache(),
- meterCache: meter.NewCache(),
- portLoader: port.NewLoader(dbProxy.SubPath("logical_ports").Proxy(id)),
+ flowCache: flow.NewCache(),
+ groupCache: group.NewCache(),
+ meterLoader: meter.NewLoader(dbProxy.SubPath("logical_meters").Proxy(id)),
+ portLoader: port.NewLoader(dbProxy.SubPath("logical_ports").Proxy(id)),
}
}
@@ -163,6 +163,9 @@
// now that the root device is known, create DeviceRoutes with it
agent.deviceRoutes = route.NewDeviceRoutes(agent.logicalDeviceID, agent.rootDeviceID, agent.deviceMgr.listDevicePorts)
+ // load the meters from KV to cache
+ agent.meterLoader.Load(ctx)
+
// load the logical ports from KV to cache
agent.portLoader.Load(ctx)
}