Help us shape the future of Go! Take the 2026 Go Developer Survey

otadetails

package
v0.40.22 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package otadetails keeps each vehicle's OTA release details (current and available software version, release-notes link) fresh from Rivian's getOTAUpdateDetails: once a day per vehicle and when a monitor connects, never per request. The API reads what is stored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier added in v0.36.10

type Notifier func(Update)

Notifier delivers an Update (web push). It must not block.

type Syncer

type Syncer struct {
	// contains filtered or unexported fields
}

Syncer fetches OTA details for the vehicles of users with a Rivian session.

func New

func New(pool *sql.DB, accounts rivian.AccountRegistry, users func(context.Context) ([]uuid.UUID, error), logger *slog.Logger) *Syncer

New wires a Syncer over a pool.

func (*Syncer) OnConnect

func (s *Syncer) OnConnect(uid uuid.UUID)

OnConnect fetches for a user whose monitor just connected (boot or login), in the background. The claim keeps it to once a day per vehicle.

func (*Syncer) Run

func (s *Syncer) Run(ctx context.Context)

Run sweeps until ctx ends: every sweepEvery each user with a Rivian session, users userPace apart. Which vehicles are fetched is decided by the per-vehicle claim, so a sweep that finds nothing due costs no Rivian calls.

func (*Syncer) SetFence added in v0.40.13

func (s *Syncer) SetFence(f fence.Source)

SetFence makes the sync fetch only the vehicles whose group this pod owns, each write carrying that lease (lead mode); with lead mode off the source says Off and nothing changes.

func (*Syncer) SetNotifier added in v0.36.10

func (s *Syncer) SetNotifier(n Notifier)

SetNotifier makes the syncer announce new and installed versions. Call before Run.

func (*Syncer) SyncUser

func (s *Syncer) SyncUser(ctx context.Context, uid uuid.UUID) (int, error)

SyncUser fetches the OTA details of each of the user's vehicles that is due (no attempt in the last 23 hours), vehicles vehiclePace apart. It stops at the first upstream error: the rest wait for the next pass. It returns how many vehicles were fetched.

type Update added in v0.36.10

type Update struct {
	UserID    uuid.UUID
	Vehicle   string // model or name, e.g. "R1S"
	Version   string
	Installed bool
}

Update is a software-update event worth an alert: a new version offered (Installed false) or the installed version changed (Installed true).

Jump to

Keyboard shortcuts

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