diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-12-19 21:21:56 -0500 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-12-19 21:21:56 -0500 |
commit | e53b843a93922f21289b9fc4958f1dfc47a49bdf (patch) | |
tree | a98cc9358ccf773a7615b42802bb825d7be0bc0d /svc/leveldb.go | |
parent | 7db28dd705dd5463b5e2e9cf6f5fc87db25533ad (diff) | |
download | getwtxt-e53b843a93922f21289b9fc4958f1dfc47a49bdf.tar.gz |
some functions were missing comments. added those in where needed.
Diffstat (limited to 'svc/leveldb.go')
-rw-r--r-- | svc/leveldb.go | 6 |
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() |