nodestatus

package
v0.11.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

About the nodestatus decision

Nodes periodically report their status to the chain:

  • Normally up nodes report every 40 mins, have margin 2 cycles (80 mins) to report before they are marked down
  • Farmerbot wake up the node once a day, if the node didn't report for 1 cycle (24 hours) it's marked down

Node status is determined based on:

  • node.power state and target (up/down)
  • updated_at timestamp if in the upInterval or standbyInterval or out of both intervals

Node status is determined as:

  • up: if its updated_at in the last 80 mins and its power state/target is up (or null which means doesn't have farmerbot data).
  • standby: if its updated_at in the last 24 hours and one or both of its power state/target is down
  • down:
    • if its updated_at is older than 80 mins and its power state/target is up (or null)
    • if its updated_at is older than a full day

Some Definitions of used terms:

  • nodeUpInterval: the duration in seconds that an UP node should report in.
  • nodeStandbyInterval: the duration in seconds that a STANDBY node should report in.
  • nilPower: node.power is null (is not powered by farmerbot)
  • poweredOn: both node state and desired state are up
  • poweredOff: both node state and desired state are down
  • poweringOn: node state is down but farmerbot is trying to power it on
  • poweringOff: node state is up but farmerbot is trying to power it off

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecideNodeStatus

func DecideNodeStatus(power types.NodePower, updatedAt int64) string

return the status of the node based on the power status and the last update time.

func DecideNodeStatusCondition

func DecideNodeStatusCondition(status string) string

return the condition to be used in the SQL query to get the nodes with the given status.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL