flow

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package flow is a middleman between sources and destinations. A flow is a collection of destinations' actions, and can be executed by sources' triggers.

Transformation from triggers to actions shall happen here.

This is useful because it allows to:

  • Enable or disable flows when needed;
  • Share flows between multiple triggers;
  • Share data structures between triggers and actions;
  • Add business logic specific to a flow without impacting the triggers and actions.

Index

Constants

This section is empty.

Variables

View Source
var Defaults = &Options{
	Context: context.Background(),
	Enabled: false,
}

Defaults are the defaults options set for a flow. When not set, these values will automatically be applied.

Functions

This section is empty.

Types

type Flow

type Flow interface {

	// Options returns the options originally passed to the Options struct.
	Options() *Options

	// Transform returns a slice of actions to run, grouped by their destination
	// name. It is in charge of the "T" in the ETL process: it is used to Transform
	// data from triggers to actions.
	Transform(*Toolkit) destination.Actions
}

Flow is a middleman allowing triggers to run actions.

A new flow can be generated using the Blacksmith CLI:

$ blacksmith generate flow --name <name> [--path <path>]

type Options

type Options struct {

	// Context is a free key-value dictionary that will be passed to the flow.
	Context context.Context `json:"-"`

	// Enabled lets the user enable or disable a flow.
	Enabled bool `json:"enabled"`
}

Options is the options a user can pass to use a flow.

type Toolkit

type Toolkit struct {

	// Logger gives access to the logrus Logger passed in options when creating the
	// Blacksmith application.
	Logger *logrus.Logger

	// Service represents the instance of the gateway service registered in the
	// supervisor and currently executing the flow.
	//
	// Note: This is nil when there is no supervisor adapter configured.
	Service *supervisor.Service

	// EventID is the unique identifier of the event generated by the gateway and
	// that is being processed by the flow.
	//
	// Example: "1UYc8EebLqCAFMOSkbYZdJwNLAJ"
	EventID string
}

Toolkit contains a suite of utilities and data to help the user successfully run the flow.

Jump to

Keyboard shortcuts

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