about summary refs log tree commit diff stats
path: root/cache.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache.go')
-rw-r--r--cache.go33
1 files changed, 25 insertions, 8 deletions
diff --git a/cache.go b/cache.go
index 3a7886e..fb32e04 100644
--- a/cache.go
+++ b/cache.go
@@ -75,12 +75,7 @@ func refreshCache() {
 	confObj.Mu.Unlock()
 }
 
-// Pushes the registry's cache data to a local
-// database for safe keeping.
-func pushDatabase() error {
-	db := <-dbChan
-	dbChan <- db
-
+func (lvl dbLevel) push() error {
 	twtxtCache.Mu.RLock()
 	var dbBasket = &leveldb.Batch{}
 	for k, v := range twtxtCache.Users {
@@ -101,7 +96,7 @@ func pushDatabase() error {
 	}
 	remoteRegistries.Mu.RUnlock()
 
-	if err := db.Write(dbBasket, nil); err != nil {
+	if err := lvl.db.Write(dbBasket, nil); err != nil {
 		return err
 	}
 
@@ -112,11 +107,33 @@ func pushDatabase() error {
 	return nil
 }
 
+func (lite dbSqlite) push() error {
+
+	return nil
+}
+
+func (lite dbSqlite) pull() {
+
+}
+
+// Pushes the registry's cache data to a local
+// database for safe keeping.
+func pushDatabase() error {
+	db := <-dbChan
+	dbChan <- db
+
+	return db.push()
+}
+
 func pullDatabase() {
 	db := <-dbChan
 	dbChan <- db
+	db.pull()
+}
+
+func (lvl dbLevel) pull() {
 
-	iter := db.NewIterator(nil, nil)
+	iter := lvl.db.NewIterator(nil, nil)
 
 	for iter.Next() {
 		key := string(iter.Key())