stacks

package
v0.0.0-...-528b28c Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStackAlreadyExists occurs when a given stack name is already being used
	ErrStackAlreadyExists = errors.New("the given stack name is already being used")

	// ErrHostAlreadyExists occurs when a given host which should get added already exists in the current stack
	ErrHostAlreadyExists = errors.New("the given host already exists")

	// ErrHostDoesNotExist occurs when a given host does not exist in the current stack
	ErrHostDoesNotExist = errors.New("the given host does not exist")

	// ErrAllHostsOffline occurs when all hosts of the current stack are offline
	ErrAllHostsOffline = errors.New("all hosts of the current stack are offline")
)

Functions

This section is empty.

Types

type Stack

type Stack struct {
	ID    primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Name  string             `bson:"name" json:"name"`
	Hosts []string           `bson:"hosts" json:"hosts"`
}

Stack represents a stack of API instances

func Create

func Create(name string, hosts ...string) (*Stack, error)

Create creates a new stack

func Retrieve

func Retrieve(name string) (*Stack, error)

Retrieve retrieves the stack with the given name

func (*Stack) AddHost

func (stack *Stack) AddHost(host string) error

AddHost adds the given host to the current stack

func (*Stack) CalculateBestHost

func (stack *Stack) CalculateBestHost() (string, error)

CalculateBestHost returns the host which has the best latency

func (*Stack) Delete

func (stack *Stack) Delete() error

Delete deletes the current stack

func (*Stack) RemoveHost

func (stack *Stack) RemoveHost(host string) error

RemoveHost removes the given host from the current stack

func (*Stack) Update

func (stack *Stack) Update() error

Update writes the current local variables of the current stack into the database

Jump to

Keyboard shortcuts

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