raul

raul

Distributed Services with Go: Chapter 3 suggestions

Page 28: It implements io.ReaderAt on the store type.

  • Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt?

Page 29:
func (s *store) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
err := s.buf.Flush()
if err != nil {
return err
}

  • Possibly:
    if err := s.buf.Flush(); err != nil {
    return err
    }

Page 31: At the end of store_test.go

  • Could you please include instructions/Makefile to execute the tests?
  • I finally managed to run them by cd’ing into internal/log and running ‘go test -v’ but this was after a bunch of failed attempts at running them.

Page 30-50: I would suggest running the tests after each of the Store, Index, and Segment would help people stay more engaged? Otherwise it seems too much (25 pages) code reading without interactivity.

Page 34: an ungraceful shutdown

  • Does ‘forceful’ shutdown sound more appealing than ‘ungraceful’?

Page 37: type Config struct {

  • I was trying to execute index_test.go and index.go and was trying to figure out what the unresolved Config was. Would it help to move this definition ahead of usage?

Page 36: Then we verify that the index and scanner error when

  • that the index and scanner ‘throw an error’ when?

Page 37: We need the next and base offsets to know…

  • This isn’t clear. Could you please consider drawing a simple picture to clarify this better?

Page 39: func (s *segment) Append(record *api.Record) (offset uint64, err error) {

  • Please consider forward declaring the definition of Record to make compilation and execution possible.

Page 41: import (
“fmt”
“os”
“path”

"github.com/gogo/protobuf/proto"
api "github.com/travisjeffery/proglog/api/v1"

)

Page 43: api “github.com/travisjeffery/proglog/api/v1

Page 43: Next, add the this setup() method below NewLog()

  • Next, add ‘this’ setup() method below NewLog()

Page 48: api “github.com/travisjeffery/proglog/api/v1

Page 51: testReader(*testing.T, *log.Log) tests that we can read the full, raw log as it’s stored on disk so that on, when we can snapshot

  • so that on ‘startup’?, when we can snapshot - something is off here

First Post!

yamoinza

yamoinza

Chapter 3, segment.go, code reads as “substract segment baseOffset from nextOffset”:

// index offsets are relative to base offset
uint32(s.nextOffset-uint64(s.baseOffset)),

but text reads as “we subtract the segment’s next offset from its base offset”.

Popular Pragmatic Bookshelf topics Top

abtin
page 20: … protoc command… I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New
jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
johnp
Hi Brian, Looks like the api for tinydb has changed a little. Noticed while working on chapter 7 that the .purge() call to the db throws...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New

Other popular topics Top

AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New