Documentation
¶
Index ¶
- type EventSource
- func (e *EventSource) ActiveChangeset() map[key.Changeset]*schema.Changeset
- func (e *EventSource) CanonicalView() *schema.Schema
- func (e *EventSource) Live() bool
- func (e *EventSource) Publish(event schema.Notification) error
- func (e *EventSource) PublishModuleForTest(module *schema.Module) error
- func (e *EventSource) Subscribe(ctx context.Context) <-chan schema.Notification
- func (e *EventSource) ViewOnly() *View
- func (e *EventSource) WaitForInitialSync(ctx context.Context) bool
- type PullSchemaClient
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventSource ¶
type EventSource struct {
// contains filtered or unexported fields
}
EventSource represents a stream of schema events and the materialised view of those events.
func New ¶
func New(ctx context.Context, subscriptionID string, client PullSchemaClient) *EventSource
New creates a new EventSource that pulls schema changes from the SchemaService into an event channel and a materialised view (ie. schema.Schema).
The sync will terminate when the context is cancelled.
func NewUnattached ¶
func NewUnattached() *EventSource
NewUnattached creates a new EventSource that is not attached to a SchemaService.
func (*EventSource) ActiveChangeset ¶ added in v0.435.0
func (e *EventSource) ActiveChangeset() map[key.Changeset]*schema.Changeset
func (*EventSource) CanonicalView ¶ added in v0.435.0
func (e *EventSource) CanonicalView() *schema.Schema
CanonicalView is the materialised view of the schema from "Events".
func (*EventSource) Live ¶
func (e *EventSource) Live() bool
Live returns true if the EventSource is connected to the SchemaService.
func (*EventSource) Publish ¶
func (e *EventSource) Publish(event schema.Notification) error
Publish an event to the EventSource.
This will update the materialised view and send the event on the "Events" channel. The event will be updated with the materialised view.
This is mostly useful in conjunction with NewUnattached, for testing.
func (*EventSource) PublishModuleForTest ¶ added in v0.439.0
func (e *EventSource) PublishModuleForTest(module *schema.Module) error
func (*EventSource) Subscribe ¶ added in v0.447.0
func (e *EventSource) Subscribe(ctx context.Context) <-chan schema.Notification
Subscribe subscribes you to the schema events
This method guarentes you will always receive a FullSchemaNotification as the first message
func (*EventSource) ViewOnly ¶
func (e *EventSource) ViewOnly() *View
ViewOnly converts the EventSource into a read-only view of the schema.
func (*EventSource) WaitForInitialSync ¶
func (e *EventSource) WaitForInitialSync(ctx context.Context) bool
WaitForInitialSync blocks until the initial sync has completed or the context is cancelled.
Returns true if the initial sync has completed, false if the context was cancelled.
type PullSchemaClient ¶ added in v0.448.0
type PullSchemaClient interface { PullSchema(ctx context.Context, req *connect.Request[ftlv1.PullSchemaRequest]) (*connect.ServerStreamForClient[ftlv1.PullSchemaResponse], error) Ping(ctx context.Context, req *connect.Request[ftlv1.PingRequest]) (*connect.Response[ftlv1.PingResponse], error) }
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is a read-only view of the schema.
func (*View) GetCanonical ¶ added in v0.435.0
GetCanonical returns the current canonical schema (ie: without any changes applied from active changesets)