signaller

package
v0.0.0-...-1e35c27 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2016 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package signaller sends notifications to running PullDeploy daemons.

The signaller is intended to use Zookeeper for synchronization. If Zookeeper is not available, a timer is used as a fallback to drive polling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notification

type Notification struct {
	Source  NotifySource // The mechanism that caused the event
	Appname string       // The name of the application that caused the event
	Data    []byte       // Optional data associated with the event
}

A Notification identifies which monitored application has changed. They are obtained from the channel returned by Open().

type NotifySource

type NotifySource int

NotifySource indicates what mechanism triggered the event.

const (
	KNS_FORCED NotifySource = iota // Notification was created externally to signaller
	KNS_TIMER                      // Notification was triggered by a timer
	KNS_ZK                         // Notification was triggered by Zookeeper
)

The values that may appear as the Source in a Notification.

func (NotifySource) String

func (ns NotifySource) String() string

String provides a printable representation of a NotifySource.

type Registry

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

Registry is a registry of all hosts running Pulldeploy, with the environments and applications they are tracking.

NOTE: The Registry stores its data in Zookeeper ephemeral nodes, so this feature is available only when PullDeploy has access to a Zookeeper installation.

func (*Registry) Hosts

func (hr *Registry) Hosts(envName, appName string) []RegistryInfo

Hosts retrieves the information in the hosts registry for the given environment and application (requires Zookeeper).

func (*Registry) Register

func (hr *Registry) Register(envName, appName, hostName, version string, deployed []string)

Register enters the name of the local machine into the hosts registry, along with the currently released version and available deployments (requires Zookeeper).

func (*Registry) Unregister

func (hr *Registry) Unregister(envName, appName, hostName string)

Unregister removes the name of the local machine from the hosts registry (requires Zookeeper).

type RegistryInfo

type RegistryInfo struct {
	Hostname   string   // The name of the server running the application
	Envname    string   // The name of the environment this host is tracking
	Appname    string   // The name of the application this host is running
	AppVersion string   // The version of the application this host is serving
	Deployed   []string // The versions currently available on this host
}

RegistryInfo is used to present the information in the Registry.

type Signaller

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

Signaller is used to notify running daemons of deploy and release activity.

func New

New returns a new Signaller.

func (*Signaller) Close

func (sgnlr *Signaller) Close()

Close deallocates the resources allocated by Open.

func (*Signaller) GetRegistry

func (sgnlr *Signaller) GetRegistry() *Registry

GetRegistry retrieves an instance of the hosts registry.

func (*Signaller) Monitor

func (sgnlr *Signaller) Monitor(envName, appName string)

Monitor is used to ask for notifications for the given environment and application.

func (*Signaller) Notify

func (sgnlr *Signaller) Notify(envName, appName string, data []byte)

Notify sends a notication to all listening daemons in the specified environment.

func (*Signaller) Open

func (sgnlr *Signaller) Open() <-chan Notification

Open allocates the resources needed for sending and receiving notifications.

Jump to

Keyboard shortcuts

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