Basic service boilerplate for settings bundles

This commit is contained in:
Benedikt Kulmann
2020-04-16 10:07:45 +02:00
parent a8af03c338
commit 5b89729d1e
18 changed files with 1006 additions and 141 deletions
+22
View File
@@ -0,0 +1,22 @@
package settings
import (
"github.com/owncloud/ocis-settings/pkg/config"
"github.com/owncloud/ocis-settings/pkg/proto/v0"
)
var (
// Registry uses the strategy pattern as a registry
Registry = map[string]RegisterFunc{}
)
// RegisterFunc stores store constructors
type RegisterFunc func(*config.Config) Manager
// Manager
type Manager interface {
Read(extension string, key string) (*proto.SettingsBundle, error)
Write(bundle *proto.SettingsBundle) (*proto.SettingsBundle, error)
List() ([]*proto.SettingsBundle, error)
ListByExtension(extension string) ([]*proto.SettingsBundle, error)
}