Add Store service for Focalboard multi-product architecture (#20568)
* add Store service
Этот коммит содержится в:
@@ -102,6 +102,7 @@ const (
|
|||||||
LogKey ServiceKey = "log"
|
LogKey ServiceKey = "log"
|
||||||
HooksKey ServiceKey = "hooks"
|
HooksKey ServiceKey = "hooks"
|
||||||
KVStoreKey ServiceKey = "kvstore"
|
KVStoreKey ServiceKey = "kvstore"
|
||||||
|
StoreKey ServiceKey = "storekey"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
@@ -402,6 +403,7 @@ func NewServer(options ...Option) (*Server, error) {
|
|||||||
LogKey: s.GetLogger(),
|
LogKey: s.GetLogger(),
|
||||||
CloudKey: &cloudWrapper{cloud: s.Cloud},
|
CloudKey: &cloudWrapper{cloud: s.Cloud},
|
||||||
KVStoreKey: &kvStoreWrapper{srv: s},
|
KVStoreKey: &kvStoreWrapper{srv: s},
|
||||||
|
StoreKey: store.NewStoreServiceAdapter(s.Store),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 8: Initialize products.
|
// Step 8: Initialize products.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package product
|
package product
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
@@ -167,3 +168,10 @@ type KVStoreService interface {
|
|||||||
type LogService interface {
|
type LogService interface {
|
||||||
mlog.LoggerIFace
|
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
|
TeamID string
|
||||||
ExcludeTeam bool
|
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