Added storage

This commit is contained in:
2022-09-11 14:52:21 +02:00
parent b3302bb3c6
commit 3643d4a467
12 changed files with 226 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
package server
import (
"context"
"git.front.kjuulh.io/kjuulh/curre"
"git.front.kjuulh.io/kjuulh/kraken/internal/serverdeps"
"go.uber.org/zap"
)
func NewStorageServer(logger *zap.Logger, deps *serverdeps.ServerDeps) curre.Component {
storage := deps.GetStorageService()
return curre.NewFunctionalComponent(&curre.FunctionalComponent{
InitFunc: func(fc *curre.FunctionalComponent, ctx context.Context) error {
logger.Debug("Initializing storage")
return storage.InitializeStorage(ctx)
},
StartFunc: func(fc *curre.FunctionalComponent, ctx context.Context) error {
return nil
},
StopFunc: func(fc *curre.FunctionalComponent, ctx context.Context) error {
logger.Debug("Cleaning up storage")
return storage.CleanupStorage(ctx)
},
})
}