Documentation ¶
Index ¶
- Constants
- Variables
- func CheckDevicesRepository()
- func DownloadAsync(repo Repository, wg *sync.WaitGroup) (string, *pb.ProgressBar, error)
- func DownloadDevicesRepository() error
- func DownloadNewVersion(name, version, dst string) (string, error)
- func GenMappingFile() error
- func GetAllRepos() ([]string, error)
- func GetDevices() []string
- func GetIoTItVersionMD5(oss, arch, version string) (hash string, repoVersion string, err error)
- func IsVersionUpToDate(v1, v2 string) (bool, error)
- func SetPath(p string)
- type DeviceCollection
- type DeviceImage
- type DeviceMapping
- type GenericRepository
- type Repository
- type VMRepo
Constants ¶
const ( Latest = "latest" Stable = "stable" )
Releases
const IoTItRepo = "https://cdn.isaax.io/iotit/versions.json"
IoTItRepo stores default iotit repo path
const S3Bucket = "https://cdn.isaax.io/iotit/versions.json"
S3Bucket stores default S3 bucket path
Variables ¶
var ImageDir = filepath.Join(baseDir, "images")
ImageDir is a directory of the flashing images
var VboxDir = filepath.Join(baseDir, "virtualbox")
VboxDir is a directory of virtualboxes
Functions ¶
func CheckDevicesRepository ¶ added in v0.4.0
func CheckDevicesRepository()
CheckDevicesRepository checks mapping.json for updates
func DownloadAsync ¶
func DownloadAsync(repo Repository, wg *sync.WaitGroup) (string, *pb.ProgressBar, error)
DownloadAsync starts async download
func DownloadDevicesRepository ¶
func DownloadDevicesRepository() error
DownloadDevicesRepository downloads new mapping.json from the cloud
func DownloadNewVersion ¶
DownloadNewVersion downloads the latest version based on the current release and skips this step if up to date
func GetDevices ¶ added in v0.3.4
func GetDevices() []string
func GetIoTItVersionMD5 ¶
GetIoTItVersionMD5 gets the latest version from the repo and checks if the new version is available
func IsVersionUpToDate ¶
IsVersionUpToDate checks if version is up to date
Types ¶
type DeviceCollection ¶
type DeviceCollection struct { Devices []DeviceMapping `json:"Devices"` Version string `json:"Version,omitempty"` }
deviceCollection is a starting point of the collection of images
type DeviceImage ¶
type DeviceImage struct { URL string `json:"URL"` Alias string `json:"Alias,omitempty"` Title string `json:"Title,omitempty"` User string `json:"User,omitempty"` Pass string `json:"Pass,omitempty"` Hash string `json:"Hash,omitempty"` }
DeviceImage contains url, title, username and password which are used after flashing
type DeviceMapping ¶
type DeviceMapping struct { Name string `json:"Name"` Alias string `json:"Alias,omitempty"` Sub []*DeviceMapping `json:"Sub,omitempty"` Images []DeviceImage `json:"Images,omitempty"` Type string Image DeviceImage // contains filtered or unexported fields }
DeviceMapping is a collection of device, it sub-types and sets of images for these devices
func GetDeviceRepo ¶
func GetDeviceRepo(device string) (*DeviceMapping, error)
GetDeviceRepo returns a devices repo. It checks the existence of mapping.json first then proceeds to the default variable
func (*DeviceMapping) Dir ¶
func (d *DeviceMapping) Dir() string
Dir - returns directory of a local repo `.iotit/images/{name}`
func (*DeviceMapping) FindImage ¶
func (d *DeviceMapping) FindImage(image string) error
FindImage - searches image in the repo
func (*DeviceMapping) GetImageTitles ¶
func (d *DeviceMapping) GetImageTitles() []string
GetImageTitles returns array of image titles
func (*DeviceMapping) GetSubsNames ¶
func (d *DeviceMapping) GetSubsNames() []string
GetSubsNames returns array of Names within a `Sub`
type GenericRepository ¶
GenericRepository is so generic
func (*GenericRepository) GetURL ¶
func (g *GenericRepository) GetURL() string
GetURL of generic repo
func (*GenericRepository) GetVersion ¶
func (g *GenericRepository) GetVersion() string
GetVersion of generic repo
type Repository ¶
type Repository interface { //version of latest distro GetVersion() string //url of distro GetURL() string //name of the latest distro file Name() string //base dir of repository Dir() string }
Repository represents image repo
func NewGenericRepository ¶
func NewGenericRepository(url, version string, dir string) Repository
NewGenericRepository creates new generic repo
func NewRepositoryVM ¶
func NewRepositoryVM() (Repository, error)
NewRepositoryVM creates new repository for specified VM type