Documentation
¶
Index ¶
- type Event
- type EventChangesetEnded
- type EventChangesetStarted
- type EventRemove
- type EventSource
- func (e EventSource) ActiveChangeset() optional.Option[*schema.Changeset]
- func (e EventSource) CanonicalView() *schema.Schema
- func (e EventSource) Events() <-chan Event
- func (e EventSource) LatestView() *schema.Schema
- func (e EventSource) Live() bool
- func (e EventSource) Publish(event Event)
- func (e EventSource) ViewOnly() View
- func (e EventSource) WaitForInitialSync(ctx context.Context) bool
- type EventUpsert
- type View
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 // GetCanonical is the READ-ONLY canonical schema after this event was applied. GetCanonical() *schema.Schema // GetLatest is the READ-ONLY latest schema, by applying active deployments in changesetz to the canonical schema. GetLatest() *schema.Schema // ActiveChangeset is the READ-ONLY active changeset after this event was applied. ActiveChangeset() optional.Option[*schema.Changeset] // contains filtered or unexported methods }
Event represents a change in the schema.
type EventChangesetEnded ¶ added in v0.435.0
type EventChangesetEnded struct { Key key.Changeset Success bool Error string // ReplacedDeloyments contains each deployment that was superseeded by this changeset // If Success is false it is empty ReplacedDeloyments []key.Deployment // contains filtered or unexported fields }
func (EventChangesetEnded) ActiveChangeset ¶ added in v0.435.0
func (c EventChangesetEnded) ActiveChangeset() optional.Option[*schema.Changeset]
func (EventChangesetEnded) GetCanonical ¶ added in v0.435.0
func (c EventChangesetEnded) GetCanonical() *schema.Schema
func (EventChangesetEnded) GetLatest ¶ added in v0.435.0
func (c EventChangesetEnded) GetLatest() *schema.Schema
func (EventChangesetEnded) More ¶ added in v0.435.0
func (c EventChangesetEnded) More() bool
type EventChangesetStarted ¶ added in v0.435.0
type EventChangesetStarted struct { Changeset *schema.Changeset // contains filtered or unexported fields }
func (EventChangesetStarted) ActiveChangeset ¶ added in v0.435.0
func (c EventChangesetStarted) ActiveChangeset() optional.Option[*schema.Changeset]
func (EventChangesetStarted) GetCanonical ¶ added in v0.435.0
func (c EventChangesetStarted) GetCanonical() *schema.Schema
func (EventChangesetStarted) GetLatest ¶ added in v0.435.0
func (c EventChangesetStarted) GetLatest() *schema.Schema
func (EventChangesetStarted) More ¶ added in v0.435.0
func (c EventChangesetStarted) More() bool
type EventRemove ¶
type EventRemove struct { // None for builtin modules. Deployment optional.Option[key.Deployment] Module string // contains filtered or unexported fields }
EventRemove represents that a deployment (or module) was removed from the active canonical schema. This is different than when a deployment is replaced by a changeset successfully being committed. See EventChangesetEnded
func (EventRemove) ActiveChangeset ¶ added in v0.435.0
func (c EventRemove) ActiveChangeset() optional.Option[*schema.Changeset]
func (EventRemove) GetCanonical ¶ added in v0.435.0
func (c EventRemove) GetCanonical() *schema.Schema
func (EventRemove) GetLatest ¶ added in v0.435.0
func (c EventRemove) GetLatest() *schema.Schema
func (EventRemove) More ¶
func (c EventRemove) More() bool
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) ActiveChangeset ¶ added in v0.435.0
func (e EventSource) ActiveChangeset() optional.Option[*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) 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) LatestView ¶ added in v0.435.0
func (e EventSource) LatestView() *schema.Schema
LatestView is the materialised view of the schema from "Events" taking into account active deployments in changesets.
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) 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. Module *schema.Module Changeset optional.Option[key.Changeset] // contains filtered or unexported fields }
EventUpsert represents that a module has been added or updated in the schema.
func (EventUpsert) ActiveChangeset ¶ added in v0.435.0
func (c EventUpsert) ActiveChangeset() optional.Option[*schema.Changeset]
func (EventUpsert) GetCanonical ¶ added in v0.435.0
func (c EventUpsert) GetCanonical() *schema.Schema
func (EventUpsert) GetLatest ¶ added in v0.435.0
func (c EventUpsert) GetLatest() *schema.Schema
func (EventUpsert) More ¶
func (c EventUpsert) More() bool
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is a read-only view of the schema.
func (*View) GetActiveChangeset ¶ added in v0.435.0
GetActiveChangeset returns the current active changeset.
func (*View) GetCanonical ¶ added in v0.435.0
GetCanonical returns the current canonical schema (ie: without any changes applied from active changesets)