Documentation ¶
Index ¶
- Constants
- Variables
- func FormatIPv4(ipv4 uint32) string
- func GenAlternativeStar(peers PeerList, off int) *graph.Graph
- func GenBinaryTree(k int) *graph.Graph
- func GenBinaryTreeStar(peers PeerList) *graph.Graph
- func GenCircularGraphPair(k, r int) (*graph.Graph, *graph.Graph)
- func GenDefaultReduceGraph(g *graph.Graph) *graph.Graph
- func GenMultiBinaryTreeStar(peers PeerList) []*graph.Graph
- func GenMultiStar(peers PeerList) []*graph.Graph
- func GenStarBcastGraph(k, r int) *graph.Graph
- func GenTree(peers PeerList) *graph.Graph
- func MustParseIPv4(host string) uint32
- func PackIPv4(ip net.IP) uint32
- func ParseIPv4(host string) (uint32, error)
- type Addr
- type Cluster
- type HostList
- func (hl HostList) Cap() int
- func (hl HostList) GenPeerList(np int, pr PortRange) (PeerList, error)
- func (hl HostList) GenRunnerList(port uint16) PeerList
- func (hl HostList) LookupHost(ipv4 uint32) string
- func (hl HostList) MustGenPeerList(np int, pr PortRange) PeerList
- func (hl HostList) ShrinkToFit(np int) HostList
- func (hl HostList) SlotOf(ipv4 uint32) int
- func (hl HostList) String() string
- type HostSpec
- type Interval
- type NetAddr
- type PeerID
- type PeerList
- func (pl PeerList) Bytes() []byte
- func (pl PeerList) Clone() PeerList
- func (pl PeerList) Contains(p PeerID) bool
- func (pl PeerList) DebugString() string
- func (pl PeerList) Diff(ql PeerList) (PeerList, PeerList)
- func (pl PeerList) Disjoint(ql PeerList) bool
- func (pl PeerList) Eq(ql PeerList) bool
- func (pl PeerList) HostCount() int
- func (pl PeerList) Intersection(ql PeerList) PeerList
- func (pl PeerList) LocalRank(q PeerID) (int, bool)
- func (pl PeerList) LocalSize(q PeerID) int
- func (pl PeerList) On(host uint32) PeerList
- func (pl PeerList) Others(self PeerID) PeerList
- func (pl PeerList) PartitionByHost() ([]int, []int)
- func (pl PeerList) Rank(q PeerID) (int, bool)
- func (pl PeerList) Select(ranks []int) PeerList
- func (pl PeerList) Set() map[PeerID]struct{}
- func (pl PeerList) String() string
- type PortRange
Constants ¶
View Source
const DefaultRunnerPort = uint16(38080)
Variables ¶
View Source
var DefaultHostList = HostList{ { IPv4: MustParseIPv4(`127.0.0.1`), Slots: runtime.NumCPU(), PublicAddr: `127.0.0.1`, }, }
View Source
var DefaultPortRange = PortRange{
Begin: 10000,
End: 11000,
}
View Source
var ErrInvalidHostSpec = errors.New("Invalid HostSpec")
View Source
var ErrNoEnoughCapacity = errors.New("no enough capacity")
Functions ¶
func FormatIPv4 ¶
func GenAlternativeStar ¶ added in v0.2.3
func GenBinaryTree ¶
func GenBinaryTreeStar ¶
func GenMultiBinaryTreeStar ¶ added in v0.2.1
func GenMultiStar ¶ added in v0.2.3
func GenStarBcastGraph ¶
GenStarBcastGraph generates a star shape graph with k vertices and centered at vertice r (0 <= r < k)
func MustParseIPv4 ¶
Types ¶
type Cluster ¶ added in v0.2.2
func (Cluster) DebugString ¶ added in v0.2.2
type HostList ¶
type HostList []HostSpec
func ParseHostList ¶
func (HostList) GenPeerList ¶
func (HostList) GenRunnerList ¶ added in v0.2.2
func (HostList) LookupHost ¶ added in v0.2.3
func (HostList) MustGenPeerList ¶ added in v0.2.3
func (HostList) ShrinkToFit ¶ added in v0.2.3
type HostSpec ¶
func (HostSpec) DebugString ¶ added in v0.2.3
type Interval ¶
Interval represents the interval of integers [Begin, End)
func EvenPartition ¶
EvenPartition parts an Interval into k parts such that the length of each part differ at most 1
type PeerID ¶
type PeerID NetAddr
PeerID is the unique identifier of a peer.
func ParsePeerID ¶ added in v0.2.2
func (PeerID) ColocatedWith ¶
func (PeerID) ListenAddr ¶ added in v0.2.2
type PeerList ¶
type PeerList []PeerID
PeerList is an ordered list of PeerIDs
func ParsePeerList ¶ added in v0.2.2
func (PeerList) DebugString ¶ added in v0.2.2
func (PeerList) Intersection ¶ added in v0.2.2
func (PeerList) PartitionByHost ¶ added in v0.2.3
PartitionByHost partitions the PeerList into several groups by host IP, each with a master. It returns two int list masters and masterOf, representing the partition, where masters is the list of ranks of masters masterOf[i] is the rank of master of the i-th peer
Source Files ¶
Click to show internal directories.
Click to hide internal directories.