summary refs log tree commit diff stats
path: root/svc/leveldb.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-12-19 21:21:56 -0500
committerBen Morrison <ben@gbmor.dev>2019-12-19 21:21:56 -0500
commite53b843a93922f21289b9fc4958f1dfc47a49bdf (patch)
treea98cc9358ccf773a7615b42802bb825d7be0bc0d /svc/leveldb.go
parent7db28dd705dd5463b5e2e9cf6f5fc87db25533ad (diff)
downloadgetwtxt-e53b843a93922f21289b9fc4958f1dfc47a49bdf.tar.gz
some functions were missing comments. added those in where needed.
Diffstat (limited to 'svc/leveldb.go')
-rw-r--r--svc/leveldb.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/svc/leveldb.go b/svc/leveldb.go
index 31f0953..16751ce 100644
--- a/svc/leveldb.go
+++ b/svc/leveldb.go
@@ -28,10 +28,13 @@ import (
 	"github.com/syndtr/goleveldb/leveldb"
 )
 
+// Wrapper type for the LevelDB connection
 type dbLevel struct {
 	db *leveldb.DB
 }
 
+// Called intermittently to commit registry data to
+// a LevelDB database.
 func (lvl *dbLevel) push() error {
 	twtxtCache.Mu.RLock()
 	defer twtxtCache.Mu.RUnlock()
@@ -57,6 +60,9 @@ func (lvl *dbLevel) push() error {
 	return lvl.db.Write(dbBasket, nil)
 }
 
+// Called on startup to retrieve previously-committed data
+// from a LevelDB database. Stores the retrieved data in
+// memory.
 func (lvl *dbLevel) pull() {
 	iter := lvl.db.NewIterator(nil, nil)
 	twtxtCache.Mu.Lock()