schemaeventsource

package
v0.452.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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 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

func (v *View) GetCanonical() *schema.Schema

GetCanonical returns the current canonical schema (ie: without any changes applied from active changesets)

Jump to

Keyboard shortcuts

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