projection

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetTopicsFunc

type GetTopicsFunc func(string, string) []string

type Projection

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

Projection projects events from resource aggregate.

func NewProjection

func NewProjection(ctx context.Context, name string, store eventstore.EventStore, subscriber eventbus.Subscriber, factoryModel eventstore.FactoryModelFunc) (*Projection, error)

NewProjection creates new resource projection.

func (*Projection) ForceUpdate

func (p *Projection) ForceUpdate(ctx context.Context, resourceID *commands.ResourceId) error

ForceUpdate invokes update registered resource model from evenstore.

func (*Projection) Models

func (p *Projection) Models(onModel func(eventstore.Model) (wantNext bool), resourceIDs ...*commands.ResourceId)

Models returns models via onModel function for device, resource or nil for non exist.

func (*Projection) Register

func (p *Projection) Register(ctx context.Context, deviceID string) (created bool, err error)

Register registers deviceID, loads events from eventstore and subscribe to eventbus. It can be called multiple times for same deviceID but after successful the a call Unregister must be called same times to free resources.

func (*Projection) Unregister

func (p *Projection) Unregister(deviceID string) error

Unregister unregisters device and his resource from projection.

type TopicManager

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

func NewTopicManager

func NewTopicManager(getTopics GetTopicsFunc) *TopicManager

func (*TopicManager) Add

func (p *TopicManager) Add(key string) ([]string, bool)

func (*TopicManager) Remove

func (p *TopicManager) Remove(key string) ([]string, bool)

Jump to

Keyboard shortcuts

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