Skip to content

Commit 608a5e4

Browse files
committed
Use correct group.
1 parent 9d761a6 commit 608a5e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ A complete tutorial based on that example can be found here: [Service autodiscov
115115
**Q**: How does it work? I understand *what* `sleuth` does, but I want to know *how* it does it.
116116

117117
**A**: Services that instantiate a `sleuth.Client` create an *ad hoc* [`Gyre`](https://github.com/zeromq/gyre) network. `Gyre` is the Go port of the [`Zyre`](https://github.com/zeromq/zyre) project, which is built on top of [ØMQ](https://github.com/zeromq/libzmq) (ZeroMQ). Nodes in the network discover each other using a UDP beacon on port `5670`. The actual communication between nodes happens on ephemeral `TCP` connections. What `sleuth` does is to manage this life cycle:
118-
* A peer joins the `Gyre` network as a member of the group `SLEUTH-v0`. If the peer offers a service, *i.e.*, if it has an [`http.Handler`](https://golang.org/pkg/net/http/#Handler), it notifies the rest of the network when it announces itself. The peer might have no service to offer, thus operating in client-only mode, or it may offer *one* service.
118+
* A peer joins the `Gyre` network as a member of the group `SLEUTH-v1`. If the peer offers a service, *i.e.*, if it has an [`http.Handler`](https://golang.org/pkg/net/http/#Handler), it notifies the rest of the network when it announces itself. The peer might have no service to offer, thus operating in client-only mode, or it may offer *one* service.
119119
* The peer finds other peers on the network. If you have asked the `sleuth` client to [`WaitFor()`](https://godoc.org/github.com/ursiform/sleuth#Client.WaitFor) one or more services to appear before continuing, that call will block until it has found those services.
120120
* If the peer is offering a service, `sleuth` automatically listens for incoming requests in a separate goroutine and responds to incoming requests by invoking the [`http.Handler`](https://golang.org/pkg/net/http/#Handler) that was passed in during instantiation.
121121
* When you make a request to an available service, `sleuth` marshals the request, sends it to one of the available peers that offers that service, and waits for a response. If the response succeeds, it returns an [`http.Response`](https://golang.org/pkg/net/http/#Response); if it times out, it returns an error. The `sleuth` client [`Do()`](https://godoc.org/github.com/ursiform/sleuth#Client.Do) method has the same signature as the `http` client [`Do()`](https://golang.org/pkg/net/http/#Client.Do) method in order to operate as a drop-in replacement.

sleuth.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
const (
21-
group = "SLEUTH-v0"
21+
group = "SLEUTH-v1"
2222
port = 5670
2323
recv = "RECV"
2424
repl = "REPL"
@@ -91,7 +91,7 @@ func newNode(conn *connection, log *logger.Logger) (*gyre.Gyre, error) {
9191
if err := node.Start(); err != nil {
9292
return nil, newError(errStart, err.Error())
9393
}
94-
if err := node.Join(group); err != nil {
94+
if err := node.Join(conn.group); err != nil {
9595
node.Stop()
9696
return nil, newError(errJoin, err.Error())
9797
}
@@ -101,7 +101,7 @@ func newNode(conn *connection, log *logger.Logger) (*gyre.Gyre, error) {
101101
} else {
102102
role = "client-only"
103103
}
104-
log.Listen("sleuth: [%s:%d][%s %s]", group, conn.port, role, node.Name())
104+
log.Listen("sleuth: [%s:%d][%s %s]", conn.group, conn.port, role, node.Name())
105105
return node, nil
106106
}
107107

0 commit comments

Comments
 (0)