projection

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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, deviceId, resourceId string) error

ForceUpdate invokes update registered resource model from evenstore.

func (*Projection) Models

func (p *Projection) Models(deviceId, resourceId string) []eventstore.Model

Models returns models 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