bundle

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package bundle implements bundle downloading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name    string        `json:"name"`
	Service string        `json:"service"`
	Polling PollingConfig `json:"polling"`
}

Config represents configuration the plguin.

type Plugin

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

Plugin implements bundle downloading and activation.

func New

func New(config []byte, manager *plugins.Manager) (*Plugin, error)

New returns a new Plugin with the given config.

func (*Plugin) Register

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

Register a lisetner 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 PollingConfig

type PollingConfig struct {
	MinDelaySeconds *int64 `json:"min_delay_seconds,omitempty"` // min amount of time to wait between successful poll attempts
	MaxDelaySeconds *int64 `json:"max_delay_seconds,omitempty"` // max amount of time to wait between poll attempts
}

PollingConfig represents configuration for the plugin's polling behaviour.

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 the plugin.

Jump to

Keyboard shortcuts

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