languagepbconnect

package
v0.405.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LanguageServicePingProcedure is the fully-qualified name of the LanguageService's Ping RPC.
	LanguageServicePingProcedure = "/xyz.block.ftl.v1.language.LanguageService/Ping"
	// LanguageServiceGetCreateModuleFlagsProcedure is the fully-qualified name of the LanguageService's
	// GetCreateModuleFlags RPC.
	LanguageServiceGetCreateModuleFlagsProcedure = "/xyz.block.ftl.v1.language.LanguageService/GetCreateModuleFlags"
	// LanguageServiceCreateModuleProcedure is the fully-qualified name of the LanguageService's
	// CreateModule RPC.
	LanguageServiceCreateModuleProcedure = "/xyz.block.ftl.v1.language.LanguageService/CreateModule"
	// LanguageServiceModuleConfigDefaultsProcedure is the fully-qualified name of the LanguageService's
	// ModuleConfigDefaults RPC.
	LanguageServiceModuleConfigDefaultsProcedure = "/xyz.block.ftl.v1.language.LanguageService/ModuleConfigDefaults"
	// LanguageServiceGetDependenciesProcedure is the fully-qualified name of the LanguageService's
	// GetDependencies RPC.
	LanguageServiceGetDependenciesProcedure = "/xyz.block.ftl.v1.language.LanguageService/GetDependencies"
	// LanguageServiceBuildProcedure is the fully-qualified name of the LanguageService's Build RPC.
	LanguageServiceBuildProcedure = "/xyz.block.ftl.v1.language.LanguageService/Build"
	// LanguageServiceBuildContextUpdatedProcedure is the fully-qualified name of the LanguageService's
	// BuildContextUpdated RPC.
	LanguageServiceBuildContextUpdatedProcedure = "/xyz.block.ftl.v1.language.LanguageService/BuildContextUpdated"
	// LanguageServiceGenerateStubsProcedure is the fully-qualified name of the LanguageService's
	// GenerateStubs RPC.
	LanguageServiceGenerateStubsProcedure = "/xyz.block.ftl.v1.language.LanguageService/GenerateStubs"
	// LanguageServiceSyncStubReferencesProcedure is the fully-qualified name of the LanguageService's
	// SyncStubReferences RPC.
	LanguageServiceSyncStubReferencesProcedure = "/xyz.block.ftl.v1.language.LanguageService/SyncStubReferences"
)

These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.

Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.

View Source
const (
	// LanguageServiceName is the fully-qualified name of the LanguageService service.
	LanguageServiceName = "xyz.block.ftl.v1.language.LanguageService"
)

Variables

This section is empty.

Functions

func NewLanguageServiceHandler

func NewLanguageServiceHandler(svc LanguageServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewLanguageServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type LanguageServiceClient

type LanguageServiceClient interface {
	// Ping service for readiness.
	Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error)
	// Get language specific flags that can be used to create a new module.
	GetCreateModuleFlags(context.Context, *connect.Request[language.GetCreateModuleFlagsRequest]) (*connect.Response[language.GetCreateModuleFlagsResponse], error)
	// Generates files for a new module with the requested name
	CreateModule(context.Context, *connect.Request[language.CreateModuleRequest]) (*connect.Response[language.CreateModuleResponse], error)
	// Provide default values for ModuleConfig for values that are not configured in the ftl.toml file.
	ModuleConfigDefaults(context.Context, *connect.Request[language.ModuleConfigDefaultsRequest]) (*connect.Response[language.ModuleConfigDefaultsResponse], error)
	// Extract dependencies for a module
	// FTL will ensure that these dependencies are built before requesting a build for this module.
	GetDependencies(context.Context, *connect.Request[language.DependenciesRequest]) (*connect.Response[language.DependenciesResponse], error)
	// Build the module and stream back build events.
	//
	// A BuildSuccess or BuildFailure event must be streamed back with the request's context id to indicate the
	// end of the build.
	//
	// The request can include the option to "rebuild_automatically". In this case the plugin should watch for
	// file changes and automatically rebuild as needed as long as this build request is alive. Each automactic
	// rebuild must include the latest build context id provided by the request or subsequent BuildContextUpdated
	// calls.
	Build(context.Context, *connect.Request[language.BuildRequest]) (*connect.ServerStreamForClient[language.BuildEvent], error)
	// While a Build call with "rebuild_automatically" set is active, BuildContextUpdated is called whenever the
	// build context is updated.
	//
	// Each time this call is made, the Build call must send back a corresponding BuildSuccess or BuildFailure
	// event with the updated build context id with "is_automatic_rebuild" as false.
	//
	// If the plugin will not be able to return a BuildSuccess or BuildFailure, such as when there is no active
	// build stream, it must fail the BuildContextUpdated call.
	BuildContextUpdated(context.Context, *connect.Request[language.BuildContextUpdatedRequest]) (*connect.Response[language.BuildContextUpdatedResponse], error)
	// Generate stubs for a module.
	//
	// Stubs allow modules to import other module's exported interface. If a language does not need this step,
	// then it is not required to do anything in this call.
	//
	// This call is not tied to the module that this plugin is responsible for. A plugin of each language will
	// be chosen to generate stubs for each module.
	GenerateStubs(context.Context, *connect.Request[language.GenerateStubsRequest]) (*connect.Response[language.GenerateStubsResponse], error)
	// SyncStubReferences is called when module stubs have been updated. This allows the plugin to update
	// references to external modules, regardless of whether they are dependencies.
	//
	// For example, go plugin adds references to all modules into the go.work file so that tools can automatically
	// import the modules when users start reference them.
	//
	// It is optional to do anything with this call.
	SyncStubReferences(context.Context, *connect.Request[language.SyncStubReferencesRequest]) (*connect.Response[language.SyncStubReferencesResponse], error)
}

LanguageServiceClient is a client for the xyz.block.ftl.v1.language.LanguageService service.

func NewLanguageServiceClient

func NewLanguageServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) LanguageServiceClient

NewLanguageServiceClient constructs a client for the xyz.block.ftl.v1.language.LanguageService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type LanguageServiceHandler

type LanguageServiceHandler interface {
	// Ping service for readiness.
	Ping(context.Context, *connect.Request[v1.PingRequest]) (*connect.Response[v1.PingResponse], error)
	// Get language specific flags that can be used to create a new module.
	GetCreateModuleFlags(context.Context, *connect.Request[language.GetCreateModuleFlagsRequest]) (*connect.Response[language.GetCreateModuleFlagsResponse], error)
	// Generates files for a new module with the requested name
	CreateModule(context.Context, *connect.Request[language.CreateModuleRequest]) (*connect.Response[language.CreateModuleResponse], error)
	// Provide default values for ModuleConfig for values that are not configured in the ftl.toml file.
	ModuleConfigDefaults(context.Context, *connect.Request[language.ModuleConfigDefaultsRequest]) (*connect.Response[language.ModuleConfigDefaultsResponse], error)
	// Extract dependencies for a module
	// FTL will ensure that these dependencies are built before requesting a build for this module.
	GetDependencies(context.Context, *connect.Request[language.DependenciesRequest]) (*connect.Response[language.DependenciesResponse], error)
	// Build the module and stream back build events.
	//
	// A BuildSuccess or BuildFailure event must be streamed back with the request's context id to indicate the
	// end of the build.
	//
	// The request can include the option to "rebuild_automatically". In this case the plugin should watch for
	// file changes and automatically rebuild as needed as long as this build request is alive. Each automactic
	// rebuild must include the latest build context id provided by the request or subsequent BuildContextUpdated
	// calls.
	Build(context.Context, *connect.Request[language.BuildRequest], *connect.ServerStream[language.BuildEvent]) error
	// While a Build call with "rebuild_automatically" set is active, BuildContextUpdated is called whenever the
	// build context is updated.
	//
	// Each time this call is made, the Build call must send back a corresponding BuildSuccess or BuildFailure
	// event with the updated build context id with "is_automatic_rebuild" as false.
	//
	// If the plugin will not be able to return a BuildSuccess or BuildFailure, such as when there is no active
	// build stream, it must fail the BuildContextUpdated call.
	BuildContextUpdated(context.Context, *connect.Request[language.BuildContextUpdatedRequest]) (*connect.Response[language.BuildContextUpdatedResponse], error)
	// Generate stubs for a module.
	//
	// Stubs allow modules to import other module's exported interface. If a language does not need this step,
	// then it is not required to do anything in this call.
	//
	// This call is not tied to the module that this plugin is responsible for. A plugin of each language will
	// be chosen to generate stubs for each module.
	GenerateStubs(context.Context, *connect.Request[language.GenerateStubsRequest]) (*connect.Response[language.GenerateStubsResponse], error)
	// SyncStubReferences is called when module stubs have been updated. This allows the plugin to update
	// references to external modules, regardless of whether they are dependencies.
	//
	// For example, go plugin adds references to all modules into the go.work file so that tools can automatically
	// import the modules when users start reference them.
	//
	// It is optional to do anything with this call.
	SyncStubReferences(context.Context, *connect.Request[language.SyncStubReferencesRequest]) (*connect.Response[language.SyncStubReferencesResponse], error)
}

LanguageServiceHandler is an implementation of the xyz.block.ftl.v1.language.LanguageService service.

type UnimplementedLanguageServiceHandler

type UnimplementedLanguageServiceHandler struct{}

UnimplementedLanguageServiceHandler returns CodeUnimplemented from all methods.

func (UnimplementedLanguageServiceHandler) GenerateStubs added in v0.386.0

func (UnimplementedLanguageServiceHandler) Ping

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL