Compare commits

..

No commits in common. "3b3c0e6118b62555853448695521ce9f2f2db421" and "421425959197c5dd3e683e985438db116041ba4f" have entirely different histories.

6 changed files with 5 additions and 41 deletions

View File

@ -1,34 +0,0 @@
package curre
import "context"
type FunctionalComponent struct {
init func(ctx context.Context) error
start func(ctx context.Context) error
stop func(ctx context.Context) error
}
func NewFunctionalComponent(
fc *FunctionalComponent,
) Component {
return fc
}
func (fc *FunctionalComponent) Init(ctx context.Context) error {
if fc.init != nil {
return fc.init(ctx)
}
return nil
}
func (fc *FunctionalComponent) Start(ctx context.Context) error {
if fc.start != nil {
return fc.start(ctx)
}
return nil
}
func (fc *FunctionalComponent) Stop(ctx context.Context) error {
if fc.stop != nil {
return fc.stop(ctx)
}
return nil
}

View File

@ -2,6 +2,6 @@ package curre
import "context" import "context"
type Stopper interface { type Closer interface {
Stop(ctx context.Context) error Close(ctx context.Context) error
} }

View File

@ -3,5 +3,5 @@ package curre
type Component interface { type Component interface {
Initer Initer
Starter Starter
Stopper Closer
} }

View File

@ -28,6 +28,6 @@ func (hs *httpServer) Start(ctx context.Context) error {
return nil return nil
} }
func (hs *httpServer) Stop(ctx context.Context) error { func (hs *httpServer) Close(ctx context.Context) error {
return nil return nil
} }

2
go.sum
View File

@ -1,2 +0,0 @@
git.front.kjuulh.io/kjuulh/curre v0.0.0-20220909233936-421425959197 h1:aOFriK+Ui/Kp0llmPXi3qTQkU6IPvsrRW4jl87TPArQ=
git.front.kjuulh.io/kjuulh/curre v0.0.0-20220909233936-421425959197/go.mod h1:m7WpSehONLqPh/XF3F0BI0UOpLOfGuDmDEFI1XsM6fE=

View File

@ -139,7 +139,7 @@ func (m *Manager) shutdown(ctx context.Context) error {
go func(ctx context.Context) { go func(ctx context.Context) {
for _, c := range closers { for _, c := range closers {
c.Stop(ctx) c.Close(ctx)
} }
shutdownChan <- struct{}{} shutdownChan <- struct{}{}