0
@@ -10,6 +10,12 @@ were received and sends responses in the same order. All integers in the
0
protocol are formatted in decimal and (unless otherwise indicated)
0
+Names, in this protocol, are ASCII strings. They may contain letters (A-Z and
0
+a-z), numerals (0-9), hyphen ("-"), plus ("+"), slash ("/"), semicolon (";"),
0
+dot ("."), dollar-sign ("$"), and parentheses ("(" and ")"), but they may not
0
+begin with a hyphen. They are terminated by white space (either a space char or
0
+end of line). Each name must be at least one character long.
0
The protocol contains two kinds of data: text lines and unstructured chunks of
0
data. Text lines are used for client commands and server responses. Chunks are
0
used to transfer job bodies and stats information. Each job body is an opaque
0
@@ -106,9 +112,23 @@ Here is a picture with more possibilities:
0
+The system has one or more tubes. Each tube consists of a ready queue and a
0
+delay queue. Each job spends its entire life in one tube. Consumers can show
0
+interest in tubes by sending the "watch" command; they can show disinterest by
0
+sending the "ignore" command. This set of interesting tubes is said to be a
0
+consumer's "watch list". When a client reserves a job, it may come from any of
0
+the tubes in its watch list.
0
+When a client connects, its watch list is initially just the tube named
0
+"default". If it submits jobs without having sent a "use" command, they will
0
+live in the tube named "default".
0
+Tubes are created on demand whenever they are referenced. If a tube is empty
0
+(that is, it contains no ready, delayed, or buried jobs) and no client refers
0
+to it, it will be deleted.
0
The "put" command is for any process that wants to insert a job into the queue.
0
It comprises a command line followed by the job body:
0
@@ -116,7 +136,8 @@ It comprises a command line followed by the job body:
0
put <pri> <delay> <ttr> <bytes>\r\n
0
-It inserts a job into the queue.
0
+It inserts a job into the client's currently used tube (see the "use" command
0
- <pri> is an integer < 2**32. Jobs with smaller priority values will be
0
scheduled before jobs with larger priorities. The most urgent priority is 0;
0
@@ -150,6 +171,19 @@ may be:
0
- <id> is the integer id of the new job
0
+The "use" command is for producers. Subsequent put commands will put jobs into
0
+the tube specified by this command. If no use command has been issued, jobs
0
+will be put into the tube named "default".
0
+ - <tube> is a name at most 200 bytes. It specifies the tube to use. If the
0
+ tube does not exist, it will be created.
0
@@ -239,6 +273,36 @@ There are two possible responses:
0
- "NOT_FOUND\r\n" if the job does not exist or is not reserved by the client.
0
+The "watch" command adds the named tube to the watch list for the current
0
+connection. A reserve command will take a job from any of the tubes in the
0
+watch list. For each new connection, the watch list initially consists of one
0
+ - <tube> is a name at most 200 bytes. It specifies a tube to add to the watch
0
+ - <count> is the integer number of tubes currently in the watch list.
0
+The "ignore" command is for consumers. It removes the named tube from the
0
+watch list for the current connection.
0
+ - "WATCHING <count>\r\n" to indicate success.
0
+ - <count> is the integer number of tubes currently in the watch list.
0
+ - "NOT_IGNORED\r\n" if the client attempts to ignore the only tube in its
0
@@ -315,6 +379,8 @@ scalars.
0
+ - "tube" is the name of the tube that contains this job
0
- "state" is "ready" or "delayed" or "reserved" or "buried"
0
- "age" is the time in seconds since the put command that created this job.
0
@@ -366,6 +432,8 @@ scalars.
0
- "total-jobs" is the cumulative count of jobs created.
0
+ - "current-tubes" is the number of currently-existing tubes.
0
- "current-connections" is the number of currently open connections.
0
- "current-producers" is the number of open connections that have each