Build a Log
We will build our log from the bottom up, starting with the store and index files, then the segment, and finally the log. That way we can write and run tests as we build each piece. Since the word log can refer to at least three different things—a record, the file that stores records, and the abstract data type that ties segments together—to make things less confusing, throughout this chapter, I will consistently use the following terms to mean these things:
- Record—the data stored in our log.
- Store—the file we store records in.
- Index—the file we store index entries in.
- Segment—the abstraction that ties a store and an index together.
- Log—the abstraction that ties all the segments together.
Code the Store
To get started, create a directory ...
Get Distributed Services with 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.