Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
vadiminshakov committed Dec 18, 2023
1 parent fb6db0d commit 3d32f98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions voteslog/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ var ErrExists = errors.New("msg with such index already exists")

const maxSegments = 5

// FileVotesLog is used to store votes and msgs on disk.
//
// Log is append-only, so we can't delete records from it, but log is divided into segments, which are rotated (oldest deleted) when
// segments number threshold is reached.
// Log is divided into two parts: msgs log and votes log. Each part has its own index, which is used to find record by its height.
// Index is stored in memory and loaded from disk on startup.
//
// This code is intentionally monomorphized for msgs and votes, generics can slow the app and make code more complicated.
type FileVotesLog struct {
// append-only log with proposed messages that node consumed
msgs *os.File
Expand Down

0 comments on commit 3d32f98

Please sign in to comment.