Documentation
¶
Index ¶
Constants ¶
const DefaultDefinitionsMaxBuildAge = 72 * time.Hour
DefaultDefinitionsMaxBuildAge applies when DEFINITIONS_MAX_BUILD_AGE is unset. Three days: the worker rebuilds every 23 hours, so this is about three missed rebuilds, far enough past the ~25h a healthy build reaches to leave room for a failed one, and short enough that three weeks of frozen data cannot pass for current.
const DefaultDefinitionsMaxStaleness = 24 * time.Hour
DefaultDefinitionsMaxStaleness applies when DEFINITIONS_MAX_STALENESS is unset.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefinitionsCatalogConfig ¶ added in v0.6.8
type DefinitionsCatalogConfig struct {
// URL is the catalog base URL with any trailing slashes removed.
URL string
// MinCount is the valid-definition floor. Zero disables it.
MinCount int
// MaxStaleness bounds how long a replica may go without reaching the
// catalog. Zero disables it.
MaxStaleness time.Duration
// MaxBuildAge bounds the age of the published build being served, from the
// build's own createdAt. Zero disables it.
MaxBuildAge time.Duration
}
DefinitionsCatalogConfig is the validated form of the DEFINITIONS_* settings.
type Settings ¶
type Settings struct {
LogLevel string `yaml:"LOG_LEVEL"`
DB db.Settings `yaml:"DB"`
Port int `yaml:"PORT"`
MonPort int `yaml:"MON_PORT"`
KafkaBrokers string `yaml:"KAFKA_BROKERS"`
ContractsEventTopic string `yaml:"CONTRACT_EVENT_TOPIC"`
DIMORegistryChainID int64 `yaml:"DIMO_REGISTRY_CHAIN_ID"`
DIMORegistryAddr string `yaml:"DIMO_REGISTRY_ADDR"`
VehicleNFTAddr string `yaml:"DIMO_VEHICLE_NFT_ADDR"`
ManufacturerNFTAddr string `yaml:"DIMO_MANUFACTURER_NFT_ADDR"`
AftermarketDeviceAddr string `yaml:"AFTERMARKET_DEVICE_CONTRACT_ADDRESS"`
SACDAddress string `yaml:"SACD_ADDRESS"`
DCNRegistryAddr string `yaml:"DCN_REGISTRY_ADDR"`
DCNResolverAddr string `yaml:"DCN_RESOLVER_ADDR"`
SyntheticDeviceAddr string `yaml:"SYNTHETIC_DEVICE_CONTRACT_ADDRESS"`
RewardsContractAddr string `yaml:"REWARDS_CONTRACT_ADDRESS"`
BaseImageURL string `yaml:"BASE_IMAGE_URL"`
BaseVehicleDataURI string `yaml:"BASE_VEHICLE_DATA_URI"`
DefinitionsCatalogURL string `yaml:"DEFINITIONS_CATALOG_URL"`
// Smallest valid-definition count worth believing. A catalog carrying
// fewer is refused on every pod, cold or warm. Empty or "0" disables the
// check. Held as a string because the shared loader turns an unparseable
// int into 0 without an error, which silently disabled the floor;
// DefinitionsCatalog parses it strictly.
DefinitionsMinCount string `yaml:"DEFINITIONS_MIN_COUNT"`
// How long a replica may go without reaching the catalog. Past this,
// device-definition queries fail instead of quietly serving a snapshot
// nothing has been able to confirm. This bounds REACHABILITY, not data
// age: a catalog that answers every read with the same build is fresh by
// this measure -- see DefinitionsMaxBuildAge. A Go duration string; empty
// means 24h and "0" disables the bound.
DefinitionsMaxStaleness string `yaml:"DEFINITIONS_MAX_STALENESS"`
// How old the data itself may get: the age of the published build a
// replica is serving, from the build's own createdAt. Template mode only,
// because the flat manifest carries no timestamp that moves on its own.
// Necessarily a looser bound than DEFINITIONS_MAX_STALENESS -- the worker
// rebuilds when the live build is 23h old and the walk takes about two
// hours, so a healthy build is routinely 25h old. A Go duration string;
// empty means 72h and "0" disables the bound.
DefinitionsMaxBuildAge string `yaml:"DEFINITIONS_MAX_BUILD_AGE"`
EthereumRPCURL string `yaml:"ETHEREUM_RPC_URL"`
DevLicenseAddr string `yaml:"DEV_LICENSE_ADDR"`
StakingAddr string `yaml:"STAKING_ADDR"`
ConnectionAddr string `yaml:"CONNECTION_ADDR"`
StorageNodeAddr string `yaml:"STORAGE_NODE_ADDR"`
TemplateAddr string `yaml:"TEMPLATE_ADDR"`
FetchAPIGRPCAddr string `yaml:"FETCH_API_GRPC_ADDR"`
}
Settings contains the application config
func (*Settings) DefinitionsCatalog ¶ added in v0.6.8
func (s *Settings) DefinitionsCatalog() (DefinitionsCatalogConfig, error)
DefinitionsCatalog validates the DEFINITIONS_* settings and returns their parsed form. The shared loader cannot: it assigns strings verbatim, so a quoted Helm value with a trailing space or newline reaches the pod intact, and it turns a malformed int into 0 with no error. Call it at startup and refuse to start on an error.