quorum/plugin/helloworld/service.go

22 lines
470 B
Go

package helloworld
import "context"
type PluginHelloWorld interface {
Greeting(ctx context.Context, msg string) (string, error)
}
type PluginHelloWorldDeferFunc func() (PluginHelloWorld, error)
type ReloadablePluginHelloWorld struct {
DeferFunc PluginHelloWorldDeferFunc
}
func (d *ReloadablePluginHelloWorld) Greeting(ctx context.Context, msg string) (string, error) {
p, err := d.DeferFunc()
if err != nil {
return "", err
}
return p.Greeting(ctx, msg)
}