schemaservice

package
v0.510.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventExtractor added in v0.433.2

EventExtractor calculates controller events from changes to the state.

Types

type CommonSchemaServiceConfig added in v0.438.0

type CommonSchemaServiceConfig struct {
}

type Config added in v0.434.0

type Config struct {
	CommonSchemaServiceConfig
	Raft raft.RaftConfig `embed:"" prefix:"raft-"`
}

type EventWrapper added in v0.438.0

type EventWrapper struct {
	Event schema.Event
}

func (EventWrapper) MarshalBinary added in v0.438.0

func (e EventWrapper) MarshalBinary() ([]byte, error)

func (EventWrapper) String added in v0.438.0

func (e EventWrapper) String() string

func (*EventWrapper) UnmarshalBinary added in v0.438.0

func (e *EventWrapper) UnmarshalBinary(bts []byte) error

type NiceSlice added in v0.487.0

type NiceSlice[T any] []T

func (NiceSlice[T]) Filter added in v0.487.0

func (s NiceSlice[T]) Filter(f func(T) bool) NiceSlice[T]

func (NiceSlice[T]) Map added in v0.487.0

func (s NiceSlice[T]) Map(f func(T) T) NiceSlice[T]

type SchemaState added in v0.433.2

type SchemaState struct {
	// contains filtered or unexported fields
}

func NewSchemaState added in v0.434.0

func NewSchemaState(canonicalRealm string) SchemaState

func (*SchemaState) ActiveChangeset added in v0.435.0

func (r *SchemaState) ActiveChangeset() optional.Option[*schema.Changeset]

func (*SchemaState) ApplyEvent added in v0.434.0

func (r *SchemaState) ApplyEvent(ctx context.Context, event schema.Event) error

ApplyEvent applies an event to the schema state

func (*SchemaState) ApplyEvents added in v0.487.0

func (r *SchemaState) ApplyEvents(ctx context.Context, events ...schema.Event) error

ApplyEvents applies a list of events to the schema state. events might be partially applied if an error is returned.

func (*SchemaState) ChangesetEvents added in v0.487.0

func (r *SchemaState) ChangesetEvents(key key.Changeset) []*schema.DeploymentRuntimeEvent

func (*SchemaState) DeploymentEvents added in v0.487.0

func (r *SchemaState) DeploymentEvents(module string) []*schema.DeploymentRuntimeEvent

func (*SchemaState) FindDeployment added in v0.435.0

func (r *SchemaState) FindDeployment(deploymentKey key.Deployment) (deployment *schema.Module, changeset optional.Option[key.Changeset], err error)

FindDeployment returns a deployment and which changeset it is in based on the deployment key.

func (*SchemaState) GetCanonicalDeployments added in v0.435.0

func (r *SchemaState) GetCanonicalDeployments() map[key.Deployment]*schema.Module

GetCanonicalDeployments returns all active deployments (excluding those in changesets).

func (*SchemaState) GetCanonicalRealms added in v0.477.0

func (r *SchemaState) GetCanonicalRealms() map[string]*schema.Realm

GetCanonicalRealms returns all active realms (excluding those in changesets).

func (*SchemaState) GetCanonicalSchema added in v0.477.0

func (r *SchemaState) GetCanonicalSchema() *schema.Schema

GetCanonicalSchema returns the canonical schema for the active deployments and realms.

func (*SchemaState) GetChangeset added in v0.435.0

func (r *SchemaState) GetChangeset(changeset key.Changeset) optional.Option[*schema.Changeset]

func (*SchemaState) GetChangesets added in v0.435.0

func (r *SchemaState) GetChangesets() map[key.Changeset]*schema.Changeset

func (*SchemaState) GetDeployments added in v0.433.2

func (r *SchemaState) GetDeployments() map[key.Deployment]*schema.Module

func (*SchemaState) Marshal added in v0.435.0

func (r *SchemaState) Marshal() ([]byte, error)

func (*SchemaState) RealmsByName added in v0.487.0

func (r *SchemaState) RealmsByName() map[string]*schema.Realm

func (*SchemaState) Unmarshal added in v0.435.0

func (r *SchemaState) Unmarshal(data []byte) error

func (*SchemaState) VerifyEvent added in v0.443.0

func (r *SchemaState) VerifyEvent(ctx context.Context, event schema.Event) error

VerifyEvent verifies an event is valid for the given state, without applying it

type Service

type Service struct {
	State  *statemachine.SingleQueryHandle[struct{}, SchemaState, EventWrapper]
	Config Config
	// contains filtered or unexported fields
}

func New added in v0.434.0

func New(
	ctx context.Context,
	config Config,
	timelineClient *timelineclient.Client,
	receiverClient optional.Option[ftlv1connect.SchemaMirrorServiceClient],
	realm string,
	devMode bool,
) *Service

Start the SchemaService. Blocks until the context is cancelled.

func NewLocalService added in v0.477.0

func NewLocalService(ctx context.Context, config Config, timelineClient *timelineclient.Client, devMode bool) *Service

func (*Service) CommitChangeset added in v0.435.0

CommitChangeset makes all deployments for the changeset part of the canonical schema.

func (*Service) CreateChangeset added in v0.435.0

CreateChangeset creates a new changeset.

func (*Service) DrainChangeset added in v0.436.0

func (*Service) FailChangeset added in v0.435.0

FailChangeset fails an active changeset.

func (*Service) FinalizeChangeset added in v0.436.0

func (*Service) GetDeployment added in v0.435.0

func (*Service) GetDeployments added in v0.434.0

func (*Service) Ping

func (*Service) PrepareChangeset added in v0.435.0

PrepareChangeset prepares an active changeset for deployment.

func (*Service) RollbackChangeset added in v0.442.0

func (*Service) StartServices added in v0.477.0

func (s *Service) StartServices(context.Context) ([]rpc.Option, error)

Jump to

Keyboard shortcuts

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