iprpic

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSegments = []*Segment{
	{Bucket: 3125, Rectangle: image.Rect(5, 1, 5, 5), Color: color.RandomPlan9PaletteColor()},
	{Bucket: 625, Rectangle: image.Rect(4, 1, 4, 5), Color: color.RandomPlan9PaletteColor()},
	{Bucket: 125, Rectangle: image.Rect(3, 1, 3, 5), Color: color.RandomPlan9PaletteColor()},
	{Bucket: 25, Rectangle: image.Rect(2, 1, 2, 5), Color: color.RandomPlan9PaletteColor()},
	{Bucket: 5, Rectangle: image.Rect(1, 1, 1, 5), Color: color.RandomPlan9PaletteColor()},
	{Bucket: 1, Rectangle: image.Rect(0, 1, 0, 5), Color: color.RandomPlan9PaletteColor()},
}

DefaultSegments provides a default set of segments.

Functions

func SignalHandler

func SignalHandler(ctx context.Context, cancel func())

SignalHandler blocks, waiting for a signal from the system, before clearing the screen.

Types

type Counter

type Counter struct {
	Segments []*Segment
	// contains filtered or unexported fields
}

Counter represents the section of the display that shows the current pin count.

func NewCounter

func NewCounter(fb *screen.FrameBuffer, c client.Client, segments []*Segment) *Counter

NewCounter contructs a Counter.

func (*Counter) DrawPinCount

func (c *Counter) DrawPinCount(ctx context.Context)

DrawPinCount draws a pixel a color everytime that peer gets a new metric. Also, does a flashy animation indicating whether a pin or unpin occurred.

type Direction

type Direction int

Direction is the direction that an animation should go across the screen.

const (
	Up Direction = iota + 1
	Down
	Left
	Right
)

Directions

type Peer

type Peer struct {
	peer.ID
	image.Point
	Color color.Pixel565
}

Peer contains the peer id and its position on the LED display.

type Segment

type Segment struct {
	Bucket int
	image.Rectangle

	Color color.Pixel565
	// contains filtered or unexported fields
}

Segment represents a column segment of the counter.

type Statuses

type Statuses struct {
	Self peer.ID

	Peers []*Peer
	// contains filtered or unexported fields
}

Statuses represents the section of the display that shows the status of the other peers in the cluster.

func NewStatuses

func NewStatuses(fb *screen.FrameBuffer, self peer.ID, c client.Client) *Statuses

NewStatuses constructs a Statuses type with a Cluster client.

func (*Statuses) AddNewPeer

func (s *Statuses) AddNewPeer(pid peer.ID) bool

AddNewPeer adds a newly found peer to the Statuses Peers slice and assigns it a new position. Returns false if there is no more room in the slice.

func (*Statuses) DrawPeerStatuses

func (s *Statuses) DrawPeerStatuses(ctx context.Context)

DrawPeerStatuses draws a pixel a color everytime that peer gets a new metric.

func (*Statuses) DropExpiredPeer

func (s *Statuses) DropExpiredPeer(pid peer.ID) bool

DropExpiredPeer removes a peer from the Statuses Peers slice.

func (*Statuses) Full

func (s *Statuses) Full() bool

Full returns if the Peers array is full.

func (*Statuses) Peer

func (s *Statuses) Peer(pid peer.ID) *Peer

Peer returns the peer object from the Peers array.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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