Add Store service for Focalboard multi-product architecture (#20568)
* add Store service
Этот коммит содержится в:
@@ -102,6 +102,7 @@ const (
|
||||
LogKey ServiceKey = "log"
|
||||
HooksKey ServiceKey = "hooks"
|
||||
KVStoreKey ServiceKey = "kvstore"
|
||||
StoreKey ServiceKey = "storekey"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
@@ -402,6 +403,7 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
LogKey: s.GetLogger(),
|
||||
CloudKey: &cloudWrapper{cloud: s.Cloud},
|
||||
KVStoreKey: &kvStoreWrapper{srv: s},
|
||||
StoreKey: store.NewStoreServiceAdapter(s.Store),
|
||||
}
|
||||
|
||||
// Step 8: Initialize products.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package product
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"io"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
@@ -167,3 +168,10 @@ type KVStoreService interface {
|
||||
type LogService interface {
|
||||
mlog.LoggerIFace
|
||||
}
|
||||
|
||||
// StoreService is the API for accessing the Store service APIs.
|
||||
//
|
||||
// The service shall be registered via app.StoreKey service key.
|
||||
type StoreService interface {
|
||||
GetMasterDB() *sql.DB
|
||||
}
|
||||
|
||||
@@ -1021,3 +1021,18 @@ type SidebarCategorySearchOpts struct {
|
||||
TeamID string
|
||||
ExcludeTeam bool
|
||||
}
|
||||
|
||||
// StoreServiceAdapter provides a simple Store wrapper for use with products.
|
||||
type StoreServiceAdapter struct {
|
||||
store Store
|
||||
}
|
||||
|
||||
func NewStoreServiceAdapter(store Store) *StoreServiceAdapter {
|
||||
return &StoreServiceAdapter{
|
||||
store: store,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *StoreServiceAdapter) GetMasterDB() *sql.DB {
|
||||
return a.store.GetInternalMasterDB()
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user