VOL-2868 Model simplification/removal.
Reduced the model to its most commonly used functions. (Removed unused logic & test cases.)
Reworked remaining functions to be more intuitive to use, and to more closely follow golang conventions.
Change-Id: Ibbb267ff37e039b73489b4379aa2654208614d5b
diff --git a/rw_core/core/core.go b/rw_core/core/core.go
index 69cd3c8..5043d47 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -18,7 +18,6 @@
import (
"context"
- "fmt"
"sync"
"time"
@@ -46,8 +45,6 @@
adapterMgr *AdapterManager
config *config.RWCoreFlags
kmp kafka.InterContainerProxy
- clusterDataRoot model.Root
- localDataRoot model.Root
clusterDataProxy *model.Proxy
localDataProxy *model.Proxy
exitChannel chan struct{}
@@ -79,8 +76,6 @@
Timeout: cf.KVStoreTimeout,
LivenessChannelInterval: livenessChannelInterval,
PathPrefix: cf.KVStoreDataPrefix}
- core.clusterDataRoot = model.NewRoot(&voltha.Voltha{}, &core.backend)
- core.localDataRoot = model.NewRoot(&voltha.CoreInstance{}, &core.backend)
return &core
}
@@ -112,18 +107,9 @@
if p != nil {
p.UpdateStatus("kv-store", probe.ServiceStatusRunning)
}
- var err error
- core.clusterDataProxy, err = core.clusterDataRoot.CreateProxy(ctx, "/", false)
- if err != nil {
- probe.UpdateStatusFromContext(ctx, "kv-store", probe.ServiceStatusNotReady)
- return fmt.Errorf("Failed to create cluster data proxy")
- }
- core.localDataProxy, err = core.localDataRoot.CreateProxy(ctx, "/", false)
- if err != nil {
- probe.UpdateStatusFromContext(ctx, "kv-store", probe.ServiceStatusNotReady)
- return fmt.Errorf("Failed to create local data proxy")
- }
+ core.clusterDataProxy = model.NewProxy(&core.backend, "/")
+ core.localDataProxy = model.NewProxy(&core.backend, "/")
// core.kmp must be created before deviceMgr and adapterMgr, as they will make
// private copies of the poiner to core.kmp.