Introduction |
|
xvii | |
Getting Started |
|
xxi | |
|
Chapter 1 Writing Command-Line Applications |
|
|
1 | (32) |
|
|
1 | (7) |
|
|
8 | (6) |
|
|
14 | (6) |
|
Testing the Parsing Logic |
|
|
20 | (2) |
|
Improving the User Interface |
|
|
22 | (1) |
|
Removing Duplicate Error Messages |
|
|
23 | (1) |
|
Customizing Usage Message |
|
|
24 | (1) |
|
Accept Name via a Positional Argument |
|
|
25 | (3) |
|
|
28 | (4) |
|
|
32 | (1) |
|
Chapter 2 Advanced Command-Line Applications |
|
|
33 | (24) |
|
Implementing Sub-commands |
|
|
33 | (4) |
|
An Architecture for Sub-command-Driven Applications |
|
|
37 | (6) |
|
|
43 | (2) |
|
|
45 | (2) |
|
Making Your Applications Robust |
|
|
47 | (1) |
|
User Input with Deadlines |
|
|
48 | (4) |
|
|
52 | (4) |
|
|
56 | (1) |
|
Chapter 3 Writing HTTP Clients |
|
|
57 | (24) |
|
|
57 | (2) |
|
Testing the Data Downloader |
|
|
59 | (2) |
|
Deserializing Received Data |
|
|
61 | (5) |
|
|
66 | (6) |
|
|
72 | (8) |
|
|
80 | (1) |
|
Chapter 4 Advanced HTTP Clients |
|
|
81 | (24) |
|
Using a Custom HTTP Client |
|
|
81 | (1) |
|
Downloading from an Overloaded Server |
|
|
81 | (4) |
|
Testing the Time-Out Behavior |
|
|
85 | (3) |
|
Configuring the Redirect Behavior |
|
|
88 | (3) |
|
Customizing Your Requests |
|
|
91 | (1) |
|
Implementing Client Middleware |
|
|
92 | (1) |
|
Understanding the Round Tripper Interface |
|
|
93 | (1) |
|
|
94 | (2) |
|
Add a Header to All Requests |
|
|
96 | (3) |
|
|
99 | (4) |
|
Configuring the Connection Pool |
|
|
103 | (1) |
|
|
104 | (1) |
|
Chapter 5 Building HTTP Servers |
|
|
105 | (28) |
|
|
105 | (3) |
|
Setting Up Request Handlers |
|
|
108 | (1) |
|
|
109 | (3) |
|
|
112 | (2) |
|
|
114 | (1) |
|
|
115 | (1) |
|
|
115 | (1) |
|
Proto, ProtoMajor, and ProtoMinor |
|
|
116 | (1) |
|
|
116 | (1) |
|
|
116 | (1) |
|
|
116 | (1) |
|
|
116 | (1) |
|
|
117 | (1) |
|
Attaching Metadata to a Request |
|
|
118 | (3) |
|
Processing Streaming Requests |
|
|
121 | (5) |
|
Streaming Data as Responses |
|
|
126 | (6) |
|
|
132 | (1) |
|
Chapter 6 Advanced HTTP Server Applications |
|
|
133 | (28) |
|
|
133 | (1) |
|
Sharing Data across Handler Functions |
|
|
134 | (5) |
|
Writing Server Middleware |
|
|
139 | (1) |
|
Custom HTTP Handler Technique |
|
|
139 | (1) |
|
The Handler Func Technique |
|
|
140 | (2) |
|
|
142 | (5) |
|
Writing Tests for Complex Server Applications |
|
|
147 | (1) |
|
|
147 | (6) |
|
Testing the Handler Functions |
|
|
153 | (2) |
|
|
155 | (2) |
|
Testing the Server Startup |
|
|
157 | (2) |
|
|
159 | (2) |
|
Chapter 7 Production-Ready HTTP Servers |
|
|
161 | (32) |
|
Aborting Request Handling |
|
|
161 | (4) |
|
Strategies to Abort Request Processing |
|
|
165 | (4) |
|
Handling Client Disconnects |
|
|
169 | (4) |
|
|
173 | (1) |
|
Implement a Time-Out for All Handler Functions |
|
|
173 | (1) |
|
Implementing Server Time-Out |
|
|
174 | (5) |
|
Implementing Graceful Shutdown |
|
|
179 | (5) |
|
Securing Communication with TLS |
|
|
184 | (1) |
|
Configuring TLS and HTTP/2 |
|
|
184 | (4) |
|
|
188 | (4) |
|
|
192 | (1) |
|
Chapter 8 Building RPC Applications with gRPC |
|
|
193 | (36) |
|
gRPC and Protocol Buffers |
|
|
193 | (4) |
|
Writing Your First Service |
|
|
197 | (1) |
|
|
198 | (5) |
|
|
203 | (4) |
|
|
207 | (4) |
|
|
211 | (3) |
|
A Detour into Protobuf Messages |
|
|
214 | (1) |
|
Marshalling and Unmarshalling |
|
|
214 | (5) |
|
Forward and Backward Compatibility |
|
|
219 | (1) |
|
|
220 | (6) |
|
|
226 | (2) |
|
|
228 | (1) |
|
Chapter 9 Advanced gRPC Applications |
|
|
229 | (46) |
|
|
229 | (1) |
|
|
230 | (7) |
|
|
237 | (2) |
|
|
239 | (8) |
|
Receiving and Sending Arbitrary Bytes |
|
|
247 | (9) |
|
Implementing Middleware Using Interceptors |
|
|
256 | (1) |
|
|
257 | (6) |
|
|
263 | (6) |
|
|
269 | (2) |
|
|
271 | (1) |
|
|
272 | (3) |
|
Chapter 10 Production-Ready gRPC Applications |
|
|
275 | (36) |
|
Securing Communication with TLS |
|
|
275 | (3) |
|
|
278 | (1) |
|
Implementing Health Checks |
|
|
278 | (8) |
|
|
286 | (3) |
|
Aborting Request Processing |
|
|
289 | (8) |
|
|
297 | (1) |
|
Improving Connection Setup |
|
|
298 | (2) |
|
Handling Transient Failures |
|
|
300 | (5) |
|
Setting lime-Outs for Method Calls |
|
|
305 | (1) |
|
|
306 | (3) |
|
|
309 | (2) |
|
Chapter 11 Working with Data Stores |
|
|
311 | (38) |
|
Working with Object Stores |
|
|
312 | (1) |
|
Integration with Package Server |
|
|
313 | (10) |
|
|
323 | (2) |
|
Accessing Underlying Driver Types |
|
|
325 | (2) |
|
Working with Relational Databases |
|
|
327 | (1) |
|
Integration with Package Server |
|
|
328 | (11) |
|
|
339 | (4) |
|
|
343 | (3) |
|
Using Database Transactions |
|
|
346 | (2) |
|
|
348 | (1) |
|
Appendix A Making Your Applications Observable |
|
|
349 | (18) |
|
Logs, Metrics, and Traces |
|
|
349 | (3) |
|
|
352 | (1) |
|
Command-Line Applications |
|
|
352 | (8) |
|
|
360 | (4) |
|
|
364 | (2) |
|
|
366 | (1) |
|
Appendix B Deploying Applications |
|
|
367 | (6) |
|
|
367 | (3) |
|
Distributing Your Application |
|
|
370 | (2) |
|
Deploying Server Applications |
|
|
372 | (1) |
Summary |
|
373 | (2) |
Index |
|
375 | |