Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface { // More returns true if there are more changes to come as part of the initial sync. More() bool // Schema is the READ-ONLY full schema after this event was applied. Schema() *schema.Schema // contains filtered or unexported methods }
Event represents a change in the schema.
type EventRemove ¶
type EventRemove struct { // None for builtin modules. Deployment optional.Option[model.DeploymentKey] Module *schema.Module // True if the underlying module was deleted in addition to the deployment itself. Deleted bool // contains filtered or unexported fields }
EventRemove represents that a deployment (or module) was removed.
func (EventRemove) More ¶
func (c EventRemove) More() bool
func (EventRemove) Schema ¶
func (c EventRemove) Schema() *schema.Schema
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, client ftlv1connect.SchemaServiceClient) 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) Events ¶
func (e EventSource) Events() <-chan Event
Events is a stream of schema change events.
"View" will be updated with these changes prior to being sent on this channel.
NOTE: Only a single goroutine should read from the EventSource.
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 Event)
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) View ¶
func (e EventSource) View() *schema.Schema
View is the materialised view of the schema from "Events".
func (EventSource) ViewOnly ¶
func (e EventSource) ViewOnly() View
ViewOnly converts the EventSource into a read-only view of the schema.
This will consume all events so the EventSource dodesn't block as the view is automatically updated.
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 EventUpsert ¶
type EventUpsert struct { // None for builtin modules. Deployment optional.Option[model.DeploymentKey] Module *schema.Module // contains filtered or unexported fields }
EventUpsert represents that a module has been added or updated in the schema.
func (EventUpsert) More ¶
func (c EventUpsert) More() bool
func (EventUpsert) Schema ¶
func (c EventUpsert) Schema() *schema.Schema