Erhältlich:Nicht auf LagerBuch (Softcover): Fachbuch
Practical Go
Building Scalable Network and Non-Network Applications
von Amit Saha
- Verlag
- John Wiley & Sons
- Unsere Artikel-Nr.
- 9NKW37K
Beschreibung
YOUR PRACTICAL, HANDS-ON GUIDE TO BUILDING APPLICATIONS USING GO Google announced the Go programming language to the public in 2009, with the version 1. 0 release announced in 2012. Since its announcement to the community, and the compatibility promise of the 1. 0 release, the Go language has been used to write scalable and high-impact software programs ranging from command-line applications and critical infrastructure tools to large-scale distributed systems. Its simplicity, rich standard library and a burgeoning ecosystem of third-party packages make it a perfect choice as a general purpose language for software developers. In Practical Go: Building Scalable Network & Non-Network Applications, you will learn to use the Go programming language to build robust, production-ready software applications. You will learn just enough to building command line tools and applications communicating over HTTP and gRPC. This practical guide will cover: Writing command line applications Writing HTTP services and clients Writing RPC applications using gRPC Writing middleware for network clients and servers Storing data in cloud object stores and SQL databases Testing your applications using idiomatic techniques Adding observability to your applications Managing configuration data from your applications
Spezifikationen
| Sprache | Englisch |
|---|---|
| Autor | Amit Saha |
| Thema | Informatik: Allgemein |
| Auflage | 1 |
| Erscheinungsjahr | 2022 |
| Format | Buch (Softcover) |
| Anzahl Seiten | 416 |
Inhaltsverzeichnis
"Introduction xvii\n\nGetting Started xxi\n\nChapter 1 Writing Command-Line Applications 1\n\nYour First Application 1\n\nWriting Unit Tests 8\n\nUsing the Flag Package 14\n\nTesting the Parsing Logic 20\n\nImproving the User Interface 22\n\nRemoving Duplicate Error Messages 23\n\nCustomizing Usage Message 24\n\nAccept Name via a Positional Argument 25\n\nUpdating the Unit Tests 28\n\nSummary 32\n\nChapter 2 Advanced Command-Line Applications 33\n\nImplementing Sub-commands 33\n\nAn Architecture for Sub-command-Driven Applications 37\n\nTesting the Main Package 43\n\nTesting the Cmd Package 45\n\nMaking Your Applications Robust 47\n\nUser Input with Deadlines 48\n\nHandling User Signals 52\n\nSummary 56\n\nChapter 3 Writing HTTP Clients 57\n\nDownloading Data 57\n\nTesting the Data Downloader 59\n\nDeserializing Received Data 61\n\nSending Data 66\n\nWorking with Binary Data 72\n\nSummary 80\n\nChapter 4 Advanced HTTP Clients 81\n\nUsing a Custom HTTP Client 81\n\nDownloading from an Overloaded Server 81\n\nTesting the Time-Out Behavior 85\n\nConfiguring the Redirect Behavior 88\n\nCustomizing Your Requests 91\n\nImplementing Client Middleware 92\n\nUnderstanding the RoundTripper Interface 93\n\nA Logging Middleware 94\n\nAdd a Header to All Requests 96\n\nConnection Pooling 99\n\nConfiguring the Connection Pool 103\n\nSummary 104\n\nChapter 5 Building HTTP Servers 105\n\nYour First HTTP Server 105\n\nSetting Up Request Handlers 108\n\nHandler Functions 109\n\nTesting Your Server 112\n\nThe Request Struct 114\n\nMethod 115\n\nURL 115\n\nProto, ProtoMajor, and ProtoMinor 116\n\nHeader 116\n\nHost 116\n\nBody 116\n\nForm, PostForm 116\n\nMultipartForm 117\n\nAttaching Metadata to a Request 118\n\nProcessing Streaming Requests 121\n\nStreaming Data as Responses 126\n\nSummary 132\n\nChapter 6 Advanced HTTP Server Applications 133\n\nThe Handler Type 133\n\nSharing Data across Handler Functions 134\n\nWriting Server Middleware 139\n\nCustom HTTP Handler Technique 139\n\nThe HandlerFunc Technique 140\n\nChaining Middleware 142\n\nWriting Tests for Complex Server Applications 147\n\nCode Organization 147\n\nTesting the Handler Functions 153\n\nTesting the Middleware 155\n\nTesting the Server Startup 157\n\nSummary 159\n\nChapter 7 Production-Ready HTTP Servers 161\n\nAborting Request Handling 161\n\nStrategies to Abort Request Processing 165\n\nHandling Client Disconnects 169\n\nServer-Wide Time-Outs 173\n\nImplement a Time-Out for All Handler Functions 173\n\nImplementing Server Time-Out 174\n\nImplementing Graceful Shutdown 179\n\nSecuring Communication with TLS 184\n\nConfiguring TLS and HTTP\/2 184\n\nTesting TLS Servers 188\n\nSummary 192\n\nChapter 8 Building RPC Applications with gRPC 193\n\ngRPC and Protocol Buffers 193\n\nWriting Your First Service 197\n\nWriting the Server 198\n\nWriting a Client 203\n\nTesting the Server 207\n\nTesting the Client 211\n\nA Detour into Protobuf Messages 214\n\nMarshalling and Unmarshalling 214\n\nForward and Backward Compatibility 219\n\nMultiple Services 220\n\nError Handling 226\n\nSummary 228\n\nChapter 9 Advanced gRPC Applications 229\n\nStreaming Communication 229\n\nServer-Side\n\nStreaming 230\n\nClient-Side\n\nStreaming 237\n\nBidirectional Streaming 239\n\nReceiving and Sending Arbitrary Bytes 247\n\nImplementing Middleware Using Interceptors 256\n\nClient-Side Interceptors 257\n\nServer-Side Interceptors 263\n\nWrapping Streams 269\n\nChaining Interceptors 271\n\nSummary 272\n\nChapter 10 Production-Ready gRPC Applications 275\n\nSecuring Communication with TLS 275\n\nRobustness in Servers 278\n\nImplementing Health Checks 278\n\nHandling Runtime Errors 286\n\nAborting Request Processing 289\n\nRobustness in Clients 297\n\nImproving Connection Setup 298\n\nHandling Transient Failures 300\n\nSetting Time-Outs for Method Calls 305\n\nConnection Management 306\n\nSummary 309\n\nChapter 11 Working with Data Stores 311\n\nWorking with Object Stores 312\n\nIntegration with Package Server 313\n\nTesting Package Uploads 323\n\nAccessing Underlying Driver Types 325\n\nWorking with Relational Databases 327\n\nIntegration with Package Server 328\n\nTesting Data Storage 339\n\nData Type Conversions 343\n\nUsing Database Transactions 346\n\nSummary 348\n\nAppendix A Making Your Applications Observable 349\n\nLogs, Metrics, and Traces 349\n\nEmitting Telemetry Data 352\n\nCommand-Line Applications 352\n\nHTTP Applications 360\n\ngRPC Applications 364\n\nSummary 366\n\nAppendix B Deploying Applications 367\n\nManaging Configuration 367\n\nDistributing Your Application 370\n\nDeploying Server Applications 372\n\nSummary 373\n\nIndex 375 xiii Contents Introduction xvii Getting Started xxi Chapter 1 Writing Command-Line Applications 1 Your First Application 1 Writing Unit Tests 8 Using the Flag Package 14 Testing the Parsing Logic 20 Improving the User Interface 22 Removing Duplicate Error Messages 23 Customizing Usage Message 24 Accept Name via a Positional Argument 25 Updating the Unit Tests 28 Summary 32 Chapter 2 Advanced Command-Line Applications 33 Implementing Sub-commands 33 An Architecture for Sub-command-Driven Applications 37 Testing the Main Package 43 Testing the Cmd Package 45 Making Your Applications Robust 47 User Input with Deadlines 48 Handling User Signals 52 Summary 56 Chapter 3 Writing HTTP Clients 57 Downloading Data 57 Testing the Data Downloader 59 Deserializing Received Data 61 Sending Data 66 COPYRIGHTED MATERIAL xiv Contents Working with Binary Data 72 Summary 80 Chapter 4 Advanced HTTP Clients 81 Using a Custom HTTP Client 81 Downloading from an Overloaded Server 81 Testing the Time-Out Behavior 85 Configuring the Redirect Behavior 88 Customizing Your Requests 91 Implementing Client Middleware 92 Understanding the RoundTripper Interface 93 A Logging Middleware 94 Add a Header to All Requests 96 Connection Pooling 99 Configuring the Connection Pool 103 Summary 104 Chapter 5 Building HTTP Servers 105 Your First HTTP Server 105 Setting Up Request Handlers 108 Handler Functions 109 Testing Your Server 112 The Request Struct 114 Method 115 URL 115 Proto, ProtoMajor, and ProtoMinor 116 Header 116 Host 116 Body 116 Form, PostForm 116 MultipartForm 117 Attaching Metadata to a Request 118 Processing Streaming Requests 121 Streaming Data as Responses 126 Summary 132 Chapter 6 Advanced HTTP Server Applications 133 The Handler Type 133 Sharing Data across Handler Functions 134 Writing Server Middleware 139 Custom HTTP Handler Technique 139 The HandlerFunc Technique 140 Chaining Middleware 142 Writing Tests for Complex Server Applications 147 Code Organization 147 Testing the Handler Functions 153 Testing the Middleware 155 Testing the Server Startup 157 Summary 159 Contents xv Chapter 7 Production-Ready HTTP Servers 161 Aborting Request Handling 161 Strategies to Abort Request Processing 165 Handling Client Disconnects 169 Server-Wide Time-Outs 173 Implement a Time-Out for All Handler Functions 173 Implementing Server Time-Out 174 Implementing Graceful Shutdown 179 Securing Communication with TLS 184 Configuring TLS and HTTP\/2 184 Testing TLS Servers 188 Summary 192 Chapter 8 Building RPC Applications with gRPC 193 gRPC and Protocol Buffers 193 Writing Your First Service 197 Writing the Server 198 Writing a Client 203 Testing the Server 207 Testing the Client 211 A Detour into Protobuf Messages 214 Marshalling and Unmarshalling 214 Forward and Backward Compatibility 219 Multiple Services 220 Error Handling 226 Summary 228 Chapter 9 Advanced gRPC Applications 229 Streaming Communication 229 Server-Side Streaming 230 Client-Side Streaming 237 Bidirectional Streaming 239 Receiving and Sending Arbitrary Bytes 247 Implementing Middleware Using Interceptors 256 Client-Side Interceptors 257 Server-Side Interceptors 263 Wrapping Streams 269 Chaining Interceptors 271 Summary 272 Chapter 10 Production-Ready gRPC Applications 275 Securing Communication with TLS 275 Robustness in Servers 278 Implementing Health Checks 278 Handling Runtime Errors 286 Aborting Request Processing 289 xvi Contents Robustness in Clients 297 Improving Connection Setup 298 Handling Transient Failures 300 Setting Time-Outs for Method Calls 305 Connection Management 306 Summary 309 Chapter 11 Working with Data Stores 311 Working with Object Stores 312 Integration with Package Server 313 Testing Package Uploads 323 Accessing Underlying Driver Types 325 Working with Relational Databases 327 Integration with Package Server 328 Testing Data Storage 339 Data Type Conversions 343 Using Database Transactions 346 Summary 348 Appendix A Making Your Applications Observable 349 Logs, Metrics, and Traces 349 Emitting Telemetry Data 352 Command-Line Applications 352 HTTP Applications 360 gRPC Applications 364 Summary 366 Appendix B Deploying Applications 367 Managing Configuration 367 Distributing Your Application 370 Deploying Server Applications 372 Summary 373 Index 375 NOTE A glossary of relevant terms is available for free download from the book's web page: https:\/\/www.wiley.com\/go\/practicalgo.xiii Contents Introduction xvii Getting Started xxi Chapter 1 Writing Command-Line Applications 1 Your First Application 1 Writing Unit Tests 8 Using the Flag Package 14 Testing the Parsing Logic 20 Improving the User Interface 22 Removing Duplicate Error Messages 23 Customizing Usage Message 24 Accept Name via a Positional Argument 25 Updating the Unit Tests 28 Summary 32 Chapter 2 Advanced Command-Line Applications 33 Implementing Sub-commands 33 An Architecture for Sub-command-Driven Applications 37 Testing the Main Package 43 Testing the Cmd Package 45 Making Your Applications Robust 47 User Input with Deadlines 48 Handling User Signals 52 Summary 56 Chapter 3 Writing HTTP Clients 57 Downloading Data 57 Testing the Data Downloader 59 Deserializing Received Data 61 Sending Data 66 COPYRIGHTED MATERIAL xiv Contents Working with Binary Data 72 Summary 80 Chapter 4 Advanced HTTP Clients 81 Using a Custom HTTP Client 81 Downloading from an Overloaded Server 81 Testing the Time-Out Behavior 85 Configuring the Redirect Behavior 88 Customizing Your Requests 91 Implementing Client Middleware 92 Understanding the RoundTripper Interface 93 A Logging Middleware 94 Add a Header to All Requests 96 Connection Pooling 99 Configuring the Connection Pool 103 Summary 104 Chapter 5 Building HTTP Servers 105 Your First HTTP Server 105 Setting Up Request Handlers 108 Handler Functions 109 Testing Your Server 112 The Request Struct 114 Method 115 URL 115 Proto, ProtoMajor, and ProtoMinor 116 Header 116 Host 116 Body 116 Form, PostForm 116 MultipartForm 117 Attaching Metadata to a Request 118 Processing Streaming Requests 121 Streaming Data as Responses 126 Summary 132 Chapter 6 Advanced HTTP Server Applications 133 The Handler Type 133 Sharing Data across Handler Functions 134 Writing Server Middleware 139 Custom HTTP Handler Technique 139 The HandlerFunc Technique 140 Chaining Middleware 142 Writing Tests for Complex Server Applications 147 Code Organization 147 Testing the Handler Functions 153 Testing the Middleware 155 Testing the Server Startup 157 Summary 159 Contents xv Chapter 7 Production-Ready HTTP Servers 161 Aborting Request Handling 161 Strategies to Abort Request Processing 165 Handling Client Disconnects 169 Server-Wide Time-Outs 173 Implement a Time-Out for All Handler Functions 173 Implementing Server Time-Out 174 Implementing Graceful Shutdown 179 Securing Communication with TLS 184 Configuring TLS and HTTP\/2 184 Testing TLS Servers 188 Summary 192 Chapter 8 Building RPC Applications with gRPC 193 gRPC and Protocol Buffers 193 Writing Your First Service 197 Writing the Server 198 Writing a Client 203 Testing the Server 207 Testing the Client 211 A Detour into Protobuf Messages 214 Marshalling and Unmarshalling 214 Forward and Backward Compatibility 219 Multiple Services 220 Error Handling 226 Summary 228 Chapter 9 Advanced gRPC Applications 229 Streaming Communication 229 Server-Side Streaming 230 Client-Side Streaming 237 Bidirectional Streaming 239 Receiving and Sending Arbitrary Bytes 247 Implementing Middleware Using Interceptors 256 Client-Side Interceptors 257 Server-Side Interceptors 263 Wrapping Streams 269 Chaining Interceptors 271 Summary 272 Chapter 10 Production-Ready gRPC Applications 275 Securing Communication with TLS 275 Robustness in Servers 278 Implementing Health Checks 278 Handling Runtime Errors 286 Aborting Request Processing 289 xvi Contents Robustness in Clients 297 Improving Connection Setup 298 Handling Transient Failures 300 Setting Time-Outs for Method Calls 305 Connection Management 306 Summary 309 Chapter 11 Working with Data Stores 311 Working with Object Stores 312 Integration with Package Server 313 Testing Package Uploads 323 Accessing Underlying Driver Types 325 Working with Relational Databases 327 Integration with Package Server 328 Testing Data Storage 339 Data Type Conversions 343 Using Database Transactions 346 Summary 348 Appendix A Making Your Applications Observable 349 Logs, Metrics, and Traces 349 Emitting Telemetry Data 352 Command-Line Applications 352 HTTP Applications 360 gRPC Applications 364 Summary 366 Appendix B Deploying Applications 367 Managing Configuration 367 Distributing Your Application 370 Deploying Server Applications 372 Summary 373 Index 375 NOTE A glossary of relevant terms is available for free download from the book's web page: https:\/\/www.wiley.com\/go\/practicalgo."
Bewertungen
Produkt bewertenFür dieses Produkt liegt noch keine Bewertung vor. Wenn Sie es gekauft haben, teilen Sie gerne Ihre Erfahrung.
Zahlungsarten
Rechnung (Einzahlungsschein mit QR-Code), Twint, Kreditkarte, PostFinance, Apple, Google oder Samsung Pay.
Versand
Kostenlos: Schweiz & Liechtenstein
Rückgabe
30 Tage Rückgaberecht
Sie können das Produkt innerhalb von 30 Wochentagen ohne Angabe von Gründen zurücksenden, sofern es unbeschädigt und in der Originalverpackung ist.
Weitere Hinweise finden Sie in unseren AGB unter D.1.
