CHAPTER 11Working with Data Stores

In this chapter, you will learn to interact with data stores from your applications. I have chosen two types of data stores based on their general applicability to different kinds of applications. You will first learn to interact with object storage services, which allow storing unstructured data blobs. Then you will learn to interact with relational databases. We will use an example HTTP server as the sample application, where we will implement various functionality related to interacting with data stores. We will implement a server to store software packages, first introduced in Chapter 3, “Writing HTTP Clients.” It will offer the following features to its clients:

  • A client can upload one or more packages. We will not bother much about the exact file format and allow uploading any file.
  • Each package must have a name and version associated with it. A client can upload multiple versions of the same package.
  • A client should be able to download a specific package version.

Figure 11.1 shows the architecture of the scenario that we will implement. We will integrate two data stores with the package server. The uploaded packages will be stored in an object store. We will use the Amazon Web Services Simple Storage Service (S3) compatible open-source MinIO software as the object store for local development. To store the metadata related to the package, we will use a relational database—MySQL.

Figure 11.1: Architecture of the example scenario ...

Get Practical Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.