view

package
v0.0.0-...-1a21ecf Latest Latest
Warning

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

Go to latest
Published: May 8, 2015 License: MIT Imports: 6 Imported by: 8

Documentation

Overview

Package view implements the view type. A view is a set of processes, and it is used to put together all the system's processes.

Index

Constants

View Source
const (
	Join  updateType = "+"
	Leave updateType = "-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OldViewError

type OldViewError struct {
	NewView *View
}

func (OldViewError) Error

func (e OldViewError) Error() string

type Process

type Process struct {
	Addr string
}

func (Process) Less

func (thisProcess Process) Less(otherProcess Process) bool

type Update

type Update struct {
	Type    updateType
	Process Process
}

func (Update) Less

func (thisUpdate Update) Less(otherUpdate Update) bool

type View

type View struct {
	Entries map[Update]bool
	Members map[Process]bool // Cache, can be rebuilt from Entries
	ViewRef
}

View represents a server's view of the members of the distributed system. A View once created is immutable, for a mutable View, see type CurrentView.

func NewWithProcesses

func NewWithProcesses(processes ...Process) *View

func NewWithUpdates

func NewWithUpdates(updates ...Update) *View

func (*View) Equal

func (v *View) Equal(v2 *View) bool

func (*View) GetMembers

func (v *View) GetMembers() []Process

func (*View) GetMembersNotIn

func (v *View) GetMembersNotIn(v2 *View) []Process

func (*View) GetProcessPosition

func (v *View) GetProcessPosition(process Process) int

GetProcessPosition returns an unique number for the process in the view. Returns -1 if process is not a member of the view.

func (*View) GetUpdates

func (v *View) GetUpdates() []Update

func (*View) HasMember

func (v *View) HasMember(p Process) bool

func (*View) HasUpdate

func (v *View) HasUpdate(u Update) bool

func (*View) LessUpdatedThan

func (v *View) LessUpdatedThan(v2 *View) bool

func (*View) MoreUpdatedThan

func (v *View) MoreUpdatedThan(v2 *View) bool

func (*View) NewCopyWithUpdates

func (v *View) NewCopyWithUpdates(updates ...Update) *View

func (*View) NumberOfMembers

func (v *View) NumberOfMembers() int

func (*View) NumberOfToleratedFaults

func (v *View) NumberOfToleratedFaults() int

func (*View) NumberOfUpdates

func (v *View) NumberOfUpdates() int

func (*View) QuorumSize

func (v *View) QuorumSize() int

func (*View) String

func (v *View) String() string

type ViewRef

type ViewRef struct {
	Digest [sha1.Size]byte
}

func ViewToViewRef

func ViewToViewRef(v *View) ViewRef

func (ViewRef) String

func (vr ViewRef) String() string

Jump to

Keyboard shortcuts

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