summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--store/page.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/store/page.go b/store/page.go
index f5971cc..2ecd9ca 100644
--- a/store/page.go
+++ b/store/page.go
@@ -21,7 +21,7 @@ func (s *Store) pageDB(variant string) *leveldb.DB {
s.pageldb[variant] = db
if _, err = db.Get([]byte("\000"), nil); err != nil {
log.Infof("Page variant %s created.", variant)
- s.pageSetTotalCount(variant, 0)
+ s.pageSetTotalCountNoDestroy(variant, 0)
}
return db
}
@@ -57,12 +57,8 @@ func (s *Store) pageGetTotalCount(variant string) uint64 {
return 0
}
-// pageSetTotalCount sets total count of a page variant and destroys it if zero.
-func (s *Store) pageSetTotalCount(variant string, value uint64) {
- if value == 0 {
- s.pageDBDestroy(variant)
- return
- }
+// pageSetTotalCountNoDestroy sets total count of a page variant.
+func (s *Store) pageSetTotalCountNoDestroy(variant string, value uint64) {
db := s.pageDB(variant)
payload := make([]byte, 8)
@@ -73,6 +69,15 @@ func (s *Store) pageSetTotalCount(variant string, value uint64) {
}
}
+// pageSetTotalCount sets total count of a page variant and destroys it if zero.
+func (s *Store) pageSetTotalCount(variant string, value uint64) {
+ if value == 0 {
+ s.pageDBDestroy(variant)
+ return
+ }
+ s.pageSetTotalCountNoDestroy(variant, value)
+}
+
// pageAdvanceTotalCount advances total count of a page variant.
func (s *Store) pageAdvanceTotalCount(variant string) {
s.pageSetTotalCount(variant, s.pageGetTotalCount(variant)+1)