Rename current db to boltdb

This commit is contained in:
Daan Sprenkels
2020-10-23 16:14:57 +02:00
parent 104dbab335
commit f36fa30eff
9 changed files with 49 additions and 50 deletions

View File

@@ -5,8 +5,7 @@ import (
"net/http"
"time"
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
"gitea.hashru.nl/dsprenkels/rushlink/internal/boltdb"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
@@ -23,7 +22,7 @@ var metricRequestsTotalCounter = prometheus.NewCounterVec(prometheus.CounterOpts
Help: "How many HTTP requests processed, partitioned by status code and HTTP method.",
}, []string{"code", "method"})
func metricURLsTotal(database *db.Database) float64 {
func metricURLsTotal(database *boltdb.Database) float64 {
var metric float64
if err := database.Bolt.View(func(tx *bolt.Tx) error {
bucket := tx.Bucket([]byte("pastes"))
@@ -40,7 +39,7 @@ func metricURLsTotal(database *db.Database) float64 {
}
// StartMetricsServer starts sering Prometheus metrics exports on addr
func StartMetricsServer(addr string, database *db.Database, fs *db.FileStore) {
func StartMetricsServer(addr string, database *boltdb.Database, fs *boltdb.FileStore) {
prometheus.MustRegister(metricRequestsTotalCounter)
prometheus.MustRegister(prometheus.NewGaugeFunc(prometheus.GaugeOpts{