studio

package
v4.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CliCommand

func CliCommand(version, dateBuilt string) *cli.Command

CliCommand is a cli.Command definition for interacting with Benthos studio.

func OptSetNowFn

func OptSetNowFn(fn func() time.Time) func(*PullRunner)

OptSetNowFn sets the function used to obtain a new time value representing now. By default time.Now is used.

Types

type DeploymentConfigDiff

type DeploymentConfigDiff struct {
	MainConfig      *DeploymentConfigMeta  `json:"main_config,omitempty"`
	AddResources    []DeploymentConfigMeta `json:"add_resources,omitempty"`
	RemoveResources []string               `json:"remove_resources,omitempty"`
}

DeploymentConfigDiff expresses config files that should be changed (removed, added, updated) in order to match the files of the deployment being synced to.

type DeploymentConfigMeta

type DeploymentConfigMeta struct {
	Name     string `json:"name"`
	Modified int64  `json:"modified"` // Unix TS in milliseconds
}

DeploymentConfigMeta describes a file that makes up part of a deployment.

type PullRunner

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

PullRunner encapsulates a component that runs a Benthos stream continuously by obtaining a deployment allocation from a Studio session, pulling the configs from that deployment, and then executing the configs in the background.

Each time Sync is called the runner will poll the session for any deployment reallocations, or config changes and attempt to reflect those changes in the running stream.

func NewPullRunner

func NewPullRunner(c *cli.Context, version, dateBuilt, token, secret string, opts ...func(p *PullRunner)) (*PullRunner, error)

NewPullRunner creates a new PullRunner from a cli context, which is used for overriding a range of stream behaviours and settings various studio specific details such as the endpoint. The version, date stamps must be provided as well as a valid token and secret for the session that will be accessed.

It's odd having to push a *cli.Context through here but I wanted to avoid needing to pass tens of parameters through for things like --set, --prefix-stream-endpoints, etc. Some of those customisation options are pushed deep into things like the manager constructor, and as cli options are expanded it'd be a drag to have to update every single constructor signature that calls into it.

func (*PullRunner) Stop

func (r *PullRunner) Stop(ctx context.Context) error

Stop any underlying stream and managers that may exist.

func (*PullRunner) Sync

func (r *PullRunner) Sync(ctx context.Context)

Sync with the target session, obtaining new allocations, config changes, passing errors and metrics, etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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