Documentation
¶
Index ¶
Constants ¶
View Source
const (
// BufferSize is the number of readings to keep in the ring buffer
BufferSize = 8
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
Values [BufferSize]int `json:"values"`
Pos int `json:"pos"`
Count int `json:"count"`
}
Buffer is a fixed-size ring buffer of percentage values (0-100) that persists to disk across process invocations.
func Load ¶
Load reads a buffer from disk (or returns a cached in-memory copy). Returns a new empty buffer if the file doesn't exist.
func PushAndSave ¶
PushAndSave is a convenience that loads, pushes, saves, and returns the buffer
Click to show internal directories.
Click to hide internal directories.