VOL-1174: Keep only latest data and apply changes only when committed.
Change-Id: I2311eb9cf1487b39f23066df50d19b47fd5c7dcc
diff --git a/db/model/root.go b/db/model/root.go
index 1c14f9a..3e3cc43 100644
--- a/db/model/root.go
+++ b/db/model/root.go
@@ -35,15 +35,16 @@
NotificationCallbacks []CallbackTuple
}
-func NewRoot(initialData interface{}, kvStore *Backend, revisionClass interface{}) *Root {
+func NewRoot(initialData interface{}, kvStore *Backend) *Root {
root := &Root{}
root.KvStore = kvStore
root.DirtyNodes = make(map[string][]*Node)
root.Loading = false
- if kvStore != nil /*&& TODO: RevisionClass is not a subclass of PersistedRevision ??? */ {
- revisionClass = reflect.TypeOf(PersistedRevision{})
+ if kvStore != nil {
+ root.RevisionClass = reflect.TypeOf(PersistedRevision{})
+ } else {
+ root.RevisionClass = reflect.TypeOf(NonPersistedRevision{})
}
- root.RevisionClass = revisionClass
root.Callbacks = []CallbackTuple{}
root.NotificationCallbacks = []CallbackTuple{}
@@ -188,8 +189,8 @@
func (r *Root) Load(rootClass interface{}) *Root {
//fakeKvStore := &Backend{}
- //root := NewRoot(rootClass, fakeKvStore, PersistedRevision{})
- //r.KvStore = KvStore
+ //root := NewRoot(rootClass, nil)
+ //root.KvStore = r.KvStore
r.loadFromPersistence(rootClass)
return r
}