github.com/RobustRoundRobin/quorum@v20.10.0+incompatible/plugin/helloworld/service.go (about)

     1  package helloworld
     2  
     3  import "context"
     4  
     5  type PluginHelloWorld interface {
     6  	Greeting(ctx context.Context, msg string) (string, error)
     7  }
     8  
     9  type PluginHelloWorldDeferFunc func() (PluginHelloWorld, error)
    10  
    11  type ReloadablePluginHelloWorld struct {
    12  	DeferFunc PluginHelloWorldDeferFunc
    13  }
    14  
    15  func (d *ReloadablePluginHelloWorld) Greeting(ctx context.Context, msg string) (string, error) {
    16  	p, err := d.DeferFunc()
    17  	if err != nil {
    18  		return "", err
    19  	}
    20  	return p.Greeting(ctx, msg)
    21  }