projection

package
v0.0.0-...-75a04d1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: Apache-2.0 Imports: 8 Imported by: 4

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) (loaded 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 RefCountMap

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

func NewRefCountMap

func NewRefCountMap() *RefCountMap

func (*RefCountMap) Dec

func (p *RefCountMap) Dec(id string) (deleted bool, err error)

func (*RefCountMap) Inc

func (p *RefCountMap) Inc(id string, create bool) (created bool, err error)

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