View Source NervesHubLink.ArchiveManager (nerves_hub_link v2.6.0)
GenServer for handling downloading archives from NervesHub
Your NervesHubLink client will tell the manager when to download an archive and the Manager will tell your client when it's done downloading so you can act on it.
You are expected to remove the file when you're done with it and track that it has been applied to prevent downloading again.
Summary
Functions
Must be called when an archive payload is dispatched from
NervesHub. the map must contain a "url"
key.
Returns the UUID of the currently downloading archive, or nil.
Returns the current status of the archive manager
Types
@type status() :: :idle | :downloading | :done | :update_rescheduled
@type t() :: %NervesHubLink.ArchiveManager{ archive_info: nil | NervesHubLink.Message.ArchiveInfo.t(), data_path: Path.t(), download: nil | GenServer.server(), file_path: Path.t(), status: status(), temp_file_path: Path.t(), update_reschedule_timer: nil | :timer.tref() }
Functions
@spec apply_archive(GenServer.server(), NervesHubLink.Message.ArchiveInfo.t(), [ binary() ]) :: status()
Must be called when an archive payload is dispatched from
NervesHub. the map must contain a "url"
key.
@spec currently_downloading_uuid(GenServer.server()) :: uuid :: String.t() | nil
Returns the UUID of the currently downloading archive, or nil.
@spec status(GenServer.server()) :: status()
Returns the current status of the archive manager