Descriptionimpl/memory: Replace gkvlite with "treapstore".
gkvlite is the treap (tree + heap)-based key/value store used by
"impl/memory"'s backend. While it is very powerful package, its
complexity and ensuing requirements make it a somewhat-imperfect fit.
Specifically, "gkvlite" is built around resources that must be
explicitly allocated and free'd. While this makes a lot of sense for its
on-disk storage functionality, we don't use that functionality, and
integrating snapshot closing into every layer of "impl/memory" is
non-trivial.
Enter "treapstore", a treap-based storage implementation that closesly
mirrors the functionality in "gkvlite" that "impl/memory" uses, but
specifically focuses the in-memory use case. Because "treapstore"
foregoes node reuse and snapshot cleanup, we can rely entirely on Go's
memory manager to clean things up, removing the need to close things.
"treapstore" builds on an extended version of "gkvlite"'s underlying
"gtreap" package which introduces an iterator. This iterator removes the
need for the goroutine- and callback-based iteration implementations
that "impl/memory" used to interface with gkvlite (and "gtreap")'s
VisitItemsAscend method, resulting in signifcantly cleaner and likely
higher perfomant code. "treapstore" iterators don't have any cleanup
requirements. Consqeuently, explicit resource management via "stop" is
no longer necessary to perform iteration.
BUG=chromium:675485
TEST=unit
Review-Url: https://codereview.chromium.org/2604943002
Committed: https://github.com/luci/gae/commit/951a9bd6e11300d097436f797c397d42334c742e
Patch Set 1 #Patch Set 2 : Cleaner multiIterate loop. #
Total comments: 4
Patch Set 3 : Cleaner iteration, comment fix. #Patch Set 4 : Update API for get/create. #
Total comments: 10
Patch Set 5 : Comments. #
Messages
Total messages: 12 (5 generated)
|