Documentation
¶
Index ¶
- func ProvisionMySQLForTest(ctx context.Context, moduleName string, id string) (string, error)
- func ProvisionPostgresForTest(ctx context.Context, moduleName string, id string) (string, error)
- func RunMySQLMigration(ctx context.Context, dsn string, moduleDir string, name string) error
- func RunPostgresMigration(ctx context.Context, dsn string, moduleDir string, name string) error
- func Start(ctx context.Context, config Config, registry *ProvisionerRegistry, ...) error
- type CommonProvisionerConfig
- type Config
- type Deployment
- type DeploymentState
- type InMemProvisioner
- func NewDevProvisioner(postgresPort int, mysqlPort int, recreate bool) *InMemProvisioner
- func NewEmbeddedProvisioner(handlers map[schema.ResourceType]InMemResourceProvisionerFn) *InMemProvisioner
- func NewRunnerScalingProvisioner(runners scaling.RunnerScaling) *InMemProvisioner
- func NewSQLMigrationProvisioner(storage *artefacts.OCIArtefactService) *InMemProvisioner
- func (d *InMemProvisioner) Ping(context.Context, *connect.Request[ftlv1.PingRequest]) (*connect.Response[ftlv1.PingResponse], error)
- func (d *InMemProvisioner) Provision(ctx context.Context, req *connect.Request[provisioner.ProvisionRequest]) (*connect.Response[provisioner.ProvisionResponse], error)
- func (d *InMemProvisioner) Status(ctx context.Context, req *connect.Request[provisioner.StatusRequest]) (*connect.Response[provisioner.StatusResponse], error)
- type InMemResourceProvisionerFn
- type NoopProvisioner
- func (d *NoopProvisioner) Ping(context.Context, *connect.Request[ftlv1.PingRequest]) (*connect.Response[ftlv1.PingResponse], error)
- func (d *NoopProvisioner) Provision(ctx context.Context, req *connect.Request[provisioner.ProvisionRequest]) (*connect.Response[provisioner.ProvisionResponse], error)
- func (d *NoopProvisioner) Status(ctx context.Context, req *connect.Request[provisioner.StatusRequest]) (*connect.Response[provisioner.StatusResponse], error)
- type ProvisionerBinding
- type ProvisionerRegistry
- type RuntimeEvent
- type Service
- type Task
- type TaskState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvisionMySQLForTest ¶
func RunMySQLMigration ¶
func RunPostgresMigration ¶
func Start ¶
func Start( ctx context.Context, config Config, registry *ProvisionerRegistry, schemaClient schemaconnect.SchemaServiceClient, ) error
Start the Provisioner. Blocks until the context is cancelled.
Types ¶
type CommonProvisionerConfig ¶
type CommonProvisionerConfig struct {
PluginConfigFile *os.File `name:"provisioner-plugin-config" help:"Path to the plugin configuration file." env:"FTL_PROVISIONER_PLUGIN_CONFIG_FILE"`
}
CommonProvisionerConfig is shared config between the production controller and development server.
type Config ¶
type Config struct { Bind *url.URL `help:"Socket to bind to." default:"http://127.0.0.1:8893" env:"FTL_BIND"` ControllerEndpoint *url.URL `name:"ftl-endpoint" help:"Controller endpoint." env:"FTL_ENDPOINT" default:"http://127.0.0.1:8892"` SchemaEndpoint *url.URL `help:"Schema service endpoint." env:"FTL_SCHEMA_ENDPOINT" default:"http://127.0.0.1:8897"` CommonProvisionerConfig }
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
type Deployment ¶
type Deployment struct { Tasks []*Task DeploymentState *schemaservice.SchemaState Previous *schema.Module EventHandler func(event *schemapb.Event) error Changeset key.Changeset }
Deployment is a single deployment of resources for a single module
func (*Deployment) Progress ¶
func (d *Deployment) Progress(ctx context.Context) (bool, error)
Progress the deployment. Returns true if there are still tasks running or pending.
func (*Deployment) State ¶
func (d *Deployment) State() *DeploymentState
type DeploymentState ¶
type InMemProvisioner ¶
type InMemProvisioner struct {
// contains filtered or unexported fields
}
InMemProvisioner for running an in memory provisioner, constructing all resources concurrently
It spawns a separate goroutine for each resource to be provisioned, and finishes the task when all resources are provisioned or an error occurs.
func NewDevProvisioner ¶
func NewDevProvisioner(postgresPort int, mysqlPort int, recreate bool) *InMemProvisioner
NewDevProvisioner creates a new provisioner that provisions resources locally when running FTL in dev mode
func NewEmbeddedProvisioner ¶
func NewEmbeddedProvisioner(handlers map[schema.ResourceType]InMemResourceProvisionerFn) *InMemProvisioner
func NewRunnerScalingProvisioner ¶
func NewRunnerScalingProvisioner(runners scaling.RunnerScaling) *InMemProvisioner
func NewSQLMigrationProvisioner ¶
func NewSQLMigrationProvisioner(storage *artefacts.OCIArtefactService) *InMemProvisioner
NewSQLMigrationProvisioner creates a new provisioner that provisions database migrations
func (*InMemProvisioner) Ping ¶
func (d *InMemProvisioner) Ping(context.Context, *connect.Request[ftlv1.PingRequest]) (*connect.Response[ftlv1.PingResponse], error)
func (*InMemProvisioner) Provision ¶
func (d *InMemProvisioner) Provision(ctx context.Context, req *connect.Request[provisioner.ProvisionRequest]) (*connect.Response[provisioner.ProvisionResponse], error)
func (*InMemProvisioner) Status ¶
func (d *InMemProvisioner) Status(ctx context.Context, req *connect.Request[provisioner.StatusRequest]) (*connect.Response[provisioner.StatusResponse], error)
type NoopProvisioner ¶
type NoopProvisioner struct{}
NoopProvisioner is a provisioner that does nothing
func (*NoopProvisioner) Ping ¶
func (d *NoopProvisioner) Ping(context.Context, *connect.Request[ftlv1.PingRequest]) (*connect.Response[ftlv1.PingResponse], error)
func (*NoopProvisioner) Provision ¶
func (d *NoopProvisioner) Provision(ctx context.Context, req *connect.Request[provisioner.ProvisionRequest]) (*connect.Response[provisioner.ProvisionResponse], error)
func (*NoopProvisioner) Status ¶
func (d *NoopProvisioner) Status(ctx context.Context, req *connect.Request[provisioner.StatusRequest]) (*connect.Response[provisioner.StatusResponse], error)
type ProvisionerBinding ¶
type ProvisionerBinding struct { Provisioner provisionerconnect.ProvisionerPluginServiceClient ID string Types []schema.ResourceType }
ProvisionerBinding is a Provisioner and the types it supports
func (ProvisionerBinding) String ¶
func (p ProvisionerBinding) String() string
type ProvisionerRegistry ¶
type ProvisionerRegistry struct {
Bindings []*ProvisionerBinding
}
ProvisionerRegistry contains all known resource handlers in the order they should be executed
func RegistryFromConfigFile ¶
func RegistryFromConfigFile(ctx context.Context, file *os.File, controller schemaconnect.ControllerServiceClient, scaling scaling.RunnerScaling) (*ProvisionerRegistry, error)
func (*ProvisionerRegistry) CreateDeployment ¶
func (reg *ProvisionerRegistry) CreateDeployment(ctx context.Context, changeset key.Changeset, desiredModule, existingModule *schema.Module, eventHandler func(event *schemapb.Event) error) *Deployment
CreateDeployment to take the system to the desired state
func (*ProvisionerRegistry) Register ¶
func (reg *ProvisionerRegistry) Register(id string, handler provisionerconnect.ProvisionerPluginServiceClient, types ...schema.ResourceType) *ProvisionerBinding
Register to the registry, to be executed after all the previously added handlers
type RuntimeEvent ¶
type RuntimeEvent struct { Module schema.ModuleRuntimeEvent Database *schema.DatabaseRuntimeEvent Topic *schema.TopicRuntimeEvent Verb *schema.VerbRuntimeEvent }
RuntimeEvent is a union type of all runtime events TODO: Remove once we have fully typed provisioners
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New( ctx context.Context, config Config, registry *ProvisionerRegistry, schemaClient schemaconnect.SchemaServiceClient, ) (*Service, error)