Пример #1
0
func (t *transport) Handler() http.Handler {
	pipelineHandler := NewHandler(t.raft, t.clusterID)
	streamHandler := newStreamHandler(t, t.raft, t.id, t.clusterID)
	mux := http.NewServeMux()
	mux.Handle(RaftPrefix, pipelineHandler)
	mux.Handle(RaftStreamPrefix+"/", streamHandler)
	mux.Handle(ProbingPrefix, probing.NewHandler())
	return mux
}
Пример #2
0
func (t *Transport) Handler() http.Handler {
	pipelineHandler := newPipelineHandler(t.Raft, t.ClusterID)
	streamHandler := newStreamHandler(t, t.Raft, t.ID, t.ClusterID)
	snapHandler := newSnapshotHandler(t.Raft, t.Snapshotter, t.ClusterID)
	mux := http.NewServeMux()
	mux.Handle(RaftPrefix, pipelineHandler)
	mux.Handle(RaftStreamPrefix+"/", streamHandler)
	mux.Handle(RaftSnapshotPrefix, snapHandler)
	mux.Handle(ProbingPrefix, probing.NewHandler())
	return mux
}