Documentation
¶
Overview ¶
Package state stores DocDB process state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider provides access to DocDB process state.
func NewProvider ¶
NewProvider creates a new Provider that stores state in the given file (that will be created automatically if needed).
If filename is empty, then the state is not persisted.
All provider's methods are thread-safe.
func NewProviderDir ¶
NewProviderDir creates a new Provider that stores state in the state.json file in the given directory (that will be created automatically if needed).
func (*Provider) Get ¶
Get returns a copy of the current process state.
It is okay to call this function often. The caller should not cache result; Provider does everything needed itself.
func (*Provider) MetricsCollector ¶
func (p *Provider) MetricsCollector(addUUID bool) prometheus.Collector
MetricsCollector returns Prometheus metrics collector for that provider.
If addUUID is true, then the "uuid" label is added.
func (*Provider) Subscribe ¶
func (p *Provider) Subscribe() chan struct{}
Subscribe returns a channel that would receive notifications on state changes. One notification would be scheduled immediately.
type State ¶
type State struct {
UUID string `json:"uuid"`
Telemetry *bool `json:"telemetry,omitempty"` // nil for undecided
TelemetryLocked bool `json:"-"`
Start time.Time `json:"-"`
// may be empty if DocDB did not connect to PostgreSQL yet
PostgreSQLVersion string `json:"-"`
DocumentDBVersion string `json:"-"`
// as reported by beacon, if known
LatestVersion string `json:"-"`
UpdateInfo string `json:"-"`
UpdateAvailable bool `json:"-"`
}
State represents DocDB process state.
func (*State) TelemetryString ¶
TelemetryString returns "enabled", "disabled" or "undecided".