kjuulh
46cc160764
updated roadmap updated roadmap Add a basic readme (#15) Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: kjuulh/kraken#15 fix readme Add readme with stuff more roadmap items update formatting formatting 2 more setup with semantic with semantic 2 revert add releaserc with releaser with kraken Update roadmap rename rename feature/move-command (#18) Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: #18 fix/require-two-pushes (#20) Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: #20
29 lines
829 B
Go
29 lines
829 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.front.kjuulh.io/kjuulh/curre"
|
|
"git.front.kjuulh.io/kjuulh/octopush/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(_ *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(_ *curre.FunctionalComponent, ctx context.Context) error {
|
|
logger.Debug("Cleaning up storage")
|
|
ctx, _ = context.WithTimeout(ctx, time.Second*10)
|
|
return storage.CleanupStorage(ctx)
|
|
},
|
|
})
|
|
}
|