Documentation ¶
Overview ¶
grpc.go hides all the complexity of doing the gRPC calls between the aspect Core and a Plugin implementation by providing simple abstractions from the point of view of Plugin maintainers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient implements the gRPC client that is used by the Core to communicate with the Plugin instances.
func (*GRPCClient) BEPEventCallback ¶
func (m *GRPCClient) BEPEventCallback(event *buildeventstream.BuildEvent) error
BEPEventCallback is called from the Core to execute the Plugin BEPEventCallback.
func (*GRPCClient) PostBuildHook ¶
func (m *GRPCClient) PostBuildHook(isInteractiveMode bool, promptRunner ioutils.PromptRunner) error
PostBuildHook is called from the Core to execute the Plugin PostBuildHook. It starts the prompt runner server with the provided PromptRunner.
type GRPCPlugin ¶
GRPCPlugin represents a Plugin that communicates over gRPC.
func (*GRPCPlugin) GRPCClient ¶
func (p *GRPCPlugin) GRPCClient(ctx context.Context, broker *goplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient returns a client to perform the RPC calls to the Plugin instance from the Core.
func (*GRPCPlugin) GRPCServer ¶
func (p *GRPCPlugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error
GRPCServer registers an instance of the GRPCServer in the Plugin binary.
type GRPCServer ¶
type GRPCServer struct { Impl Plugin // contains filtered or unexported fields }
GRPCServer implements the gRPC server that runs on the Plugin instances.
func (*GRPCServer) BEPEventCallback ¶
func (m *GRPCServer) BEPEventCallback( ctx context.Context, req *proto.BEPEventCallbackReq, ) (*proto.BEPEventCallbackRes, error)
BEPEventCallback translates the gRPC call to the Plugin BEPEventCallback implementation.
func (*GRPCServer) PostBuildHook ¶
func (m *GRPCServer) PostBuildHook( ctx context.Context, req *proto.PostBuildHookReq, ) (*proto.PostBuildHookRes, error)
PostBuildHook translates the gRPC call to the Plugin PostBuildHook implementation. It starts a prompt runner that is passed to the Plugin instance to be able to perform prompt actions to the CLI user.
type Plugin ¶
type Plugin interface { BEPEventCallback(event *buildeventstream.BuildEvent) error PostBuildHook( isInteractiveMode bool, promptRunner ioutils.PromptRunner, ) error }
Plugin determines how an aspect Plugin should be implemented.
type PrompterGRPCClient ¶
type PrompterGRPCClient struct {
// contains filtered or unexported fields
}
PrompterGRPCClient implements the gRPC client that is used by the Plugin instance to communicate with the Core to request prompt actions from the user.
type PrompterGRPCServer ¶
type PrompterGRPCServer struct {
// contains filtered or unexported fields
}
PrompterGRPCServer implements the gRPC server that runs on the Core and is passed to the Plugin to allow prompt actions to the CLI user.
func (*PrompterGRPCServer) Run ¶
func (p *PrompterGRPCServer) Run( ctx context.Context, req *proto.PromptRunReq, ) (*proto.PromptRunRes, error)
Run translates the gRPC call to perform a prompt Run on the Core.