Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rg0now committed Jan 12, 2024
1 parent 45d12f4 commit 113ef81
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions 99-labs/03-splitdim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ The next task is to design the public SplitDim API, that is, the Go structs (and
}
```
> [!NOTE]
>
> Recall, the JSON tags in the struct fields help marshaling/unmarshaling Go structs to/from JSON. For instance, the struct field `Sender` will receive its value from the JSON key `sender` during unmarshaling, and vice versa.
> [!NOTE]
>
> Recall, the JSON tags in the struct fields help marshaling/unmarshaling Go structs to/from JSON. For instance, the struct field `Sender` will receive its value from the JSON key `sender` during unmarshaling, and vice versa.
> [!WARNING]
>
> Documenting your public APIs is mandatory. Using the [Godoc](https://go.dev/blog/godoc) format will simplify generating easy-to-browse documentation from your code. Below we will sometime omit the docs for brevity, but you should never!
> [!WARNING]
>
> Documenting your public APIs is mandatory. Using the [Godoc](https://go.dev/blog/godoc) format will simplify generating easy-to-browse documentation from your code. Below we will sometime omit the docs for brevity, but you should never!
1. The API endpoint `/api/transfer` will be used to return the current balance of each registered user. The `Account` struct is the basic data model for this API.
Expand Down Expand Up @@ -214,9 +214,9 @@ The next task is to design the public SplitDim API, that is, the Go structs (and
}
```
> [!NOTE]
>
> This is an internal API: we don't want people to import and use these internal data structures. Technically, therefore, we should place these definitions, and the implementations we will create later, into a new package under `internal/`, which, recall, cannot be imported from outside the main package. We will spare this now for simplicity, but in practice always be aware of what's public and what's private in your code.
> [!NOTE]
>
> This is an internal API: we don't want people to import and use these internal data structures. Technically, therefore, we should place these definitions, and the implementations we will create later, into a new package under `internal/`, which, recall, cannot be imported from outside the main package. We will spare this now for simplicity, but in practice always be aware of what's public and what's private in your code.
> ✅ **Check**
>
Expand Down Expand Up @@ -247,13 +247,13 @@ The next step is to define our internal `DataLayer`: the internal representation
)
```
> [!NOTE]
>
> We want to use our own API, hence the (sub)package import `splitdim/pkg/api`.
> [!NOTE]
>
> We want to use our own API, hence the (sub)package import `splitdim/pkg/api`.
> [!NOTE]
>
> From now on we will not show import lists explicitly: remember, just add imports when Go complains during compilation.
> [!NOTE]
>
> From now on we will not show import lists explicitly: remember, just add imports when Go complains during compilation.
1. Use the below definition for the internal data layer.
Expand Down
30 changes: 15 additions & 15 deletions 99-labs/04-immutability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ Your task is to implement this interface. Some help:
}
```

> [!NOTE]
>
> The `client` struct will *not* be exported from the package (letter case matters!).
> [!NOTE]
>
> The `client` struct will *not* be exported from the package (letter case matters!).
3. Create a constructor. Recall, this entails writing a `NewClient` function that takes the arguments necessary to instantiate the `client` struct (currently, this will be the `address:port` for the key-value store server), constructs the struct, and then *returns a pointer to the struct as an interface*. This makes sure that the caller of our `NewClient` function can access only the methods exposed by the `Client` interface on the returned pointer, but nothing else:
``` go
Expand All @@ -170,9 +170,9 @@ Your task is to implement this interface. Some help:
}
```

> [!NOTE]
>
> Make sure you understand this constructor pattern, you will find it everywhere in Go code.
> [!NOTE]
>
> Make sure you understand this constructor pattern, you will find it everywhere in Go code.
4. At this point, we are ready to actually implement the `Client` interface. Let us add the implementation for the `get` method first; recall, this receives a string key as an argument and returns the corresponding key and version as an `api.VersionedValue`:
``` go
Expand Down Expand Up @@ -263,15 +263,15 @@ So let us write a key-value store datalayer for our SplitDim web app. Recall, th
go mod vendor
```

> [!NOTE]
>
> Transitive dependencies are usually handled by Go automatically, but this time we need to do this manually due to the "replace" rules.
> [!NOTE]
>
> Transitive dependencies are usually handled by Go automatically, but this time we need to do this manually due to the "replace" rules.

This will throw some errors along the way, but the eventual `go mod tidy` will get everything right

> [!NOTE]
>
> The final `go mod vendor` makes sure that all dependencies get copied into the local `vendor/` directory, which will simplify building the container image later.
> [!NOTE]
>
> The final `go mod vendor` makes sure that all dependencies get copied into the local `vendor/` directory, which will simplify building the container image later.

3. Since we are going to implement multiple data layers side by side, we need a way to select among them (*manageability*, see later) when starting the app. We will use two environment variables, `KVSTORE_MODE` and `KVSTORE_ADDR`, for that purpose.

Expand Down Expand Up @@ -473,9 +473,9 @@ Once the local tests run, we can actually deploy the application to Kubernetes.
kubectl apply -f deploy/kubernetes-statefulset.yaml
```

> [!NOTE]
>
> The full DNS name would be `kvstore.default.svc.cluster.local`, but usually only `kvstore` or `kvstore.default` is enough.
> [!NOTE]
>
> The full DNS name would be `kvstore.default.svc.cluster.local`, but usually only `kvstore` or `kvstore.default` is enough.

4. Re-build the `splitdim` image; the `Dockerfile` created during the previous lab should be reusable for this:
```shell
Expand Down

0 comments on commit 113ef81

Please sign in to comment.