Esempio n. 1
0
func newTransport(e *e3x.Endpoint, m mesh.Mesh) *transport {
	t := &transport{
		e:            e,
		m:            m,
		addressTable: map[hashname.H]*e3x.Addr{},
		localVnodes:  map[string]localRPC{},
	}

	if addr, _ := e.LocalAddr(); addr != nil {
		t.registerAddr(addr)
	}

	e.AddHandler("chord.list", e3x.HandlerFunc(t.handleListVnodes))
	e.AddHandler("chord.ping", e3x.HandlerFunc(t.handlePing))
	e.AddHandler("chord.predecessor.get", e3x.HandlerFunc(t.handleGetPredecessor))
	e.AddHandler("chord.notify", e3x.HandlerFunc(t.handleNotify))
	e.AddHandler("chord.successors.find", e3x.HandlerFunc(t.handleFindSuccessors))
	e.AddHandler("chord.predecessor.clear", e3x.HandlerFunc(t.handleClearPredecessor))
	e.AddHandler("chord.successor.skip", e3x.HandlerFunc(t.handleSkipSuccessor))

	return t
}