node

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitNode = util.NewConfList(cfg.InitnodeList, defaultInitNode)

InitNode stores initial nodes.

Functions

This section is empty.

Types

type Node

type Node struct {
	Nodestr string
}

Node represents node info.

func MakeNode

func MakeNode(host, path string, port int) (*Node, error)

MakeNode makes node from host info.

func Me added in v0.1.0

func Me(servernameIfExist bool) *Node

Me converts myself to *Node.

func MustNew added in v0.1.0

func MustNew(names []string) []*Node

MustNew makes node slice from names.

func New added in v0.1.0

func New(nodestr string) (*Node, error)

New checks nodestr format and returns node obj.

func (*Node) Bye added in v0.1.0

func (n *Node) Bye() bool

Bye says goodBye to n and returns true if success.

func (*Node) Equals added in v0.0.6

func (n *Node) Equals(nn *Node) bool

Equals return true is Nodestr is equal.

func (*Node) GetherNodes added in v0.0.11

func (n *Node) GetherNodes() []*Node

GetherNodes gethers nodes from n.

func (*Node) IsAllowed

func (n *Node) IsAllowed() bool

IsAllowed returns fase if n is not allowed and denied.

func (*Node) Join added in v0.1.0

func (n *Node) Join() (*Node, error)

Join requests n to Join me and return true and other node name if success.

func (*Node) Ping

func (n *Node) Ping() (string, error)

Ping pings to n and return response.

func (*Node) Talk

func (n *Node) Talk(message string, fn func(string) error) ([]string, error)

Talk talks with n with the message and returns data.

func (*Node) Toxstring added in v0.1.0

func (n *Node) Toxstring() string

Toxstring covnerts Nodestr to saku node format.

type Slice

type Slice []*Node

Slice is slice of node.

func NewSlice added in v0.1.0

func NewSlice(names []string) Slice

NewSlice makes node slice from names.

func (Slice) Extend

func (ns Slice) Extend(a Slice) Slice

Extend make a New nodeslice including specified slices.

func (Slice) GetNodestrSlice added in v0.1.0

func (ns Slice) GetNodestrSlice() []string

GetNodestrSlice returns slice of Nodestr of nodes.

func (Slice) Has added in v0.0.6

func (ns Slice) Has(n *Node) bool

Has returns true if ns has n.

func (Slice) Len

func (ns Slice) Len() int

Len returns size of nodes.

func (Slice) ToMap added in v0.1.0

func (ns Slice) ToMap() map[string]struct{}

ToMap returns map[nodestr]struct{}{} for searching a node.

func (Slice) Uniq added in v0.1.0

func (ns Slice) Uniq() Slice

Uniq solidate the slice.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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