func RXBytes() int64 {
	return atomic.LoadInt64(&rxBytes)
}
RXBytes returns the total number of bytes received over the network
package metrics
import (
	"sync/atomic"
	"github.com/mdlayher/wavepipe/common"
	"github.com/mdlayher/wavepipe/data"
)
var (
	rxBytes int64
	txBytes int64
)
type Metrics struct {
	Database *DatabaseMetrics `json:"database"`
	Network  *NetworkMetrics  `json:"network"`
}
type DatabaseMetrics struct {
	Updated int64 `json:"updated"`
	Artists int64 `json:"artists"`
	Albums  int64 `json:"albums"`
	Songs   int64 `json:"songs"`
	Folders int64 `json:"folders"`
	Art     int64 `json:"art"`
}
type NetworkMetrics struct {
	RXBytes int64 `json:"rxBytes"`
	TXBytes int64 `json:"txBytes"`
}
func GetDatabaseMetrics() (*DatabaseMetrics, error) {
	artists, err := data.DB.CountArtists()
	if err != nil {
		return nil, err
	}
	albums, err := data.DB.CountAlbums()
	if err != nil {
		return nil, err
	}
	songs, err := data.DB.CountSongs()
	if err != nil {
		return nil, err
	}
	folders, err := data.DB.CountFolders()
	if err != nil {
		return nil, err
	}
	art, err := data.DB.CountArt()
	if err != nil {
		return nil, err
	}
	return &DatabaseMetrics{
		Updated: common.ScanTime(),
		Artists: artists,
		Albums:  albums,
		Songs:   songs,
		Art:     art,
		Folders: folders,
	}, nil
}
func AddRXBytes(count int64) {
	atomic.AddInt64(&rxBytes, count)
}
func AddTXBytes(count int64) {
	atomic.AddInt64(&txBytes, count)
}