Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
4 spaces looks much better on github
  • Loading branch information
motiejus committed Jul 6, 2016
1 parent 7a31583 commit 98552ea
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
22 changes: 11 additions & 11 deletions examples/ping-json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ A simple ping-pong service implementation that that integrates ringpop to forwar

All commands are relative to this directory:

$ cd ${TESTDIR} # examples/ping-json
$ go build
$ cd ${TESTDIR} # examples/ping-json
$ go build

Start a custer of 5 nodes using [tick-cluster][1]:

$ tick-cluster.js --interface=127.0.0.1 -n 5 ping-json &> tick-cluster.log &
$ sleep 5
$ tick-cluster.js --interface=127.0.0.1 -n 5 ping-json &> tick-cluster.log &
$ sleep 5

Lookup the node `my_key` key belongs to using [tcurl][2]:

$ tcurl ringpop -P hosts.json /admin/lookup '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"dest":"127.0.0.1:300?"},"headers":{"as":"json"},"trace":"*"} (glob)
$ tcurl ringpop -P hosts.json /admin/lookup '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"dest":"127.0.0.1:300?"},"headers":{"as":"json"},"trace":"*"} (glob)

Call the `/ping` endpoint (multiple times) and see the request being forwarded. Each request is sent to a random node in the cluster because of the `-P hosts.json` argument--but is always handled by the node owning the key. This can be seen in the `from` field of the response:

$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"message":"Hello, world!","from":"127.0.0.1:300?","p":""},"headers":{"as":"json"},"trace":"*"} (glob)
$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"message":"Hello, world!","from":"127.0.0.1:300?","p":""},"headers":{"as":"json"},"trace":"*"} (glob)

Optionally, set the `p` header. This value will be forwarded together with the request body to the node owning the key. Its value is returned in the response body in the `pheader` field:

$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}' --headers '{"p": "my_header"}'
{"ok":true,"head":null,"body":{"message":"Hello, world!","from":"127.0.0.1:300?","pheader":"my_header"},"headers":{"as":"json"},"trace":"*"} (glob)
$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}' --headers '{"p": "my_header"}'
{"ok":true,"head":null,"body":{"message":"Hello, world!","from":"127.0.0.1:300?","pheader":"my_header"},"headers":{"as":"json"},"trace":"*"} (glob)

$ kill %1
$ kill %1

[1]:https://github.com/uber/ringpop-common/
[2]:https://github.com/uber/tcurl
24 changes: 12 additions & 12 deletions examples/ping-thrift-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ This example it's different than the others because it uses ringpop specific gen

All commands are relative to this directory:

$ cd ${TESTDIR} # examples/ping-thrift-gen
$ cd ${TESTDIR} # examples/ping-thrift-gen

(optional, the files are already included) Generate the thrift code:

$ thrift-gen --generateThrift --outputDir gen-go --inputFile ping.thrift --template github.com/uber/ringpop-go/ringpop.thrift-gen
$ thrift-gen --generateThrift --outputDir gen-go --inputFile ping.thrift --template github.com/uber/ringpop-go/ringpop.thrift-gen

Build the example binary:

$ go build
$ go build

Start a custer of 5 nodes using [tick-cluster][1]:

$ tick-cluster.js --interface=127.0.0.1 -n 5 ping-thrift-gen &> tick-cluster.log &
$ sleep 5
$ tick-cluster.js --interface=127.0.0.1 -n 5 ping-thrift-gen &> tick-cluster.log &
$ sleep 5

Lookup the node `my_key` key belongs to using [tcurl][2]:

$ tcurl ringpop -P hosts.json /admin/lookup '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"dest":"127.0.0.1:300?"},"headers":{"as":"json"},"trace":"*"} (glob)
$ tcurl ringpop -P hosts.json /admin/lookup '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"dest":"127.0.0.1:300?"},"headers":{"as":"json"},"trace":"*"} (glob)

Call the `PingPongService::Ping` endpoint (multiple times) and see the request being forwarded. Each request is sent to a random node in the cluster because of the `-P hosts.json` argument--but is always handled by the node owning the key. This can be seen in the `from` field of the response:

$ tcurl pingchannel -P hosts.json --thrift ./ping.thrift PingPongService::Ping '{"request": {"key": "my_key"}}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":""},"headers":{"as":"thrift"},"trace":"*"} (glob)
$ tcurl pingchannel -P hosts.json --thrift ./ping.thrift PingPongService::Ping '{"request": {"key": "my_key"}}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":""},"headers":{"as":"thrift"},"trace":"*"} (glob)

Optionally, set the `p` header. This value will be forwarded together with the request body to the node owning the key. Its value is returned in the response body in the `pheader` field:

$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}' --headers '{"p": "my_header"}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":"my_header"},"headers":{"as":"thrift"},"trace":"*"} (glob)
$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}' --headers '{"p": "my_header"}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":"my_header"},"headers":{"as":"thrift"},"trace":"*"} (glob)

$ kill %1
$ kill %1

[1]:https://github.com/uber/ringpop-common/
[2]:https://github.com/uber/tcurl
24 changes: 12 additions & 12 deletions examples/ping-thrift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@ A simple ping-pong service implementation that that integrates ringpop to forwar

All commands are relative to this directory:

$ cd ${TESTDIR} # examples/ping-thrift
$ cd ${TESTDIR} # examples/ping-thrift

(optional, the files are already included) Generate the thrift code:

$ thrift-gen --generateThrift --outputDir gen-go --inputFile ping.thrift
$ thrift-gen --generateThrift --outputDir gen-go --inputFile ping.thrift

Build the example binary:

$ go build
$ go build


Start a custer of 5 nodes using [tick-cluster][1]:

$ tick-cluster.js --interface=127.0.0.1 -n 5 ping-thrift &> tick-cluster.log &
$ sleep 5
$ tick-cluster.js --interface=127.0.0.1 -n 5 ping-thrift &> tick-cluster.log &
$ sleep 5

Lookup the node `my_key` key belongs to using [tcurl][2]:

$ tcurl ringpop -P hosts.json /admin/lookup '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"dest":"127.0.0.1:300?"},"headers":{"as":"json"},"trace":"*"} (glob)
$ tcurl ringpop -P hosts.json /admin/lookup '{"key": "my_key"}'
{"ok":true,"head":null,"body":{"dest":"127.0.0.1:300?"},"headers":{"as":"json"},"trace":"*"} (glob)

Call the `PingPongService::Ping` endpoint (multiple times) and see the request being forwarded. Each request is sent to a random node in the cluster because of the `-P hosts.json` argument--but is always handled by the node owning the key. This can be seen in the `from` field of the response:

$ tcurl pingchannel -P hosts.json --thrift ./ping.thrift PingPongService::Ping '{"request": {"key": "my_key"}}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":""},"headers":{"as":"thrift"},"trace":"*"} (glob)
$ tcurl pingchannel -P hosts.json --thrift ./ping.thrift PingPongService::Ping '{"request": {"key": "my_key"}}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":""},"headers":{"as":"thrift"},"trace":"*"} (glob)

Optionally, set the `p` header. This value will be forwarded together with the request body to the node owning the key. Its value is returned in the response body in the `pheader` field:

$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}' --headers '{"p": "my_header"}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":"my_header"},"headers":{"as":"thrift"},"trace":"*"} (glob)
$ tcurl pingchannel -P hosts.json /ping '{"key": "my_key"}' --headers '{"p": "my_header"}'
{"ok":true,"head":{},"body":{"message":"Hello, world!","from_":"127.0.0.1:300?","pheader":"my_header"},"headers":{"as":"thrift"},"trace":"*"} (glob)

$ kill %1
$ kill %1

[1]:https://github.com/uber/ringpop-common/
[2]:https://github.com/uber/tcurl
2 changes: 1 addition & 1 deletion test/run-example-tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
set -euo pipefail


declare cram_opts="-v --shell=/bin/bash"
declare cram_opts="-v --shell=/bin/bash --indent=4"
declare prog_cram="cram"
declare test_files="${0%/*}/../examples/*/README.md"

Expand Down

0 comments on commit 98552ea

Please sign in to comment.