resource

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: GPL-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const DisplayEvent = "DisplayEvent"

DisplayEvent is the sentinel to signal a display update

View Source
const EOF = "EOF"

EOF is the End Of File sentinel to signal no further Events are expected.

View Source
const PruneEvent = "PruneEvent"

PruneEvent is the sentinel to signal a prune operation

Variables

View Source
var ConnKeys = connKeys{"name", "peer-node-id", "conn-name", "connection", "role", "congested"}

ConnKeys is a data container for the field keys of connection Events.

View Source
var DevKeys = devKeys{"name", "volume", "minor", "disk", "client", "size", "read", "written", "al-writes", "bm-writes", "upper-pending", "lower-pending", "al-suspended", "blocked", "quorum"}

DevKeys is a data container for the field keys of device Events.

View Source
var PeerDevKeys = peerDevKeys{"name", "peer-node-id", "conn-name", "volume", "replication", "peer-disk", "peer-client", "resync-suspended", "received", "sent", "out-of-sync", "pending", "unacked"}

PeerDevKeys is a data container for the field keys of device Events.

View Source
var ResKeys = resKeys{"name", "role", "suspended", "write-ordering", "unconfigured"}

ResKeys is a data container for the field keys of resource Events.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	sync.RWMutex

	Resource         string
	PeerNodeID       string
	ConnectionName   string
	ConnectionStatus string
	// Long form explanation of ConnectionStatus.
	ConnectionHint string
	Role           string
	Congested      string

	// Calculated Values
	Danger uint64
	// contains filtered or unexported fields
}

Connection represents the connection from the local resource to a remote resource.

func (*Connection) Update

func (c *Connection) Update(e Event)

Update the Connection with a new Event.

type DevVolume

type DevVolume struct {
	Minor     string
	DiskState string
	// Long from explanation of DiskState.
	DiskHint             string
	Client               string
	Quorum               string
	Size                 uint64
	ActivityLogSuspended string
	Blocked              string
	QuorumAlert          bool

	// Calculated Values
	ReadKiB            *rate
	WrittenKiB         *rate
	ActivityLogUpdates *rate
	BitMapUpdates      *rate

	UpperPending *minMaxAvgCurrent
	LowerPending *minMaxAvgCurrent
	// contains filtered or unexported fields
}

DevVolume represents a single volume of a local DRBD virtual block device.

func NewDevVolume

func NewDevVolume(maxLen int) *DevVolume

NewDevVolume returns a DevVolume with internal structures initialized.

type Device

type Device struct {
	sync.RWMutex
	Resource string
	Volumes  map[string]*DevVolume

	//Calculated Values.
	Danger uint64
}

Device represents a local DRBD virtual block device.

func NewDevice

func NewDevice() *Device

NewDevice returns a blank device with maps initialized.

func (*Device) Update

func (d *Device) Update(e Event)

Update the devices data with a new Event.

type Event

type Event struct {
	TimeStamp time.Time
	// EventType is the kind of update being relayed from DRBD: exists, change, call, etc.
	EventType string
	// Target is the kind of data contained within the Event: peer-device, connection, etc.
	Target string
	// Key/Value pairs separated by a ":"
	Fields map[string]string
}

Event is a serialized update from the DRBD kernel module."

func NewDisplayEvent

func NewDisplayEvent() Event

NewDisplayEvent returns a special Event signaling that the display should be updated

func NewEOF

func NewEOF() Event

NewEOF returns a special Event signaling that no further input should be expected.

func NewEvent

func NewEvent(e string) (Event, error)

NewEvent parses the normal string output of drbdsetup events2 and returns an Event.

func NewPruneEvent added in v0.2.3

func NewPruneEvent() Event

NewPruneEvent returns a special Event signaling that the display should prune outdated data

func NewUnconfiguredRes

func NewUnconfiguredRes(name string) Event

NewUnconfiguredRes returns a special Event signaling that this resource is down(unconfigured).

type PeerDevVol

type PeerDevVol struct {
	ReplicationStatus string
	// Long form explanation of Replication Status.
	ReplicationHint string
	DiskState       string
	DiskHint        string
	Client          string
	ResyncSuspended string

	// Calulated Values
	OutOfSyncKiB  *minMaxAvgCurrent
	PendingWrites *minMaxAvgCurrent
	UnackedWrites *minMaxAvgCurrent

	ReceivedKiB *rate
	SentKiB     *rate
	// contains filtered or unexported fields
}

PeerDevVol represents a single volume of a remote resources virtual block device.

func NewPeerDevVol

func NewPeerDevVol(maxLen int) *PeerDevVol

NewPeerDevVol returns a PeerDevVol with internal structs initialized.

type PeerDevice

type PeerDevice struct {
	sync.RWMutex

	Resource       string
	PeerNodeID     string
	ConnectionName string
	Volumes        map[string]*PeerDevVol

	// Calulated values.
	Danger uint64
	// contains filtered or unexported fields
}

PeerDevice represents the virtual DRBD block device of a remote resource.

func NewPeerDevice

func NewPeerDevice() *PeerDevice

NewPweerDevice returns a PeerDevice with internal maps initialized.

func (*PeerDevice) Update

func (p *PeerDevice) Update(e Event)

Update the PeerDevice with a new Event.

type Resource

type Resource struct {
	sync.RWMutex

	Name          string
	Role          string
	Suspended     string
	WriteOrdering string
	Unconfigured  bool

	// Calulated Values
	Danger uint64
	// contains filtered or unexported fields
}

Resource represents basic resource info.

func (*Resource) Update

func (r *Resource) Update(e Event)

Update the values of Resource with a new Event.

type Updater

type Updater interface {
	Update(Event)
}

Updater modify their data based on incoming Events.

Jump to

Keyboard shortcuts

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