-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flushing Memtree #6
Conversation
mutable_tree.go
Outdated
@@ -16,6 +16,7 @@ type MutableTree struct { | |||
*ImmutableTree // The current, working tree. | |||
lastSaved *ImmutableTree // The most recently saved tree. | |||
orphans map[string]int64 // Nodes removed by changes to working tree. | |||
memversions map[int64]bool // The previous, saved versions of the tree in mem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memversions
-> memVersions
mutable_tree.go
Outdated
@@ -364,11 +366,44 @@ func (tree *MutableTree) GetVersioned(key []byte, version int64) ( | |||
return -1, nil | |||
} | |||
|
|||
var nextTimeClear = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to do anything
mutable_tree.go
Outdated
version := tree.version + 1 | ||
|
||
if flushToDisk == true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if flushToDisk {
mutable_tree.go
Outdated
} | ||
|
||
func (tree *MutableTree) DeleteVersionFull(version int64, memDeleteAlso bool) error { | ||
if tree.memversions[version] == true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if tree.memversions[version]
mutable_tree.go
Outdated
func (tree *MutableTree) DeleteVersionFull(version int64, memDeleteAlso bool) error { | ||
if tree.memversions[version] == true { | ||
//sometimes you dont want to bother deleting versions in memory | ||
if memDeleteAlso == false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if !memDeleteAlso
nodedb.go
Outdated
ndb.mtx.Lock() | ||
defer ndb.mtx.Unlock() | ||
|
||
if node.hash == nil { | ||
panic("Expected to find node.hash, but none found.") | ||
} | ||
if node.persistedMem == true && flushToDisk == false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if node.persistedMem && !flushToDisk
nodedb.go
Outdated
|
||
node.persisted = true | ||
ndb.cacheNode(node) | ||
if flushToDisk == true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if flushToDisk {
nodedb.go
Outdated
if node.persisted { | ||
return node.hash | ||
} | ||
if node.persistedMem && flushToDisk == false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if node.persistedMem && !flushToDisk
nodedb.go
Outdated
|
||
node.leftNode = nil | ||
node.rightNode = nil | ||
if flushToDisk == true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> if flushToDisk {
nodedb.go
Outdated
return ndb.getPreviousVersioni(version, ndb.db) | ||
} | ||
|
||
func (ndb *nodeDB) getPreviousVersioni(version int64, db dbm.DB) int64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPreviousVersioni
-> getPreviousVersionFromDB
Allows using two DBS for storing data.