Documentation
¶
Overview ¶
Package softwareupdate is the controller's OTA push: matter.js's SoftwareUpdateManager and OtaAnnouncements (packages/node/src/behavior/system/software-update/ at b25ed960) and the storage half of its DclOtaUpdateService (packages/protocol/src/dcl/DclOtaUpdateService.ts).
A Manager keeps the update queue of the controller's commissioned nodes: it checks the ledgers and the stored images (Images) for updates, asks the host for consent (Config.OnUpdateAvailable) or queues an update it holds a consent for (Manager.AddUpdateConsent, Manager.ForceUpdate), announces the provider to one node at a time (AnnounceOTAProvider, reason UpdateAvailable), follows the update's status through the provider, and detects the outcome — the new version, a reboot into the old one, a resubscription after a restart that did not apply — arming the reboot re-subscription of client/peer (RebootResubscribeArmer) while the node applies. With Config.AnnounceAsDefaultProvider it also writes itself as each node's default provider once a day.
The provider itself is node/'s: matter.js serves it from the controller's own ServerNode, and the controller of this module mounts the same server (cluster/core.OTAProvider) on a node of its own on the fabric, the manager as its image source, consent and apply policy and the observer of its statuses (controller.Config.OTA). There is no second provider implementation.
Index ¶
- Constants
- Variables
- type ApplyUpdateExchange
- type ApplyUpdateScript
- type AvailableDetails
- type BlobStreamer
- type BlobWriter
- type Blobs
- type CheckOptions
- type Config
- type ConsentState
- type DeleteOptions
- type FindOptions
- type Images
- func (i *Images) CheckForUpdate(ctx context.Context, vid, pid uint16, current uint32, opts CheckOptions) (UpdateInfo, bool)
- func (i *Images) Delete(ctx context.Context, opts DeleteOptions) (int, error)
- func (i *Images) DownloadUpdate(ctx context.Context, info UpdateInfo, force bool) (string, error)
- func (i *Images) Find(ctx context.Context, opts FindOptions) []StoredImage
- func (i *Images) Open(ctx context.Context, filename string) (bdx.Blob, error)
- func (i *Images) Store(ctx context.Context, image []byte, mode Mode, info *UpdateInfo) (StoredImage, error)
- func (i *Images) UpdateInfoFromURL(ctx context.Context, fileURL string, opts LocalImageOptions) (UpdateInfo, error)
- type ImagesConfig
- type LocalImageOptions
- type Manager
- func (m *Manager) AddUpdateConsent(_ context.Context, p Peer, t Target) (bool, error)
- func (m *Manager) CheckForUpdates(ctx context.Context) error
- func (m *Manager) Close()
- func (m *Manager) ForceUpdate(_ context.Context, p Peer, t Target) error
- func (m *Manager) HasConsent(p Peer, version uint32) bool
- func (m *Manager) NodeChanged(n *client.Node)
- func (m *Manager) NodeDeleted(p Peer)
- func (m *Manager) NodeEvent(n *client.Node, endpoint uint16, cluster, event uint32, value any)
- func (m *Manager) NodeSubscription(n *client.Node, active bool)
- func (m *Manager) Observe(fn func(UpdateEvent)) (unsubscribe func())
- func (m *Manager) OnStatusChange(p Peer, status Status, version *uint32, applyDelay time.Duration)deprecated
- func (m *Manager) ProviderConfig() ProviderConfig
- func (m *Manager) QueryUpdates(ctx context.Context, only *client.Node, includeStored bool) ([]PeerUpdate, error)
- func (m *Manager) QueuedUpdates() []PendingUpdate
- func (m *Manager) RemoveConsent(p Peer, version uint32)
- func (m *Manager) SetBDX(r *bdx.Responder)
- func (m *Manager) SetProvider(nodeID uint64, endpoint uint16)
- func (m *Manager) Start()
- func (m *Manager) SuppressNextStartUp(p Peer, sessionID uint16)deprecated
- func (m *Manager) TransferOptionsFor(p Peer) TransferOptions
- func (m *Manager) UpdateExistsFor(ctx context.Context, p Peer, req provdef.QueryImageRequest) (AvailableDetails, bool)
- type MemoryBlobs
- type Mode
- type Peer
- type PeerUpdate
- type PendingStatus
- type PendingUpdate
- type ProductCheckError
- type ProviderCommands
- type ProviderConfig
- type ProviderExchange
- type QueryImageExchange
- type QueryImageRequest
- type QueryImageScript
- type SoftwareUpdateInfo
- type Status
- type StoredImage
- type Target
- type TransferOptions
- type UpdateEvent
- type UpdateEventKind
- type UpdateInfo
Constants ¶
const ( SourceLocal = "local" SourceProd = dcl.SourceProduction SourceTest = dcl.SourceTest )
Sources of an update — OtaUpdateSource (DclOtaUpdateService.ts:39 at b25ed960).
const ProgressTimeout = 15 * time.Minute
ProgressTimeout is how long an update may go without a status change or BDX activity before it counts as stalled — OTA_PROGRESS_TIMEOUT (OtaProgress.ts:14 at b25ed960, Minutes(15)), the provider's too.
Variables ¶
var ErrMismatch = errors.New("softwareupdate: node does not match the given vendorId/productId")
ErrMismatch is a consent whose vendor or product does not match the node — ImplementationError (SoftwareUpdateManager.ts:1584-1586 at b25ed960).
var ErrNoNode error = noNodeError{}
ErrNoNode is a peer address no node has: Manager.AddUpdateConsent and Manager.ForceUpdate change nothing for it — matter.js's OtaUpdateError of #otaEndpointFor (SoftwareUpdateManager.ts:1574-1578 at b25ed960), as for a node removed after the caller looked it up. It is an ErrNotApplicable too (errors.Is), as matter.js throws the one OtaUpdateError for both (C-24).
var ErrNotApplicable = errors.New("softwareupdate: node is not currently applicable for OTA updates")
ErrNotApplicable is a node that is not currently applicable for OTA updates — matter.js's OtaUpdateError of forceUpdate (SoftwareUpdateManager.ts:1486-1489 at b25ed960).
var ErrNotApplied = errors.New("softwareupdate: the node did not apply the update")
ErrNotApplied is the Err of an UpdateFailed whose update failed: the node came back from its restart, resubscribed or queried again below the target version after it applied, or its query found no image for the update (#failUpdate, SoftwareUpdateManager.ts:1142-1174 at b25ed960).
var ErrOTA = errors.New("softwareupdate: OTA update failed")
ErrOTA is an update check, store or download that failed — matter.js OtaUpdateError (DclOtaUpdateService.ts:33-37 at b25ed960).
var ErrTransferOptions = errors.New("softwareupdate: invalid transfer options")
ErrTransferOptions is an invalid transfer option — assertTransferOptions (SoftwareUpdateManager.ts:66-76 at b25ed960).
var ErrUpdateCancelled = errors.New("softwareupdate: the update was cancelled")
ErrUpdateCancelled is the Err of an UpdateFailed whose update was cancelled before it applied — its consent removed (removeConsent, SoftwareUpdateManager.ts:1694-1713 at b25ed960) — or that ended without a consent left (#retarget, SoftwareUpdateManager.ts:487-496 at b25ed960).
Functions ¶
This section is empty.
Types ¶
type ApplyUpdateExchange ¶
type ApplyUpdateExchange struct {
Request provdef.ApplyUpdateRequestRequest
Response provdef.ApplyUpdateResponse
}
ApplyUpdateExchange is an ApplyUpdateRequest and the answer the provider gave.
type ApplyUpdateScript ¶
type ApplyUpdateScript struct {
Action provdef.ApplyUpdateActionEnum
DelayedActionTime *uint32
}
ApplyUpdateScript is a scripted answer to one ApplyUpdateRequest — matter.js OtaScriptedApplyAnswer (controller-adapter.ts:597-610 at b25ed960). Each action reaches the requestor the way matter.js routes it (InProcessControllerAdapter.ts:747-799 at b25ed960):
- AwaitNextAction is stated directly, with DelayedActionTime (0 when nil); the provider is not asked, so the requestor's next request finds the transfer and the image it already downloaded.
- Discontinue withdraws the consent of the version the update token applies (Manager.RemoveConsent), when the token names one, and the provider answers by its apply table: a known token whose attempt does not apply yet is refused, an applying one proceeds, an unknown token with a version above 0 proceeds as a new attempt, version 0 under an unknown token is refused; DelayedActionTime is not laid over it.
- Proceed runs the provider's own path with DelayedActionTime in place of Config.ApplyDelay; the provider still refuses an update it holds no consent for, and the delay is not laid over that refusal.
type AvailableDetails ¶
type AvailableDetails struct {
NewSoftwareVersion uint32
NewSoftwareVersionString string
// Filename is the stored image (the file designator "ota/<filename>").
Filename string
ConsentRequired bool
}
AvailableDetails is what Manager.UpdateExistsFor offers a querying node — OtaUpdateAvailableDetails (SoftwareUpdateManager.ts:161-168 at b25ed960).
type BlobStreamer ¶
type BlobStreamer interface {
// CreateBlob starts writing the file name. Nothing of it is visible
// under name before the writer's Commit, which replaces a file of the
// same name; Abort discards what was written.
CreateBlob(ctx context.Context, name string) (BlobWriter, error)
// OpenBlob opens the file name for reading at any offset; a missing
// file wraps fs.ErrNotExist. A blob that implements io.Closer is
// closed after the store's own reads, and one [Images.Open] hands to a
// BDX transfer is closed by the server when that transfer ends
// ([bdx.ServeOptions].Open).
OpenBlob(ctx context.Context, name string) (bdx.Blob, error)
}
BlobStreamer is the optional streaming side of a Blobs. When the store's Blobs implements it, Images.DownloadUpdate writes a ledger image into it as the image arrives and verifies it by reading it back, and every other read of an image (Images.Find, Images.Open, the check of a stored image) reads the file in place; without it each image passes through memory whole (Put, Get). An image's small records — its .meta and its provenance (.origin) — go through Put and Get either way.
A backend opts in by implementing it on its own type; MemoryBlobs does not. Embedding a type that implements it promotes the capability: the embedding type's own Put and Get are then no longer used for image files.
type BlobWriter ¶
type BlobWriter interface {
io.Writer
// Commit makes the written bytes the file's content.
Commit() error
// Abort discards the written bytes and leaves the file as it was; it
// does nothing after Commit.
Abort() error
}
BlobWriter writes one file of a BlobStreamer. It is used by one goroutine.
type Blobs ¶
type Blobs interface {
Put(ctx context.Context, name string, data []byte) error
// Get returns fs.ErrNotExist for a missing file.
Get(ctx context.Context, name string) ([]byte, error)
Delete(ctx context.Context, name string) error
List(ctx context.Context) ([]string, error)
}
Blobs keeps the image files. MemoryBlobs is the default.
type CheckOptions ¶
type CheckOptions struct {
// IncludeStored considers the stored images beside the ledgers.
IncludeStored bool
// IsProduction, when set, asks the production ledger only (true) or
// the test-net one only (false); nil asks both. True also restricts
// the stored images to production ones, a stored test or local image
// is then not considered; false and nil consider every stored image.
IsProduction *bool
// Target, when set, considers that version only.
Target *uint32
}
CheckOptions configure Images.CheckForUpdate.
type Config ¶
type Config struct {
// Registry holds the nodes the manager updates (required).
Registry *client.Registry
// Images is the image store and the ledger lookups (required).
Images *Images
// FabricIndex, ProviderNodeID and ProviderEndpoint name the provider
// on our fabric: the DefaultOTAProviders record and the announcement
// carry them (OtaAnnouncements.ts:34-39 at b25ed960, the record
// OtaAnnouncements.ts:157-161 at b25ed960, the command
// OtaAnnouncements.ts:263-270 at b25ed960).
FabricIndex uint8
ProviderNodeID uint64
ProviderEndpoint uint16
// VendorID is our fabric's vendor, the announcement's
// (OtaAnnouncements.ts:263-270 at b25ed960).
VendorID uint16
// BDX is the provider's BDX responder: the manager reads a transfer's
// liveness and closes a stale one (#bdxSessionFor,
// SoftwareUpdateManager.ts:432-438 at b25ed960); nil
// knows no transfer.
BDX *bdx.Responder
// Armer re-subscribes a node that restarts after it applied
// (#rebootResubscribeArmer, SoftwareUpdateManager.ts:378-386 at
// b25ed960); nil arms nothing.
Armer *peer.RebootResubscribeArmer
// SessionID is the id of the newest session with a peer — the
// fallback of the startUp suppression's session
// (SoftwareUpdateManager.ts:1045-1047 at b25ed960); nil knows
// none.
SessionID func(p Peer) (uint16, bool)
// AllowTestImages also offers test-net and local images
// (State.allowTestOtaImages, SoftwareUpdateManager.ts:2144 at b25ed960,
// default false).
AllowTestImages bool
// UpdateCheckInterval is the period of the update check
// (State.updateCheckInterval, default 24 h); 0 is the default.
UpdateCheckInterval time.Duration
// DelegateConsentToRequestor offers a node whose QueryImage says it can
// obtain the user's consent itself (RequestorCanConsent) the newest
// applicable stored image without a consent given to the manager, with
// UserConsentNeeded, and accepts its apply (State.delegateConsentToRequestor,
// SoftwareUpdateManager.ts:2158-2171 at b25ed960, default false). Off,
// such a node is offered only a version the manager holds a consent for.
DelegateConsentToRequestor bool
// AnnounceAsDefaultProvider writes the provider as every node's
// default provider (State.announceAsDefaultProvider, default false).
AnnounceAsDefaultProvider bool
// AnnouncementInterval is the period of that write, at least 24 h
// (State.announcementInterval); 0 is 24 h.
AnnouncementInterval time.Duration
// MaxBDXBlockSize and BDXAdditionalMrpDelay are the default transfer
// options (State.maxBdxBlockSize, bdxAdditionalMrpDelay,
// SoftwareUpdateManager.ts:2173-2188 at b25ed960).
MaxBDXBlockSize uint16
BDXAdditionalMrpDelay *time.Duration
// ApplyDelay is how long an allowed apply waits, rounded up to whole
// seconds and at most a day (the provider's State.applyDelay,
// OtaSoftwareUpdateProviderServer.ts:427-435 at b25ed960, default 0).
ApplyDelay time.Duration
// RequestConsent asks the user for an update a requestor that cannot
// consent needs consent for (requestUserConsentForUpdate,
// OtaSoftwareUpdateProviderServer.ts:382-393 at b25ed960); nil answers
// Unknown,
// which declines.
RequestConsent func(ctx context.Context, p Peer, req QueryImageRequest, d AvailableDetails) (ConsentState, time.Duration)
// OnUpdateAvailable learns an update a node has no consent for
// (events.updateAvailable, SoftwareUpdateManager.ts:2281-2285 at
// b25ed960); the host grants it with
// AddUpdateConsent.
OnUpdateAvailable func(p Peer, info SoftwareUpdateInfo)
// OnUpdateApplying, OnUpdateDone and OnUpdateFailed are
// events.updateApplying, updateDone and updateFailed
// (SoftwareUpdateManager.ts:2287-2309 at b25ed960); [Manager.Observe]
// reports them too.
OnUpdateApplying, OnUpdateDone, OnUpdateFailed func(p Peer)
// OnStatus observes each status the provider reports for a node. A
// download's WaitForApply is reported on the receive path, when the
// node's final BlockAckEof arrives, so it must not block and must not
// call back into the controller synchronously.
OnStatus func(p Peer, status Status, version uint32)
// ScriptQueryImage and ScriptApplyUpdate, when set, are asked before
// the provider answers a QueryImage or an ApplyUpdateRequest; ok has
// the provider answer as the script says (script.go,
// [QueryImageScript], [ApplyUpdateScript]), and not ok leaves the
// answer to the provider. OnProviderExchange is told each command the
// provider answered, with its answer. A test harness's seam: matter.js
// keeps all three in its cert harness (support/chip-testing/src/cert/
// InProcessControllerAdapter.ts:628-814 at b25ed960).
ScriptQueryImage func(p Peer, req QueryImageRequest) (QueryImageScript, bool)
ScriptApplyUpdate func(p Peer, req provdef.ApplyUpdateRequestRequest) (ApplyUpdateScript, bool)
OnProviderExchange func(x ProviderExchange)
// Clock runs the timers; nil is the system clock.
Clock clock.Clock
// Rand draws the timers' jitter in [0, 1); nil is math/rand/v2.
Rand func() float64
// Logger receives the lines; nil is slog.Default().
Logger *slog.Logger
}
Config configures a Manager. The controller builds it (controller.Config.OTA).
type ConsentState ¶
type ConsentState = mattercore.OTAConsentState
ConsentState is the answer of a Config.RequestConsent hook.
type DeleteOptions ¶
type DeleteOptions struct {
// Filename names one stored image ("fff1.8000.prod.3"); the other
// fields are then not read.
Filename string
// VendorID selects the vendor's images; required without Filename.
VendorID *uint16
// ProductID narrows them to one product.
ProductID *uint16
// Mode narrows them to one storage mode; empty is every mode.
Mode Mode
// IsProduction, without Mode, is ModeProd (true) or ModeTest (false),
// matter.js's deprecated isProduction (DclOtaUpdateService.ts:1224-1227
// at b25ed960).
IsProduction *bool
}
DeleteOptions select the stored images Images.Delete removes — delete's options (DclOtaUpdateService.ts:1208-1215 at b25ed960).
type FindOptions ¶
type FindOptions struct {
VendorID, ProductID *uint16
// IsProduction, without Mode, keeps prod images (true) or the others
// (false) (DclOtaUpdateService.ts:1113-1116 at b25ed960).
IsProduction *bool
Mode Mode
// CurrentVersion keeps the images whose applicable range holds it
// (#checkEntry, DclOtaUpdateService.ts:1138-1174 at b25ed960).
CurrentVersion *uint32
}
FindOptions filter Images.Find — DclOtaUpdateService.FindOptions (DclOtaUpdateService.ts:1333-1339 at b25ed960). A nil field matches anything.
type Images ¶
type Images struct {
// contains filtered or unexported fields
}
Images is the image store over Blobs and the ledgers. Safe for concurrent use.
func (*Images) CheckForUpdate ¶
func (i *Images) CheckForUpdate(ctx context.Context, vid, pid uint16, current uint32, opts CheckOptions) (UpdateInfo, bool)
CheckForUpdate is the applicable update of vid/pid over current: the stored images (production ones only when IsProduction is true), then the production and test-net ledgers; the highest version wins, on equal versions a stored image before a ledger one, or the target version alone.
Mirrors matter.js packages/protocol/src/dcl/DclOtaUpdateService.ts:299-383 at b25ed960 (checkForUpdate); the stored images are selected as [Images.applicable] selects them, called as at DclOtaUpdateService.ts:318-324 at b25ed960.
func (*Images) Delete ¶
Delete removes the stored images opts selects, each with its recorded specification version, and returns how many it removed — matter.js DclOtaUpdateService.delete (DclOtaUpdateService.ts:1208-1295 at b25ed960). A filename that is not an OTA filename is refused; one that names no stored image removes nothing and is no error (DclOtaUpdateService.ts:1229-1242 at b25ed960). Without a filename the vendor is required (DclOtaUpdateService.ts:1266-1268 at b25ed960). A ProductID narrows the selection with or without a mode, where matter.js narrows by product only together with a mode (BD-Matter-OtaImages-DeleteProductWithoutMode).
func (*Images) DownloadUpdate ¶
DownloadUpdate makes info's image available in the store and returns its filename — downloadUpdate (DclOtaUpdateService.ts:636-731 at b25ed960). A stored image that validates is used, unless force asks for a new download, and the specification version info carries is recorded for it; a stored image that fails validation is removed. Online a stored image that cannot be read, or one force replaces, is removed too and the ledger's image is downloaded, verified and stored.
Offline (no ledger) nothing is downloaded and the call fails with ErrOTA unless a stored image validates: after removing one that failed validation, when none is stored, and — keeping the stored image, since nothing could replace it — when it cannot be read or force is set.
A ledger update needs the ledger's whole-file checksum unless ImagesConfig.AllowUnverifiedLedgerImages admits it without: an update whose record states none, and an update of a stored ledger image that carries no record of a checksum it was checked against, are refused with ErrOTA before anything else — nothing is downloaded, and the stored image is kept but not reused. An image the host supplied itself needs none.
Calls for one file name, and Images.Store of it, run one at a time: a second call waits for the first and then finds the image the first stored (review II, R2-P6-conc-1901).
func (*Images) Find ¶
func (i *Images) Find(ctx context.Context, opts FindOptions) []StoredImage
Find lists the stored images opts selects, by mode (prod, test, local), vendor, product and version — DclOtaUpdateService.find (DclOtaUpdateService.ts:1017-1174 at b25ed960).
func (*Images) Open ¶
Open opens the stored image named filename for a BDX transfer (fileDesignatorForUpdate, DclOtaUpdateService.ts:1177-1192 at b25ed960). A name that is not an OTA filename is refused as matter.js refuses it and, as no stored image has it, wraps fs.ErrNotExist; a missing image wraps the Blobs error.
func (*Images) Store ¶
func (i *Images) Store(ctx context.Context, image []byte, mode Mode, info *UpdateInfo) (StoredImage, error)
Store stores an image — DclOtaUpdateService.store (DclOtaUpdateService.ts:562-616 at b25ed960): it is written under its vendor, product, mode and version, read back and checked against its header (and against info's vendor, product and version when given), the specification version recorded; a failed check removes it. Store and Images.DownloadUpdate of one file name run one at a time. A provenance record that cannot be removed before the image is written fails the call with ErrOTA and nothing is written (review II, 5b-dcl R9).
func (*Images) UpdateInfoFromURL ¶
func (i *Images) UpdateInfoFromURL(ctx context.Context, fileURL string, opts LocalImageOptions) (UpdateInfo, error)
UpdateInfoFromURL reads the header of the OTA image at the HTTP(S) URL fileURL and returns its update, of SourceLocal; Images.DownloadUpdate then downloads it from that URL into ModeLocal — matter.js createUpdateInfoFromFile (DclOtaUpdateService.ts:945-1002 at b25ed960). The download ends once the header's bytes are in (at most otaimage.MaxHeaderSize and the 16-byte prefix); the rest of the image is not fetched. Another scheme is refused (a local file is UpdateInfoFromImage's), and so is every URL offline, without a fetch. The host names the URL, so both downloads take dcl.OTAVersions.DownloadHostURL: http and a server on the local network are admitted, which a ledger record's URL is not.
type ImagesConfig ¶
type ImagesConfig struct {
// Blobs keeps the files; nil is a [MemoryBlobs]. One that also
// implements [BlobStreamer] receives a ledger image as it downloads.
Blobs Blobs
// Ledger asks the production and test-net ledgers; nil asks none, as
// the service's offline option (DclOtaUpdateService.ts:1305-1316 at
// b25ed960): only stored images are found, and nothing is downloaded. Its MaxImageSize bounds every
// download of the store ([Images.DownloadUpdate],
// [Images.UpdateInfoFromURL]) at [dcl.DefaultMaxImageSize] when it
// sets none. DownloadUpdate holds the image in memory until it is
// verified unless Blobs is a [BlobStreamer]; UpdateInfoFromURL reads
// the header only.
Ledger *dcl.OTAVersions
// Logger receives the store's lines; nil is slog.Default().
Logger *slog.Logger
// AllowUnverifiedLedgerImages admits a ledger image (of the
// production or the test-net ledger) that is not bound to the
// ledger's whole-file checksum (OTAChecksum): an update whose record
// states none, and a stored prod or test image the store does not
// record as checked against one or as supplied by the host (one stored
// from a record without a checksum, or by a release before the store
// kept provenance records). Without it
// [Images.DownloadUpdate] refuses such an update before it downloads
// anything or reuses a stored image, with [ErrOTA] and a warning line
// (dcl.ota.no_checksum), [Images.CheckForUpdate] does not offer such a
// stored image and [Images.Open] does not open it; the file is kept.
// With it each update so made available is logged
// (dcl.ota.no_checksum_admitted). An image the host supplies itself
// ([UpdateInfoFromImage], [Images.UpdateInfoFromURL], a stored local
// image, [Images.Store] without a ledger record) needs no checksum
// either way.
AllowUnverifiedLedgerImages bool
}
ImagesConfig configures NewImages.
type LocalImageOptions ¶
type LocalImageOptions struct {
// MinApplicable is used when the header states none; nil is 0.
MinApplicable *uint32
// MaxApplicable is used when the header states none; nil is the
// image's version minus one.
MaxApplicable *uint32
// SpecificationVersion is the Matter specification version the image
// implements, recorded with it when it is stored; 0 is unknown.
SpecificationVersion uint32
}
LocalImageOptions are the fields of a local image's UpdateInfo its header may not carry — updateInfoFromStream's options (DclOtaUpdateService.ts:862-884 at b25ed960).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the controller's SoftwareUpdateManager. Safe for concurrent use.
func New ¶
New returns the manager over cfg; Manager.Start starts it.
func (*Manager) AddUpdateConsent ¶
AddUpdateConsent gives the consent to update the node to t's version; a node has one consent:
- no node has the address: ErrNoNode; vendor or product of an applicable node differ: ErrMismatch — nothing changes;
- the node runs the target or a higher version: false, nothing stored;
- the node is not applicable for updates: the consent is stored, false;
- otherwise it replaces the node's consent, also a failed one; a queued update the node does not follow yet takes the version; true when the node has a queued update afterwards.
The update is announced with the next queue slot. A consent given while the node follows an update to another version takes effect when that update ends. The consents are not persisted.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:1538-1567 at b25ed960 (addUpdateConsent).
func (*Manager) CheckForUpdates ¶
CheckForUpdates checks every node for updates, stored images included, and purges the stored images no node needs — checkForUpdates (SoftwareUpdateManager.ts:722-725 at b25ed960). A product whose check failed is logged and passed over, the others are still checked and the purge still runs; the error joins the failures of those products (errors.Join), as Manager.QueryUpdates returns them, and is nil only when every product's check succeeded (review II, R2-P6-err-1912).
func (*Manager) Close ¶
func (m *Manager) Close()
Close takes the manager offline — #nodeGoingOffline and the disposal (SoftwareUpdateManager.ts:296-310, :2127-2138 at b25ed960): no update work starts any more; the timers stop; every running announcement is aborted and waited for (#stopAnnouncements, SoftwareUpdateManager.ts:1446-1453 at b25ed960), so an entry whose announcement it ended waits as queued; the announcements stop and the attempts end, an entry that followed one keeps following it (#endAllAttempts, SoftwareUpdateManager.ts:1229-1237 at b25ed960). A running update check a timer started is cancelled — its download included — and waited for, so nothing is stored after Close returns (review II, R2-P6-conc-1907).
func (*Manager) ForceUpdate ¶
ForceUpdate replaces the node's consent as Manager.AddUpdateConsent does and announces the update at once, also while updates of other nodes are in progress:
- no node has the address: ErrNoNode; not applicable for updates: ErrNotApplicable; vendor or product differ: ErrMismatch — nothing changes;
- the node runs the target or a higher version: ErrNotApplicable;
- a BDX transfer of the node runs for the target: the consent is replaced, the transfer continues and no announcement starts; one runs for another or an unknown version: ErrNotApplicable;
- otherwise the consent is replaced, an update the node was announced for or follows is reset, and the announcement starts unless one runs.
A BDX registration of the node is not cancelled; the next transfer replaces it. That an announcement started is not promised.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:1455-1524 at b25ed960 (forceUpdate).
func (*Manager) HasConsent ¶
HasConsent reports a consent of the node, for version when it is not 0; a failed update keeps its consent for 24 hours.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:1627-1637 at b25ed960 (hasConsent).
func (*Manager) NodeChanged ¶
NodeChanged takes a change of the node's image.
func (*Manager) NodeDeleted ¶
NodeDeleted forgets the node at p at once, when it left the registry (client.Hooks.Deleted): its consent (reported as UpdateConsentChanged, Go-only), a startUp suppression, the update found for it, what the manager observed of it, its reboot arming, its attempts and its BDX scope (a transfer that runs is closed). Its queued update leaves the queue without an event when the queue runs, as no node has the address any more, and the queue runs on for the other nodes. A node the manager never saw is no error. Nothing happens while updates are suppressed — before Manager.Start and after Manager.Close; the next full check drops the same for a node whose deletion was not reported (review II, R2-P6-bound-1914).
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:312-342 at b25ed960 (#forgetPeer).
func (*Manager) NodeSubscription ¶
NodeSubscription takes a change of the node's subscription.
func (*Manager) Observe ¶
func (m *Manager) Observe(fn func(UpdateEvent)) (unsubscribe func())
Observe calls fn with every UpdateEvent from now on, until the returned unsubscribe is called; unsubscribe is idempotent, and no event is delivered to fn after it returned except the one a running call is delivering. The events are delivered in the order the manager's state moved, one at a time, on a goroutine of the manager's that holds none of its locks — fn may call back into the manager (QueuedUpdates, HasConsent), but must not call Close, which waits for the delivery of the events already emitted. After Close nothing is delivered.
func (*Manager) OnStatusChange
deprecated
OnStatusChange takes a status an OTA provider reports for the node without an update attempt — the onOtaStatusChange of matter.js before the attempts. While the node's queued update follows an attempt, the status is the attempt's: Done records a NotifyUpdateApplied of its token with version (the update's target when nil), and any other status is reported on the attempt (reportAttemptStatus). An update that follows none moves as before: Done completes it and drops the consents it covers; Cancelled resets it for a retry; any other status moves it on, and Applying arms the reboot re-subscription with the apply delay and, the first time, reports the update applying; the entry's first Downloading reports UpdateTransferStarted.
Deprecated: the provider reports to the manager's attempts through ProviderConfig.Manager (mattercore.OTAUpdateManager); removable in v0.26.0.
func (*Manager) ProviderConfig ¶
func (m *Manager) ProviderConfig() ProviderConfig
ProviderConfig is the provider configuration that serves the manager's updates. The controller builds its provider from it (controller/ota_provider.go newOTAProvider). It fills Manager and none of the deprecated hooks, which the provider refuses beside a Manager: the manager takes the statuses, judges a restart query and names the transfer options through it.
func (*Manager) QueryUpdates ¶
func (m *Manager) QueryUpdates(ctx context.Context, only *client.Node, includeStored bool) ([]PeerUpdate, error)
QueryUpdates checks every node, or only, for updates over the ledgers and — with includeStored — the stored images, and returns the nodes it found one for — queryUpdates (SoftwareUpdateManager.ts:810-870 at b25ed960). A check the manager ran (it was not suppressed) ends with an UpdateCheckFinished event. A product whose check failed is logged and passed over and the others are still checked: the nodes returned are those of the products that succeeded, and the error joins the failures, one *ProductCheckError per product naming its nodes (errors.Join, ProductCheckErrors; the event's Err is the same error). It is nil only when every product's check succeeded, so a caller that treats any error as fatal discards the updates found besides (review II, R2-P6-err-1912).
func (*Manager) QueuedUpdates ¶
func (m *Manager) QueuedUpdates() []PendingUpdate
QueuedUpdates is a snapshot of the update queue. A failed update is not listed — updateFailed reported it — until the node retries it on its own; the status is the phase's, stalled for an update underway without activity or a moving transfer.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:388-430 at b25ed960 (queuedUpdates).
func (*Manager) RemoveConsent ¶
RemoveConsent removes the node's consent for version, or for any version when it is 0. The node's offers of the version (of any, for 0) lose their apply right, so an ApplyUpdateRequest under their token is refused unless the update already applies, and its queries that made no offer yet end, answered NotAvailable. The queued update to a removed version:
- applies: continues, it can no longer be stopped;
- was announced or is followed by the node: leaves the queue with updateFailed (ErrUpdateCancelled), its BDX transfer cancelled;
- is queued or announcing: leaves with updateFailed, its announcement aborted.
updateFailed is not reported again for an update whose failure it reported. For 0, a transfer of the node is cancelled in every case but an applying update. A consent left after an update was cancelled with its transfer is queued again.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:1639-1723 at b25ed960 (removeConsent).
func (*Manager) SetBDX ¶
SetBDX gives the manager the provider's BDX responder, once the controller has built its provider (controller/ota.go openOTA). It may be called at any time; the manager reads it under its lock (review II, R2-P6-conc-1913).
func (*Manager) SetProvider ¶
SetProvider names the provider's node id and endpoint, once the controller has built its provider (controller/ota.go openOTA). It may be called at any time; the announcements read the values it set under the manager's lock (review II, R2-P6-conc-1913).
func (*Manager) Start ¶
func (m *Manager) Start()
Start brings the manager online — #nodeOnline (SoftwareUpdateManager.ts:264-294 at b25ed960): the announcements start per Config.AnnounceAsDefaultProvider and the first update check is scheduled 5 to 10 minutes later, then every UpdateCheckInterval.
func (*Manager) SuppressNextStartUp
deprecated
SuppressNextStartUp suppresses the node's next StartUp event on session sessionID — #suppressNextStartUp (SoftwareUpdateManager.ts:1725-1731 at b25ed960).
Deprecated: the manager suppresses the startUp itself when it admits a query for the node's restart while an update of the node is queued (admitQuery, SoftwareUpdateManager.ts:1802-1881 at b25ed960); removable in v0.26.0.
func (*Manager) TransferOptionsFor ¶
func (m *Manager) TransferOptionsFor(p Peer) TransferOptions
TransferOptionsFor is how BDX carries the node's update: the options given with its consent, else the defaults.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:1526-1536 at b25ed960 (bdxTransferOptionsFor).
func (*Manager) UpdateExistsFor ¶
func (m *Manager) UpdateExistsFor(ctx context.Context, p Peer, req provdef.QueryImageRequest) (AvailableDetails, bool)
UpdateExistsFor is the stored update the querying node gets: the node's details must match the query; the candidates are the applicable stored images over its version (prod ones, the others only with AllowTestImages), newest first; the one whose version is the consent's comes first — also for 24 hours after its update failed — else the newest, flagged consent-required, when the consent may be delegated to the node (Config.DelegateConsentToRequestor, mayDelegateConsentTo); else nothing. A stored image the store would not serve (Images.Open: a prod or test image not bound to a ledger checksum, unless ImagesConfig.AllowUnverifiedLedgerImages) is no candidate.
Mirrors matter.js packages/node/src/behavior/system/software-update/SoftwareUpdateManager.ts:657-715 at b25ed960 (updateExistsFor).
type MemoryBlobs ¶
type MemoryBlobs struct {
// contains filtered or unexported fields
}
MemoryBlobs keeps the files in memory. Safe for concurrent use.
func (*MemoryBlobs) Delete ¶
func (m *MemoryBlobs) Delete(_ context.Context, name string) error
Delete implements Blobs.
func (*MemoryBlobs) Get ¶
Get implements Blobs. The slice it returns is the stored file, not a copy (an image is not doubled per read): the caller only reads it — a write into it would change the file under every other reader (review II, R2-P6-conc-1916).
type Mode ¶
type Mode string
Mode is the storage mode of an image — OtaStorageMode (DclOtaUpdateService.ts:41 at b25ed960): "prod" and "test" images came from the production and test-net ledgers, "local" ones from the host.
type PeerUpdate ¶
type PeerUpdate struct {
Peer Peer
Info SoftwareUpdateInfo
}
PeerUpdate is a node with an update, as Manager.QueryUpdates returns it.
type PendingStatus ¶
type PendingStatus string
PendingStatus is a queued update's state — PendingUpdateInfo.status (SoftwareUpdateManager.ts:193-216 at b25ed960).
const ( // PendingQueued waits for its turn; no announcement was sent yet. PendingQueued PendingStatus = "queued" // PendingInProgress was announced to the node; the manager waits for it. PendingInProgress PendingStatus = "in-progress" // PendingStalled had no status change and no BDX activity within // [ProgressTimeout]; it is reset and retried. PendingStalled PendingStatus = "stalled" )
The pending statuses.
type PendingUpdate ¶
type PendingUpdate struct {
Peer Peer
VendorID uint16
ProductID uint16
TargetSoftwareVersion uint32
Status PendingStatus
// LastProgressStatus is the last status the provider reported; nil
// before any.
LastProgressStatus *Status
// LastProgressUpdateTime is when the update last moved; zero while
// queued.
LastProgressUpdateTime time.Time
// BDXTransferred and BDXDataLength are the transfer's progress of an
// in-progress update; nil otherwise or while unknown.
BDXTransferred, BDXDataLength *uint64
}
PendingUpdate is one entry of Manager.QueuedUpdates — PendingUpdateInfo (SoftwareUpdateManager.ts:193-216 at b25ed960).
type ProductCheckError ¶
type ProductCheckError struct {
VendorID, ProductID uint16
// SoftwareVersion is the version the nodes run, which the check
// looked for a newer one than.
SoftwareVersion uint32
// Peers are the nodes of the product at that version the check was
// for, in the registry's order.
Peers []Peer
Err error
}
ProductCheckError is one product's failed check in the error Manager.QueryUpdates and Manager.CheckForUpdates return, which joins one per failed product (errors.Join): the product, the software version its nodes run, the nodes it was checked for, and the cause, which errors.Is and errors.As reach through it. A caller attributes a failure to its nodes with ProductCheckErrors instead of checking node by node again (go-fabric#555).
func ProductCheckErrors ¶
func ProductCheckErrors(err error) []*ProductCheckError
ProductCheckErrors are the [ProductCheckError]s err holds, in the order the products were checked; none for nil or an error without one. It walks errors.Join and wrapping alike, and does not descend into a ProductCheckError's cause.
func (*ProductCheckError) Error ¶
func (e *ProductCheckError) Error() string
func (*ProductCheckError) Unwrap ¶
func (e *ProductCheckError) Unwrap() error
type ProviderCommands ¶
type ProviderCommands struct {
QueryImage func(ctx context.Context, p mattercore.OTAPeer, req provdef.QueryImageRequest, own func(context.Context) (provdef.QueryImageResponse, error)) (provdef.QueryImageResponse, error)
ApplyUpdate func(ctx context.Context, p mattercore.OTAPeer, req provdef.ApplyUpdateRequestRequest, own func(context.Context) (provdef.ApplyUpdateResponse, error)) (provdef.ApplyUpdateResponse, error)
NotifyUpdateApplied func(ctx context.Context, p mattercore.OTAPeer, req provdef.NotifyUpdateAppliedRequest, own func(context.Context) error) error
}
ProviderCommands wraps the provider's command handlers: each gets the requestor, the request and the provider's own handler, and answers in its place. The controller installs it on its provider (controller/ota_provider.go wrapProviderCommands).
type ProviderConfig ¶
type ProviderConfig struct {
ImageSource mattercore.OTAImageSource
Consent mattercore.OTAConsent
// Manager is the manager as the provider's [mattercore.OTAUpdateManager]:
// the update attempts, the admission of a query, the apply table and
// the transfer options of a node.
Manager mattercore.OTAUpdateManager
// ApplyDelay is [Config].ApplyDelay, the provider's apply delay
// (mattercore.OTAProviderConfig.ApplyDelay).
ApplyDelay time.Duration
// ApplyPolicy is no longer filled: the delay is ApplyDelay, and the
// Manager decides the apply, a scripted refusal included.
//
// Deprecated: the delay is ApplyDelay and the apply is the Manager's
// to decide; removable in v0.26.0.
ApplyPolicy mattercore.OTAApplyPolicy //nolint:staticcheck // the deprecated field keeps its type for its window
BDXMaxBlockSize uint16
// OnStatusChange is no longer filled: the provider reports to the
// Manager's attempts, and beside a Manager the provider refuses it.
//
// Deprecated: the provider reports to the Manager's attempts;
// removable in v0.26.0.
OnStatusChange func(peer mattercore.OTAPeer, status mattercore.OTAUpdateStatus, version uint32)
// RebootQuery is no longer filled: the Manager judges a restart query
// itself, and beside a Manager the provider refuses it.
//
// Deprecated: the Manager judges the restart in its AdmitQuery;
// removable in v0.26.0.
RebootQuery func(peer mattercore.OTAPeer, sessionID uint16)
// TransferBlockSize is no longer filled: the Manager names a node's
// transfer options, and beside a Manager the provider refuses it.
//
// Deprecated: the Manager's BDXTransferOptionsFor names a node's
// transfer options; removable in v0.26.0.
TransferBlockSize func(peer mattercore.OTAPeer) uint16
// Commands wraps the provider's command handlers with [Config]'s
// script and exchange observer; nil without them (script.go).
Commands *ProviderCommands
}
ProviderConfig is what the OTA provider that serves the manager's updates runs with: the ports and hooks of node/'s provider (node.OTAProviderConfig, field by field), in cluster/core's types, so that this package stays below the node facade (ADR 0026 principle 1).
type ProviderExchange ¶
type ProviderExchange struct {
Peer Peer
// At is when the provider received the command, on the manager's
// clock: only the difference between two exchanges means anything
// (receivedAtMs, controller-adapter.ts:420-431 at b25ed960).
At time.Time
QueryImage *QueryImageExchange
ApplyUpdate *ApplyUpdateExchange
NotifyUpdateApplied *provdef.NotifyUpdateAppliedRequest
}
ProviderExchange is one command the provider answered, with the answer — one entry of matter.js OtaProviderExchanges (controller-adapter.ts:481-485 at b25ed960). Exactly one of the three exchange fields is set. A command the provider rejected is not reported: an answer is recorded once it was produced (InProcessControllerAdapter.ts:622-624 at b25ed960).
type QueryImageExchange ¶
type QueryImageExchange struct {
Request QueryImageRequest
Response provdef.QueryImageResponse
}
QueryImageExchange is a QueryImage and the answer the provider gave.
type QueryImageRequest ¶
type QueryImageRequest = provdef.QueryImageRequest
QueryImageRequest is a requestor's QueryImage.
type QueryImageScript ¶
type QueryImageScript struct {
// Response, when set, is answered as it stands and the provider is not
// asked: its answer stages an in-progress entry and registers the peer
// for BDX, which a status stated over it afterwards would leave behind
// (InProcessControllerAdapter.ts:681-694 at b25ed960). A scripted UpdateAvailable
// names an image the provider does not hold; its fields are the
// script's to fill (#unheldUpdate, InProcessControllerAdapter.ts:727-745 at
// b25ed960).
Response *provdef.QueryImageResponse
// UserConsentNeeded, without Response, is laid over the provider's own
// answer (withUserConsent, InProcessControllerAdapter.ts:944-949 at
// b25ed960).
UserConsentNeeded *bool
}
QueryImageScript is a scripted answer to one QueryImage — matter.js OtaScriptedQueryAnswer (packages/testing/src/chip/cert/ controller-adapter.ts:560-582 at b25ed960).
type SoftwareUpdateInfo ¶
type SoftwareUpdateInfo struct {
VendorID uint16
ProductID uint16
SoftwareVersion uint32
SoftwareVersionString string
ReleaseNotesURL string
SpecificationVersion uint32
// Source is SourceLocal, SourceProd or SourceTest.
Source string
}
SoftwareUpdateInfo is an update found for a node — matter.js SoftwareUpdateInfo (SoftwareUpdateManager.ts:170-191 at b25ed960).
type Status ¶
type Status = mattercore.OTAUpdateStatus
Status is an update's status as the provider reports it — matter.js OtaUpdateStatus (OtaProgress.ts:16-25 at b25ed960), cluster/core's OTAUpdateStatus.
type StoredImage ¶
type StoredImage struct {
// Filename is "<vendor hex>.<product hex>.<mode>.<version>"
// (DclOtaUpdateService.ts:555-557 at b25ed960).
Filename string
VendorID uint16
ProductID uint16
SoftwareVersion uint32
SoftwareVersionString string
// MinApplicable and MaxApplicable are the header's range; nil when it
// states none.
MinApplicable, MaxApplicable *uint32
Mode Mode
Size int
// SpecificationVersion is the one recorded at store time, 0 when
// unknown.
SpecificationVersion uint32
}
StoredImage is a stored image's entry — DclOtaUpdateService.OtaUpdateListEntry (DclOtaUpdateService.ts:1319-1331 at b25ed960).
type Target ¶
type Target struct {
VendorID uint16
ProductID uint16
TargetSoftwareVersion uint32
// MaxBDXBlockSize caps the block size of this transfer over
// [Config].MaxBDXBlockSize; nil falls back to it. It must be positive.
MaxBDXBlockSize *uint16
// BDXAdditionalMrpDelay is the transfer's MRP margin over
// [Config].BDXAdditionalMrpDelay; nil falls back to it. It must not
// be negative.
BDXAdditionalMrpDelay *time.Duration
}
Target names the update a consent applies to and how to transfer it — SoftwareUpdateManager.UpdateTarget (SoftwareUpdateManager.ts:2191-2208 at b25ed960).
type TransferOptions ¶
TransferOptions are a peer's BDX options — bdxTransferOptionsFor (SoftwareUpdateManager.ts:1526-1536 at b25ed960): 0 and nil leave the decision to the peer and its medium.
type UpdateEvent ¶
type UpdateEvent struct {
Kind UpdateEventKind
// Peer is the node; zero for an [UpdateCheckFinished] of every node.
Peer Peer
// Target is the update: the found version of UpdateAvailable, the
// consent's of UpdateConsentChanged, the queued entry's otherwise.
Target Target
// Info is the found update of UpdateAvailable.
Info SoftwareUpdateInfo
// Consented, for UpdateConsentChanged, is whether the manager holds
// the consent now.
Consented bool
// Updates are the nodes an UpdateCheckFinished found an update for.
Updates []PeerUpdate
// Err is the error of UpdateCheckFinished and UpdateFailed.
Err error
}
UpdateEvent is one report of Manager.Observe.
type UpdateEventKind ¶
type UpdateEventKind uint8
UpdateEventKind is what an UpdateEvent reports.
const ( // UpdateAvailable: a check found an update for a node the manager // holds no consent for (requestConsentForUpdate); Info // carries its details. AddUpdateConsent grants it. UpdateAvailable UpdateEventKind = iota + 1 // UpdateConsentChanged: a consent was added or replaced // (AddUpdateConsent, ForceUpdate) or removed (RemoveConsent, a node // deleted, a failed consent expired after 24 hours); Consented says // which. Go-only. UpdateConsentChanged // UpdateCheckFinished: a check for updates ended (QueryUpdates, and so // CheckForUpdates and the periodic check); Updates are the nodes it // found an update for, Err the errors of the products whose check // failed and was passed over (QueryUpdates itself goes on, as // queryUpdates does, SoftwareUpdateManager.ts:810-870 at b25ed960). // Peer is the node of a check of one // node, zero otherwise. Go-only. UpdateCheckFinished // UpdateApplying: the node was allowed to apply the image its queued // update follows, the first Applying of the linked attempt. UpdateApplying // UpdateDone: the node runs the target version. UpdateDone // UpdateFailed: the queued update failed, was cancelled with // RemoveConsent, or ended without a consent left; Err is // [ErrNotApplied] or [ErrUpdateCancelled]. A failure is reported once // per consent: the consent stays 24 hours, the node may retry the // update on its own meanwhile, and UpdateDone follows when that // succeeds. The update of a node deleted, or whose failed consent // expired, ends without an event (SoftwareUpdateManager.ts:2303-2309 at // b25ed960). UpdateFailed // UpdateQueued: an update entered the queue (#queueUpdate) // — a consent that queues, ForceUpdate, or a check that found an // update with a consent held — or a queued entry not yet in progress // took a different target; not when a periodic check queues the same // target again. Go-only. UpdateQueued // UpdateTransferStarted: the node began downloading the image — the // entry's first Downloading status, which the provider reports when // the node's BDX session starts; a retry's new session does not // report it again. Go-only. UpdateTransferStarted )
The kinds of an UpdateEvent. Available, Applying, Done and Failed are matter.js's SoftwareUpdateManager events updateAvailable, updateApplying, updateDone and updateFailed (packages/node/src/behavior/system/ software-update/SoftwareUpdateManager.ts:2280-2309 at b25ed960), emitted where matter.js emits them (requestConsentForUpdate, SoftwareUpdateManager.ts:1257-1259 at b25ed960; #reportAttemptStatus, SoftwareUpdateManager.ts:2021-2050 at b25ed960; #dequeue, SoftwareUpdateManager.ts:529-537 at b25ed960, from #completeUpdate, #retarget, #failUpdate and removeConsent). ConsentChanged, CheckFinished, Queued and TransferStarted are this module's own: matter.js emits nothing when a consent is added, removed or expires, when a check ends, when #queueUpdate queues an entry or #retarget moves its target, or when an attempt first reports Downloading. One update reports Queued, TransferStarted, Applying, then Done or Failed.
func (UpdateEventKind) String ¶
func (k UpdateEventKind) String() string
String is the kind's name: available, consent_changed, check_finished, applying, done, failed, queued, transfer_started.
type UpdateInfo ¶
type UpdateInfo struct {
VendorID, ProductID uint16
SoftwareVersion uint32
SoftwareVersionString string
MinApplicable, MaxApplicable uint32
ReleaseNotesURL string
SpecificationVersion uint32
// Source is SourceLocal, SourceProd or SourceTest.
Source string
// contains filtered or unexported fields
}
UpdateInfo is an applicable update — matter.js DeviceSoftwareVersionModelDclSchemaWithSource (DclOtaUpdateService.ts:43-45 at b25ed960): a ledger record or a stored image, with the source it came from.
func UpdateInfoFromImage ¶
func UpdateInfoFromImage(r io.Reader, opts LocalImageOptions) (UpdateInfo, error)
UpdateInfoFromImage reads the header of the OTA image r and returns its update, of SourceLocal, for Images.Store with ModeLocal — matter.js updateInfoFromStream (DclOtaUpdateService.ts:862-922 at b25ed960): the header's ids, version and applicable range, opts where the header states none.