bundle

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package bundle implements bundle downloading.

Index

Constants

View Source
const Name = "bundle"

Name identifies the plugin on manager.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	download.Config

	Name    string `json:"name"`
	Service string `json:"service"`
}

Config represents configuration the plguin.

func ParseConfig added in v0.10.2

func ParseConfig(config []byte, services []string) (*Config, error)

ParseConfig validates the config and injects default values.

type Plugin

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

Plugin implements bundle activation.

func Lookup added in v0.10.2

func Lookup(manager *plugins.Manager) *Plugin

Lookup returns the bundle plugin registered with the manager.

func New

func New(parsedConfig *Config, manager *plugins.Manager) *Plugin

New returns a new Plugin with the given config.

func (*Plugin) Reconfigure added in v0.10.2

func (p *Plugin) Reconfigure(ctx context.Context, config interface{})

Reconfigure notifies the plugin that it's configuration has changed.

func (*Plugin) Register

func (p *Plugin) Register(name interface{}, listener func(Status))

Register a listener to receive status updates. The name must be comparable.

func (*Plugin) Start

func (p *Plugin) Start(ctx context.Context) error

Start runs the plugin. The plugin will periodically try to download bundles from the configured service. When a new bundle is downloaded, the data and policies are extracted and inserted into storage.

func (*Plugin) Stop

func (p *Plugin) Stop(ctx context.Context)

Stop stops the plugin.

func (*Plugin) Unregister

func (p *Plugin) Unregister(name interface{})

Unregister a listener to stop receiving status updates.

type Status

type Status struct {
	Name                     string    `json:"name"`
	ActiveRevision           string    `json:"active_revision,omitempty"`
	LastSuccessfulActivation time.Time `json:"last_successful_activation,omitempty"`
	LastSuccessfulDownload   time.Time `json:"last_successful_download,omitempty"`
	Code                     string    `json:"code,omitempty"`
	Message                  string    `json:"message,omitempty"`
	Errors                   []error   `json:"errors,omitempty"`
}

Status represents the status of processing a bundle.

func (*Status) SetActivateSuccess added in v0.10.2

func (s *Status) SetActivateSuccess(revision string)

SetActivateSuccess updates the status object to reflect a successful activation.

func (*Status) SetDownloadSuccess added in v0.10.2

func (s *Status) SetDownloadSuccess()

SetDownloadSuccess updates the status object to reflect a successful download.

func (*Status) SetError added in v0.10.2

func (s *Status) SetError(err error)

SetError updates the status object to reflect a failure to download or activate. If err is nil, the error status is cleared.

Jump to

Keyboard shortcuts

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