Example #1
0
File: client.go Project: baeeq/god
// NewConn creates a new Conn to a cluster defined by the address of one of its members.
func NewConn(addr string) (result *Conn, err error) {
	result = &Conn{ring: common.NewRing()}
	var newNodes common.Remotes
	err = common.Switch.Call(addr, "Discord.Nodes", 0, &newNodes)
	result.ring.SetNodes(newNodes)
	return
}
Example #2
0
File: node.go Project: ckolbeck/god
func NewNode(addr string) (result *Node) {
	return &Node{
		ring:      common.NewRing(),
		position:  make([]byte, murmur.Size),
		addr:      addr,
		exports:   make(map[string]interface{}),
		metaLock:  new(sync.RWMutex),
		routeLock: new(sync.Mutex),
		state:     created,
	}
}