Exemplo n.º 1
0
func (t *transport) registerAddr(addr *e3x.Addr) {
	if addr == nil {
		return
	}

	t.mtx.Lock()
	defer t.mtx.Unlock()
	t.addressTable[addr.Hashname()] = addr
}
Exemplo n.º 2
0
func (r *ring) Join(existing *e3x.Addr) error {
	m := mesh.FromEndpoint(r.endpoint)
	if m == nil {
		panic("Chord requires the `mesh` module")
	}

	t := newTransport(r.endpoint, m)
	t.registerAddr(existing)
	ring, err := chord.Join(r.conf, t, string(existing.Hashname()))
	if err != nil {
		return err
	}

	r.ring = ring
	return nil
}