store

package
v0.0.0-...-98ba599 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

package store provides typed, centralized access to the event-sourced workflow and invocation models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseNotificationToInvocation

func ParseNotificationToInvocation(update *fes.Notification) (*types.WorkflowInvocation, error)

func ParseNotificationToWorkflow

func ParseNotificationToWorkflow(update *fes.Notification) (*types.Workflow, error)

Types

type InvocationSubscription

type InvocationSubscription struct {
	*pubsub.Subscription
	// contains filtered or unexported fields
}

func (*InvocationSubscription) Close

func (sub *InvocationSubscription) Close() error

func (*InvocationSubscription) ToNotification

func (sub *InvocationSubscription) ToNotification(msg pubsub.Msg) (*fes.Notification, error)

type Invocations

type Invocations struct {
	fes.CacheReader
}

func NewInvocationStore

func NewInvocationStore(invocations fes.CacheReader) *Invocations

func (*Invocations) GetInvocation

func (s *Invocations) GetInvocation(invocationID string) (*types.WorkflowInvocation, error)

GetInvocation returns an event-sourced invocation. If an error occurred the error is returned, if no invocation was found both return values are nil.

func (*Invocations) GetInvocationUpdates

func (s *Invocations) GetInvocationUpdates() *InvocationSubscription

GetInvocationSubscription returns a subscription to the updates of the invocation cache. Returns nil if the cache does not support pubsub.

Future: Currently this assumes the presence of a pubsub.Publisher interface in the cache. In the future we can fallback to pull-based mechanisms

type WorkflowSubscription

type WorkflowSubscription struct {
	*pubsub.Subscription
	// contains filtered or unexported fields
}

func (*WorkflowSubscription) Close

func (sub *WorkflowSubscription) Close() error

func (*WorkflowSubscription) ToNotification

func (sub *WorkflowSubscription) ToNotification(msg pubsub.Msg) (*fes.Notification, error)

type Workflows

type Workflows struct {
	fes.CacheReader // Currently needed for pubsub publisher interface, should be exposed here
}

func NewWorkflowsStore

func NewWorkflowsStore(workflows fes.CacheReader) *Workflows

func (*Workflows) GetWorkflow

func (s *Workflows) GetWorkflow(workflowID string) (*types.Workflow, error)

GetWorkflow returns an event-sourced workflow. If an error occurred the error is returned, if no workflow was found both return values are nil.

func (*Workflows) GetWorkflowUpdates

func (s *Workflows) GetWorkflowUpdates() *WorkflowSubscription

GetWorkflowNotifications returns a subscription to the updates of the workflow cache. Returns nil if the cache does not support pubsub.

Future: Currently this assumes the presence of a pubsub.Publisher interface in the cache. In the future we can fallback to pull-based mechanisms

Jump to

Keyboard shortcuts

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