Moves the atomically accessed member to the top of the struct (#7365)
* Moves the 64bit atomically accessed field to the top of the struct. Signed-off-by: Bryan Varner <1652015+bvarner@users.noreply.github.com> * Moves the 64bit atomically accessed field to the top of the struct. Signed-off-by: Bryan Varner <1652015+bvarner@users.noreply.github.com> * Fixing up go fmt formatting issues. Signed-off-by: Bryan Varner <1652015+bvarner@users.noreply.github.com> Co-authored-by: Bryan Varner <1652015+bvarner@users.noreply.github.com>
This commit is contained in:
parent
ef4d8a38ca
commit
1627d234da
|
@ -78,13 +78,16 @@ func (e *CorruptionErr) Error() string {
|
|||
// ChunkDiskMapper is for writing the Head block chunks to the disk
|
||||
// and access chunks via mmapped file.
|
||||
type ChunkDiskMapper struct {
|
||||
// Keep all 64bit atomically accessed variables at the top of this struct.
|
||||
// See https://golang.org/pkg/sync/atomic/#pkg-note-BUG for more info.
|
||||
curFileNumBytes int64 // Bytes written in current open file.
|
||||
|
||||
/// Writer.
|
||||
dir *os.File
|
||||
|
||||
curFile *os.File // File being written to.
|
||||
curFileSequence int // Index of current open file being appended to.
|
||||
curFileMaxt int64 // Used for the size retention.
|
||||
curFileNumBytes int64 // Bytes written in current open file.
|
||||
|
||||
byteBuf [MaxHeadChunkMetaSize]byte // Buffer used to write the header of the chunk.
|
||||
chkWriter *bufio.Writer // Writer for the current open file.
|
||||
|
|
Loading…
Reference in New Issue