languagepbconnect

package
v0.408.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 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.language.v1.LanguageService/Ping"
	// LanguageServiceGetCreateModuleFlagsProcedure is the fully-qualified name of the LanguageService's
	// GetCreateModuleFlags RPC.
	LanguageServiceGetCreateModuleFlagsProcedure = "/xyz.block.ftl.language.v1.LanguageService/GetCreateModuleFlags"
	// LanguageServiceCreateModuleProcedure is the fully-qualified name of the LanguageService's
	// CreateModule RPC.
	LanguageServiceCreateModuleProcedure = "/xyz.block.ftl.language.v1.LanguageService/CreateModule"
	// LanguageServiceModuleConfigDefaultsProcedure is the fully-qualified name of the LanguageService's
	// ModuleConfigDefaults RPC.
	LanguageServiceModuleConfigDefaultsProcedure = "/xyz.block.ftl.language.v1.LanguageService/ModuleConfigDefaults"
	// LanguageServiceGetDependenciesProcedure is the fully-qualified name of the LanguageService's
	// GetDependencies RPC.
	LanguageServiceGetDependenciesProcedure = "/xyz.block.ftl.language.v1.LanguageService/GetDependencies"
	// LanguageServiceBuildProcedure is the fully-qualified name of the LanguageService's Build RPC.
	LanguageServiceBuildProcedure = "/xyz.block.ftl.language.v1.LanguageService/Build"
	// LanguageServiceBuildContextUpdatedProcedure is the fully-qualified name of the LanguageService's
	// BuildContextUpdated RPC.
	LanguageServiceBuildContextUpdatedProcedure = "/xyz.block.ftl.language.v1.LanguageService/BuildContextUpdated"
	// LanguageServiceGenerateStubsProcedure is the fully-qualified name of the LanguageService's
	// GenerateStubs RPC.
	LanguageServiceGenerateStubsProcedure = "/xyz.block.ftl.language.v1.LanguageService/GenerateStubs"
	// LanguageServiceSyncStubReferencesProcedure is the fully-qualified name of the LanguageService's
	// SyncStubReferences RPC.
	LanguageServiceSyncStubReferencesProcedure = "/xyz.block.ftl.language.v1.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.language.v1.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[v11.GetCreateModuleFlagsRequest]) (*connect.Response[v11.GetCreateModuleFlagsResponse], error)
	// Generates files for a new module with the requested name
	CreateModule(context.Context, *connect.Request[v11.CreateModuleRequest]) (*connect.Response[v11.CreateModuleResponse], error)
	// Provide default values for ModuleConfig for values that are not configured in the ftl.toml file.
	ModuleConfigDefaults(context.Context, *connect.Request[v11.ModuleConfigDefaultsRequest]) (*connect.Response[v11.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[v11.GetDependenciesRequest]) (*connect.Response[v11.GetDependenciesResponse], 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[v11.BuildRequest]) (*connect.ServerStreamForClient[v11.BuildResponse], 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[v11.BuildContextUpdatedRequest]) (*connect.Response[v11.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[v11.GenerateStubsRequest]) (*connect.Response[v11.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[v11.SyncStubReferencesRequest]) (*connect.Response[v11.SyncStubReferencesResponse], error)
}

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

func NewLanguageServiceClient

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

NewLanguageServiceClient constructs a client for the xyz.block.ftl.language.v1.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[v11.GetCreateModuleFlagsRequest]) (*connect.Response[v11.GetCreateModuleFlagsResponse], error)
	// Generates files for a new module with the requested name
	CreateModule(context.Context, *connect.Request[v11.CreateModuleRequest]) (*connect.Response[v11.CreateModuleResponse], error)
	// Provide default values for ModuleConfig for values that are not configured in the ftl.toml file.
	ModuleConfigDefaults(context.Context, *connect.Request[v11.ModuleConfigDefaultsRequest]) (*connect.Response[v11.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[v11.GetDependenciesRequest]) (*connect.Response[v11.GetDependenciesResponse], 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[v11.BuildRequest], *connect.ServerStream[v11.BuildResponse]) 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[v11.BuildContextUpdatedRequest]) (*connect.Response[v11.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[v11.GenerateStubsRequest]) (*connect.Response[v11.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[v11.SyncStubReferencesRequest]) (*connect.Response[v11.SyncStubReferencesResponse], error)
}

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

type UnimplementedLanguageServiceHandler

type UnimplementedLanguageServiceHandler struct{}

UnimplementedLanguageServiceHandler returns CodeUnimplemented from all methods.

func (UnimplementedLanguageServiceHandler) Ping

Jump to

Keyboard shortcuts

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