liveBook · Manning

Read-only transaction

As explained in Build and Orchestrator in Go (From Scratch)

A read-only transaction is a database transaction that permits data retrieval without modifying persistent data.

A read-only transaction provides a consistent view of persistent data without modifying it. In BoltDB, the View function supplies the transaction callback. section 11.9

Counting tasks

TaskStore.Count opens a View transaction, iterates through the tasks bucket with ForEach, increments taskCount, and returns the count after checking errors.

How Build and Orchestrator in Go (From Scratch) covers it

How deep it goes
Explains the View callback, bucket access, iteration, and error return, but does not detail transaction internals.
Examples
Demonstrates Count, Get, and List through BoltDB View callbacks and bucket reads.
What it assumes
Assumes familiarity with persistent task stores, buckets, and Go callbacks while contrasting them with in-memory map access.
What you can do after
Build it from scratch by implementing persistent-store reads with BoltDB View callbacks and transaction-scoped bucket operations.
How it connects
Connects database transactions with persistent storage, BoltDB, buckets, and read-write transactions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build and Orchestrator in Go (From Scratch). The section links point to the parts of the book it draws on.