Skip to content

Day 119 — Week 1 Review & Active Recall

Month 5 · Week 1 · ⬅ Day 118 · Day 120 ➡ · Journal index

🎯 Learning Objective

Consolidate Week 1 (protobuf → codegen → unary → streaming → deadlines/metadata/status) into durable recall and name what's still fuzzy.

📚 Topics

  • Whole-week synthesis + spaced repetition
  • Self-test without notes

📖 Reading / Sources

📝 Notes

  • The week's arc: a .proto contract → protoc/buf generated Go → unary calls → streaming (server/client/bidi) → the cross-cutting deadline/metadata/status triad. Everything rides one context → [[grpc]].
  • Two mental anchors that unlock the rest: field numbers are the wire identity (proto3) and a stream is a run of 5-byte length-prefixed frames → [[wire-format]] · [[framing]].
  • The full review, re-quiz, metrics, and next-week goals live in the dedicated file below.

💻 Code Examples

// The one-liner that anchored the week: io.EOF is the clean end of any stream,
// not an error. Always test it first.
for {
    msg, err := stream.Recv()
    if errors.Is(err, io.EOF) {
        break // done — success, not failure
    }
    if err != nil {
        return err // a real error (usually a status)
    }
    handle(msg)
}

Re-run the week's stdlib models to self-check: go run ./examples/month-05/protowire, ./framing, ./deadline, ./statuscodes.

🏋️ Exercises / Practice

Exercise Status Link
Re-run all Week 1 tests green go test ./exercises/month-05/week-1/...

🐛 Mistakes Made

  • On re-quiz I mixed up CloseSend (client half-close) with SendAndClose (server, client-streaming). Re-drilled the four stream methods.

❓ Open Questions

🧠 Active Recall (answer without looking)

  1. Q: Name the four streaming methods and who calls each.
    A

Send/Recv (both sides, any stream); CloseAndRecv (client-streaming client: stop sending, get the one reply); SendAndClose (client-streaming server: send the one reply and end); CloseSend (bidi/client-streaming client half-close). 2. Q: What single value governs deadline, cancellation, and metadata for an RPC?

A

The context.Context — first argument of every generated method. It carries the absolute deadline, the cancellation signal, and incoming/outgoing metadata across the call chain.

🪶 Feynman Reflection

gRPC is "typed function calls over HTTP/2". The .proto is the type signature, codegen makes the stubs, and the wire is numbered protobuf frames. Unary is one frame each way; streaming is many; everything else (deadline, auth metadata, status code) rides the context alongside the bytes.

🕳️ Knowledge Gaps

  • Interceptors, TLS, and gRPC-Gateway/transcoding — that's Week 2's job.

✅ Summary

Week 1 consolidated: I can model, generate, call, stream, and govern gRPC services. Full write-up in the review file.

⏭️ Next Steps / Prep for Tomorrow

  • Read the Week 1 review; start Week 2 (interceptors, TLS, transcoding).

Time spent Difficulty Confidence
90 min 🟦⬜⬜⬜⬜ 🟦🟦🟦🟦⬜

Suggested commit: docs(journal): week 1 review and recall (day 119)