hashicorp / go-plugin

Golang plugin system over RPC.
Mozilla Public License 2.0
5.25k stars 450 forks source link

Create ServeAsync #133

Closed appilon closed 4 years ago

appilon commented 4 years ago

Callers should block with the returned wait() func. This is useful for type asserting to plugin.GRPCServer, which gives the caller access to GracefulStop and Stop. This would be helpful for the Terraform plugin SDK so we can propagate cancellation naturally though gRPC's context.Contexts


server, wait := plugin.ServeAsync(opts)
someService.OnStop = func() {
  server.(*plugin.GRPCServer).GracefulStop()
}
wait()
appilon commented 4 years ago

closing in favor of #134