mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
The module already called itself github.com/luxfi/node while containing no node in Go: cmd/luxd was twenty-one lines that printed the size of a few types, and the Go column of the matrix measured a VM plugin. A repo that fetches the thing it claims to be has not replaced it, so the Go sources move in — 1515 files, the daemon and everything under it — and the build reaches outside this module for nothing. Rust and C++ sit beside it unchanged and are still measured against it by the differential. That is the point of one repo: the reference implementation and the two ports are the same checkout, so parity is a thing you can run rather than a thing you assert. Verified: builds, and the closure carries no lux-private — checked at build time rather than believed. The daemon starts twelve chains on a local network (P X C Q Z A B G K M F, plus D through its plugin) and reports healthy.
29 lines
1.0 KiB
Go
29 lines
1.0 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package meter
|
|
|
|
import "time"
|
|
|
|
// Meter tracks a continuous exponential moving average of the % of time this
|
|
// meter has been running.
|
|
type Meter interface {
|
|
// Inc the meter, the read value will be monotonically increasing while
|
|
// the meter is running.
|
|
Inc(time.Time, float64)
|
|
|
|
// Dec the meter, the read value will be exponentially decreasing while the
|
|
// meter is off.
|
|
Dec(time.Time, float64)
|
|
|
|
// Read the current value of the meter, this can be used to approximate the
|
|
// percent of time the meter has been running recently. The definition of
|
|
// recently depends on the halflife of the decay function.
|
|
Read(time.Time) float64
|
|
|
|
// Returns the duration between [now] and when the value of this meter
|
|
// reaches [value], assuming that the number of cores running is always 0.
|
|
// If the value of this meter is already <= [value], returns the zero duration.
|
|
TimeUntil(now time.Time, value float64) time.Duration
|
|
}
|