control

package
v0.0.0-...-a9890c3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionOp

type ActionOp int32

ActionOp operation being applied to a volume

const (
	//OpAdd add volume
	OpAdd ActionOp = iota
	//OpRemove remove volume
	OpRemove
	//OpUpdate update config of volume
	OpUpdate
)

type Controller

type Controller interface {
	//VolumesCh provides updates to storage nodes for adding or removing volumes
	//If existing is true, all existing volumes wil be streamed to the chan
	VolumesCh(exiting bool) <-chan VolumeAction

	//AttachmentsCh provides updates to agent nodes for adding or removing volume attachments
	//If existing is true, all existing attachments wil be streamed to the chan
	AttachmentsCh(exiting bool) <-chan VolumeAction

	//Discover provides a mechanism for finding peer endpoints
	Discover(peer string) (*net.UDPAddr, error)

	//Register allows a server to register it's endpoint
	Register(peer string, addr *net.UDPAddr) error

	//Peers provides information about which peers should contain volumes
	Peers(volumeID string) ([]*PeerInfo, error)
}

Controller provides cluster level management of individual SBS nodes

type InMemController

type InMemController struct {
	Volumes     map[string]*volumesAPI.Volume
	Attachments map[string]*volumesAPI.Volume
	// contains filtered or unexported fields
}

InMemController in-memory controller; useful for tests Volumes will be assigned to all peers

func NewInMemController

func NewInMemController() *InMemController

NewInMemController provides a new in-memory controller instance for testing

func (*InMemController) AttachmentsCh

func (imc *InMemController) AttachmentsCh(existing bool) <-chan VolumeAction

AttachmentsCh provides updates to agent nodes for adding or removing volume attachments

func (*InMemController) DefineAttachment

func (imc *InMemController) DefineAttachment(vol *volumesAPI.Volume, isUpdate bool)

DefineAttachment adds a new attachment and notifies all peers of new volume

func (*InMemController) DefineVolume

func (imc *InMemController) DefineVolume(vol *volumesAPI.Volume, isUpdate bool)

DefineVolume adds a new volume and notifies all peers of new volume

func (*InMemController) Discover

func (imc *InMemController) Discover(peer string) (*net.UDPAddr, error)

Discover provides a mechanism for finding peer endpoints

func (*InMemController) PeerIDs

func (imc *InMemController) PeerIDs() []string

PeerIDs provides a list of connected peers

func (*InMemController) Peers

func (imc *InMemController) Peers(volumeID string) ([]*PeerInfo, error)

Peers provides information about which peers should contain volumes

func (*InMemController) Register

func (imc *InMemController) Register(id string, addr *net.UDPAddr) error

Register allows a server to register it's endpoint

func (*InMemController) RemoveVolume

func (imc *InMemController) RemoveVolume(id string)

RemoveVolume removes a volme along with attachments and notifies all peers of the change

func (*InMemController) VolumesCh

func (imc *InMemController) VolumesCh(existing bool) <-chan VolumeAction

VolumesCh provides updates to storage nodes for adding or removing volumes

type PeerInfo

type PeerInfo struct {
	ID   string
	Addr *net.UDPAddr
}

PeerInfo contains basic info about contacting a peer

type VolumeAction

type VolumeAction struct {
	Op    ActionOp
	Desc  *volumesAPI.Volume
	Peers []string
}

VolumeAction provides update data of volume changes

Jump to

Keyboard shortcuts

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