splitted one operator module to file, account, image operators; splitted operator functions; etc
This commit is contained in:
+36
-8
@@ -25,18 +25,23 @@ import (
|
||||
"mstore/app/handler"
|
||||
"mstore/app/logger"
|
||||
"mstore/app/maindb"
|
||||
"mstore/app/operator"
|
||||
"mstore/app/service"
|
||||
"mstore/app/storage"
|
||||
"mstore/pkg/auxtool"
|
||||
"mstore/pkg/descr"
|
||||
|
||||
"mstore/app/accoper"
|
||||
"mstore/app/fileoper"
|
||||
"mstore/app/imageoper"
|
||||
|
||||
yaml "go.yaml.in/yaml/v4"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
conf *config.Config
|
||||
oper *operator.Operator
|
||||
fiop *fileoper.Operator
|
||||
acop *accoper.Operator
|
||||
imop *imageoper.Operator
|
||||
svc *service.Service
|
||||
mdb *maindb.Database
|
||||
hand *handler.Handler
|
||||
@@ -248,21 +253,44 @@ func (srv *Server) Build() error {
|
||||
store := storage.NewStorage(datadir)
|
||||
srv.stor = store
|
||||
|
||||
// Creating operator
|
||||
srv.logg.Infof("Creating operator")
|
||||
operatorParams := &operator.OperatorParams{
|
||||
// Creating account operator
|
||||
srv.logg.Infof("Creating account operator")
|
||||
accoperParams := &accoper.OperatorParams{
|
||||
MainDB: srv.mdb,
|
||||
Store: srv.stor,
|
||||
}
|
||||
srv.oper, err = operator.NewOperator(operatorParams)
|
||||
srv.acop, err = accoper.NewOperator(accoperParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Creating file operator
|
||||
srv.logg.Infof("Creating file operator")
|
||||
fileoperParams := &fileoper.OperatorParams{
|
||||
MainDB: srv.mdb,
|
||||
Store: srv.stor,
|
||||
}
|
||||
srv.fiop, err = fileoper.NewOperator(fileoperParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Creating operator
|
||||
srv.logg.Infof("Creating operator")
|
||||
imageoperParams := &imageoper.OperatorParams{
|
||||
MainDB: srv.mdb,
|
||||
Store: srv.stor,
|
||||
}
|
||||
srv.imop, err = imageoper.NewOperator(imageoperParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Creating handler
|
||||
srv.logg.Infof("Creating handler")
|
||||
handlerParams := &handler.HandlerParams{
|
||||
Operator: srv.oper,
|
||||
MainDB: srv.mdb,
|
||||
MainDB: srv.mdb,
|
||||
FileOper: srv.fiop,
|
||||
AccOper: srv.acop,
|
||||
ImageOper: srv.imop,
|
||||
}
|
||||
srv.hand, err = handler.NewHandler(handlerParams)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user