Permalink
Browse files

Copyediting changes

  • Loading branch information...
1 parent d63fed7 commit 837932bd0bca9cfff7e0a0c2beda4d14c688b900 @hintjens hintjens committed Jan 14, 2013
Showing with 1,916 additions and 1,786 deletions.
  1. +1 −0 .gitignore
  2. +75 −77 chapter1.txt
  3. +163 −168 chapter2.txt
  4. +160 −160 chapter3.txt
  5. +214 −206 chapter4.txt
  6. +158 −154 chapter5.txt
  7. +236 −236 chapter6.txt
  8. +282 −282 chapter7.txt
  9. +352 −265 chapter8.txt
  10. +2 −2 examples/C/asyncsrv.c
  11. +6 −6 examples/C/bstar.c
  12. +1 −1 examples/C/bstarcli.c
  13. +3 −3 examples/C/bstarsrv.c
  14. +12 −12 examples/C/clone.c
  15. +1 −1 examples/C/clonecli2.c
  16. +3 −3 examples/C/clonecli3.c
  17. +2 −2 examples/C/clonecli4.c
  18. +2 −2 examples/C/clonecli5.c
  19. +1 −1 examples/C/clonesrv2.c
  20. +1 −1 examples/C/clonesrv3.c
  21. +1 −1 examples/C/clonesrv4.c
  22. +2 −2 examples/C/clonesrv5.c
  23. +15 −15 examples/C/clonesrv6.c
  24. +1 −1 examples/C/espresso.c
  25. +1 −1 examples/C/fileio1.c
  26. +1 −1 examples/C/fileio2.c
  27. +17 −17 examples/C/flcliapi.c
  28. +1 −1 examples/C/flclient1.c
  29. +5 −5 examples/C/flclient2.c
  30. +13 −13 examples/C/interface.c
  31. +12 −12 examples/C/kvmsg.c
  32. +11 −10 examples/C/kvsimple.c
  33. +6 −6 examples/C/lbbroker.c
  34. +3 −3 examples/C/lbbroker2.c
  35. +2 −2 examples/C/lbbroker3.c
  36. +1 −1 examples/C/lvcache.c
  37. +13 −13 examples/C/mdbroker.c
  38. +8 −8 examples/C/mdcliapi.c
  39. +4 −3 examples/C/mdwrkapi.c
  40. +1 −1 examples/C/mtserver.c
  41. +3 −3 examples/C/peering2.c
  42. +10 −10 examples/C/peering3.c
  43. +3 −3 examples/C/ppqueue.c
  44. +5 −4 examples/C/ppworker.c
  45. +1 −1 examples/C/psenvpub.c
  46. +1 −1 examples/C/psenvsub.c
  47. +1 −1 examples/C/rrbroker.c
  48. +1 −1 examples/C/rrworker.c
  49. +1 −1 examples/C/rtreq.c
  50. +3 −3 examples/C/suisnail.c
  51. +2 −2 examples/C/ticlient.c
  52. +14 −14 examples/C/titanic.c
  53. +1 −1 examples/C/tripping.c
  54. +1 −1 examples/C/udpping1.c
  55. +5 −0 notes.txt
  56. +1 −1 part1.txt
  57. +1 −1 part2.txt
  58. +54 −28 postface.txt
  59. +10 −10 preface_print.txt
  60. +2 −2 preface_web.txt
  61. +3 −0 styles.txt
View
@@ -16,3 +16,4 @@ book.ps
book.xml
book.tex
upload.sh
+changes.txt
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
@@ -1,6 +1,6 @@
// Asynchronous client-to-server (DEALER to ROUTER)
//
-// While this example runs in a single process, that is just to make
+// While this example runs in a single process, that is to make
// it easier to start and stop the example. Each task has its own
// context and conceptually acts as a separate process.
@@ -105,7 +105,7 @@ server_worker (void *args, zctx_t *ctx, void *pipe)
}
}
-// The main thread simply starts several clients, and a server, and then
+// The main thread simply starts several clients and a server, and then
// waits for the server to finish.
int main (void)
View
@@ -199,9 +199,9 @@ int s_voter_ready (zloop_t *loop, zmq_pollitem_t *poller, void *arg)
// .until
// .split constructor
-// This is the constructor for our bstar class. We have to tell it whether
-// we're primary or backup server, and our local and remote endpoints to
-// bind and connect to:
+// This is the constructor for our {{bstar}} class. We have to tell it
+// whether we're primary or backup server, as well as our local and
+// remote endpoints to bind and connect to:
bstar_t *
bstar_new (int primary, char *local, char *remote)
@@ -249,7 +249,7 @@ bstar_destroy (bstar_t **self_p)
}
// .split zloop method
-// The zloop method returns the underlying zloop reactor, so we can add
+// This method returns the underlying zloop reactor, so we can add
// additional timers and readers:
zloop_t *
@@ -259,10 +259,10 @@ bstar_zloop (bstar_t *self)
}
// .split voter method
-// The voter method registers a client voter socket. Messages received
+// This method registers a client voter socket. Messages received
// on this socket provide the CLIENT_REQUEST events for the Binary Star
// FSM and are passed to the provided application handler. We require
-// exactly one voter per bstar instance:
+// exactly one voter per {{bstar}} instance:
int
bstar_voter (bstar_t *self, char *endpoint, int type, zloop_fn handler,
View
@@ -34,7 +34,7 @@ int main (void)
// .split main body of client
// We use a Lazy Pirate strategy in the client. If there's no
// reply within our timeout, we close the socket and try again.
- // In Binary Star, it's the client vote which decides which
+ // In Binary Star, it's the client vote that decides which
// server is primary; the client must therefore try to connect
// to each server in turn:
View
@@ -27,14 +27,14 @@ typedef struct {
int64_t peer_expiry; // When peer is considered 'dead'
} bstar_t;
-// We send state information every this often
+// We send state information this often
// If peer doesn't respond in two heartbeats, it is 'dead'
#define HEARTBEAT 1000 // In msecs
// .split Binary Star state machine
// The heart of the Binary Star design is its finite-state machine (FSM).
// The FSM runs one event at a time. We apply an event to the current state,
-// which checks if the event is accepted, and if so sets a new state:
+// which checks if the event is accepted, and if so, sets a new state:
static Bool
s_state_machine (bstar_t *fsm)
@@ -192,7 +192,7 @@ int main (int argc, char *argv [])
break; // Error, so exit
fsm.peer_expiry = zclock_time () + 2 * HEARTBEAT;
}
- // If we timed-out, send state to peer
+ // If we timed out, send state to peer
if (zclock_time () >= send_state_at) {
char message [2];
sprintf (message, "%d", fsm.state);
View
@@ -18,9 +18,9 @@ struct _clone_t {
static void clone_agent (void *args, zctx_t *ctx, void *pipe);
// .split constructor and destructor
-// Constructor and destructor for the clone class. Note that we create
-// a context specifically for the pipe that connects our frontend to the
-// backend agent:
+// Here are the constructor and destructor for the clone class. Note that
+// we create a context specifically for the pipe that connects our
+// frontend to the backend agent:
clone_t *
clone_new (void)
@@ -48,7 +48,7 @@ clone_destroy (clone_t **self_p)
// .split subtree method
// Specify subtree for snapshot and updates, which we must do before
-// connecting to a server since the subtree specification is sent as
+// connecting to a server as the subtree specification is sent as the
// first command to the server. Sends a [SUBTREE][subtree] command to
// the agent:
@@ -96,7 +96,7 @@ clone_set (clone_t *self, char *key, char *value, int ttl)
}
// .split get method
-// Look-up value in distributed hash table. Sends [GET][key] to the agent and
+// Look up value in distributed hash table. Sends [GET][key] to the agent and
// waits for a value response. If there is no value available, will eventually
// return NULL:
@@ -120,7 +120,7 @@ clone_get (clone_t *self, char *key)
}
// .split working with servers
-// The back-end agent manages a set of servers, which we implement using
+// The backend agent manages a set of servers, which we implement using
// our simple class model:
typedef struct {
@@ -161,10 +161,10 @@ server_destroy (server_t **self_p)
}
}
-// .split back-end agent class
-// Here is the implementation of the back-end agent itself:
+// .split backend agent class
+// Here is the implementation of the backend agent itself:
-// Number of servers we will talk to
+// Number of servers to which we will talk to
#define SERVER_MAX 2
// Server considered dead if silent for this long
@@ -218,7 +218,7 @@ agent_destroy (agent_t **self_p)
}
// .split handling a control message
-// Here we handle the different control messages from the front-end;
+// Here we handle the different control messages from the frontend;
// SUBTREE, CONNECT, SET, and GET:
static int
@@ -287,9 +287,9 @@ agent_control_message (agent_t *self)
return 0;
}
-// .split back-end agent
+// .split backend agent
// The asynchronous agent manages a server pool and handles the
-// request/reply dialog when the application asks for it:
+// request-reply dialog when the application asks for it:
static void
clone_agent (void *args, zctx_t *ctx, void *pipe)
View
@@ -1,4 +1,4 @@
-// Clone client Model Two
+// Clone client - Model Two
// Lets us build this source without creating a library
#include "kvsimple.c"
View
@@ -1,4 +1,4 @@
-// Clone client Model Three
+// Clone client - Model Three
// Lets us build this source without creating a library
#include "kvsimple.c"
@@ -35,7 +35,7 @@ int main (void)
kvmsg_store (&kvmsg, kvmap);
}
// .split processing state updates
- // Now we wait for updates from the server, and every so often, we
+ // Now we wait for updates from the server and every so often, we
// send a random key-value update to the server:
int64_t alarm = zclock_time () + 1000;
@@ -62,7 +62,7 @@ int main (void)
else
kvmsg_destroy (&kvmsg);
}
- // If we timed-out, generate a random kvmsg
+ // If we timed out, generate a random kvmsg
if (zclock_time () >= alarm) {
kvmsg_t *kvmsg = kvmsg_new (0);
kvmsg_fmt_key (kvmsg, "%d", randof (10000));
View
@@ -1,4 +1,4 @@
-// Clone client Model Four
+// Clone client - Model Four
// Lets us build this source without creating a library
#include "kvsimple.c"
@@ -69,7 +69,7 @@ int main (void)
kvmsg_destroy (&kvmsg);
}
// .until
- // If we timed-out, generate a random kvmsg
+ // If we timed out, generate a random kvmsg
if (zclock_time () >= alarm) {
kvmsg_t *kvmsg = kvmsg_new (0);
kvmsg_fmt_key (kvmsg, "%s%d", SUBTREE, randof (10000));
View
@@ -1,4 +1,4 @@
-// Clone client Model Five
+// Clone client - Model Five
// Lets us build this source without creating a library
#include "kvmsg.c"
@@ -60,7 +60,7 @@ int main (void)
else
kvmsg_destroy (&kvmsg);
}
- // If we timed-out, generate a random kvmsg
+ // If we timed out, generate a random kvmsg
if (zclock_time () >= alarm) {
kvmsg_t *kvmsg = kvmsg_new (0);
kvmsg_fmt_key (kvmsg, "%s%d", SUBTREE, randof (10000));
View
@@ -1,4 +1,4 @@
-// Clone server Model Two
+// Clone server - Model Two
// Lets us build this source without creating a library
#include "kvsimple.c"
View
@@ -1,4 +1,4 @@
-// Clone server Model Three
+// Clone server - Model Three
// Lets us build this source without creating a library
#include "kvsimple.c"
View
@@ -1,4 +1,4 @@
-// Clone server Model Four
+// Clone server - Model Four
// Lets us build this source without creating a library
#include "kvsimple.c"
View
@@ -1,4 +1,4 @@
-// Clone server Model Five
+// Clone server - Model Five
// Lets us build this source without creating a library
#include "kvmsg.c"
@@ -148,7 +148,7 @@ s_collector (zloop_t *loop, zmq_pollitem_t *poller, void *args)
}
// .split flush ephemeral values
-// At regular intervals we flush ephemeral values that have expired. This
+// At regular intervals, we flush ephemeral values that have expired. This
// could be slow on very large data sets:
// If key-value pair has expired, delete it and publish the
View
@@ -42,14 +42,14 @@ typedef struct {
// .split main task setup
// The main task parses the command line to decide whether to start
-// as primary or backup server. We're using the Binary Star pattern
+// as a primary or backup server. We're using the Binary Star pattern
// for reliability. This interconnects the two servers so they can
-// agree on which is primary, and which is backup. To allow the two
-// servers to run on the same box, we use different ports for primary
-// and backup. Ports 5003/5004 are used to interconnect the servers.
-// Ports 5556/5566 are used to receive voting events (snapshot requests
-// in the clone pattern). Ports 5557/5567 are used by the publisher,
-// and ports 5558/5568 by the collector:
+// agree on which one is primary and which one is backup. To allow the
+// two servers to run on the same box, we use different ports for
+// primary and backup. Ports 5003/5004 are used to interconnect the
+// servers. Ports 5556/5566 are used to receive voting events (snapshot
+// requests in the clone pattern). Ports 5557/5567 are used by the
+// publisher, and ports 5558/5568 are used by the collector:
int main (int argc, char *argv [])
{
@@ -102,9 +102,9 @@ int main (int argc, char *argv [])
"tcp://localhost:%d", self->peer + 1);
// .split main task body
- // After we've set-up our sockets we register our binary star
+ // After we've setup our sockets, we register our binary star
// event handlers, and then start the bstar reactor. This finishes
- // when the user presses Ctrl-C, or the process receives a SIGINT
+ // when the user presses Ctrl-C or when the process receives a SIGINT
// interrupt:
// Register state change handlers
@@ -117,7 +117,7 @@ int main (int argc, char *argv [])
zloop_timer (bstar_zloop (self->bstar), 1000, 0, s_flush_ttl, self);
zloop_timer (bstar_zloop (self->bstar), 1000, 0, s_send_hugz, self);
- // Start the Bstar reactor
+ // Start the bstar reactor
bstar_start (self->bstar);
// Interrupted, so shut down
@@ -200,10 +200,10 @@ s_snapshots (zloop_t *loop, zmq_pollitem_t *poller, void *args)
// .until
// .split collect updates
-// The collector is more complex than in the clonesrv5 example since how
-// process updates depends on whether we're active or passive. The active
-// applies them immediately to its kvmap, whereas the passive queues them
-// as pending:
+// The collector is more complex than in the clonesrv5 example because the
+// way it processes updates depends on whether we're active or passive.
+// The active applies them immediately to its kvmap, whereas the passive
+// queues them as pending:
// If message was already on pending list, remove it and return TRUE,
// else return FALSE.
@@ -306,7 +306,7 @@ s_send_hugz (zloop_t *loop, zmq_pollitem_t *poller, void *args)
// .split handling state changes
// When we switch from passive to active, we apply our pending list so that
// our kvmap is up-to-date. When we switch to passive, we wipe our kvmap
-// and grab a new snapshot from the active:
+// and grab a new snapshot from the active server:
static int
s_new_active (zloop_t *loop, zmq_pollitem_t *unused, void *args)
View
@@ -46,7 +46,7 @@ publisher_thread (void *args, zctx_t *ctx, void *pipe)
// .split listener thread
// The listener receives all messages flowing through the proxy, on its
-// pipe. In CZMQ, the pipe is a pair of ZMQ_PAIR sockets that connects
+// pipe. In CZMQ, the pipe is a pair of ZMQ_PAIR sockets that connect
// attached child threads. In other languages your mileage may vary:
static void
View
@@ -50,7 +50,7 @@ server_thread (void *args, zctx_t *ctx, void *pipe)
void *router = zsocket_new (ctx, ZMQ_ROUTER);
// Default HWM is 1000, which will drop messages here
- // since we send more than 1,000 chunks of test data,
+ // because we send more than 1,000 chunks of test data,
// so set an infinite HWM as a simple, stupid solution:
zsocket_set_hwm (router, 0);
zsocket_bind (router, "tcp://*:6000");
View
@@ -44,7 +44,7 @@ free_chunk (void *data, void *arg)
// .split File server thread
// The server thread waits for a chunk request from a client,
-// reads that chunk and sends it back to the client:
+// reads that chunk, and sends it back to the client:
static void
server_thread (void *args, zctx_t *ctx, void *pipe)
Oops, something went wrong.

0 comments on commit 837932b

Please sign in to comment.