Files
gluetun/internal/storage/storage.go
2021-01-02 01:57:00 +00:00

28 lines
617 B
Go

package storage
import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/golibs/logging"
"github.com/qdm12/golibs/os"
)
type Storage interface {
// Passing an empty filepath disables writing to a file
SyncServers(hardcodedServers models.AllServers) (allServers models.AllServers, err error)
FlushToFile(servers models.AllServers) error
}
type storage struct {
os os.OS
logger logging.Logger
filepath string
}
func New(logger logging.Logger, os os.OS, filepath string) Storage {
return &storage{
os: os,
logger: logger.WithPrefix("storage: "),
filepath: filepath,
}
}