trie: added error handling

Created alternate versions of Trie and SecureTrie functions that can return a MissingNodeError (used by ODR services)
This commit is contained in:
zsfelfoldi
2015-11-25 18:28:21 +01:00
parent 66d47ced48
commit 52904ae32f
7 changed files with 346 additions and 71 deletions

View File

@ -62,6 +62,18 @@ func newARC(c int) *arc {
}
}
// Clear clears the cache
func (a *arc) Clear() {
a.mutex.Lock()
defer a.mutex.Unlock()
a.p = 0
a.t1 = list.New()
a.b1 = list.New()
a.t2 = list.New()
a.b2 = list.New()
a.cache = make(map[string]*entry, a.c)
}
// Put inserts a new key-value pair into the cache.
// This optimizes future access to this entry (side effect).
func (a *arc) Put(key hashNode, value node) bool {