Store factory to make store optional

This commit is contained in:
Michal Horejsek
2020-05-25 15:34:18 +02:00
parent 3b0b1a457b
commit 40d8c458d2
16 changed files with 338 additions and 235 deletions

View File

@ -18,25 +18,17 @@
package users
import (
"github.com/ProtonMail/proton-bridge/internal/store"
"github.com/ProtonMail/proton-bridge/internal/users/credentials"
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
)
type Configer interface {
ClearData() error
GetDBDir() string
GetVersion() string
GetIMAPCachePath() string
GetAPIConfig() *pmapi.ClientConfig
}
type PreferenceProvider interface {
Get(key string) string
GetBool(key string) bool
GetInt(key string) int
Set(key string, value string)
}
type PanicHandler interface {
HandlePanic()
}
@ -62,3 +54,8 @@ type ClientManager interface {
CheckConnection() error
SetUserAgent(clientName, clientVersion, os string)
}
type StoreMaker interface {
New(user store.BridgeUser) (*store.Store, error)
Remove(userID string) error
}