node

package
v0.0.2-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package node provides utilities to control all long running background services on Centrifuge node

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

type Bootstrapper struct{}

Bootstrapper implements bootstrap.Bootstrapper.

func (*Bootstrapper) Bootstrap

func (*Bootstrapper) Bootstrap(c map[string]interface{}) error

Bootstrap runs the severs. Note: this is a blocking call.

type Node

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

Node provides utilities to control all background services on Cent Node

func New

func New(services []Server) *Node

New returns a new Node with given services.

func (*Node) Name

func (n *Node) Name() string

Name returns "CentNode".

func (*Node) Start

func (n *Node) Start(ctx context.Context, startupErr chan<- error)

Start starts all services that are wired in the Node and waits for further actions depending on errors or commands from upstream.

type Server

type Server interface {

	// Name is the unique name given to the service within the Cent Node
	Name() string

	// Start starts the service, expectation is that this would always be called in a separate go routine.
	// WaitGroup contract should always be honoured by calling `defer wg.Done()`
	Start(ctx context.Context, wg *sync.WaitGroup, startupErr chan<- error)
}

Server interface must be implemented by all background services on Cent Node

Jump to

Keyboard shortcuts

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