Documentation ¶
Index ¶
- Constants
- Variables
- func Storage(url string) func(u *Upgrader) error
- func Zinit(socket string) func(u *Upgrader) error
- type Boot
- func (b *Boot) Current() (FullFListInfo, error)
- func (b *Boot) CurrentBins() (map[string]FListInfo, error)
- func (b Boot) DetectBootMethod() BootMethod
- func (b *Boot) MustVersion() semver.Version
- func (b *Boot) Name() string
- func (b *Boot) Set(c FullFListInfo) error
- func (b *Boot) SetBins(current map[string]FListInfo) error
- func (b *Boot) Version() (semver.Version, error)
- type BootMethod
- type FListInfo
- type FListRepo
- type FileInfo
- type FullFListInfo
- type HubClient
- type Upgrader
- type UpgraderOption
Constants ¶
const ( // FlistNameFile file contains boot flist repo/name FlistNameFile = "/tmp/flist.name" // FlistInfoFile file container boot flist infor FlistInfoFile = "/tmp/flist.info" // BinariesFile file contains binaries database BinariesFile = "/tmp/bins.info" )
Variables ¶
var ( // ErrRestartNeeded is returned if upgraded requires a restart ErrRestartNeeded = fmt.Errorf("restart needed") )
Functions ¶
Types ¶
type Boot ¶
type Boot struct{}
Boot struct
func (*Boot) Current ¶
func (b *Boot) Current() (FullFListInfo, error)
Current returns current flist information
func (*Boot) CurrentBins ¶
CurrentBins returns a list of current binaries installed
func (Boot) DetectBootMethod ¶
func (b Boot) DetectBootMethod() BootMethod
DetectBootMethod tries to detect the boot method of the node
func (*Boot) MustVersion ¶
MustVersion must returns the current version or panic
func (*Boot) Name ¶
Name always return name of the boot flist. If name file does not exist, an empty string is returned
type BootMethod ¶
type BootMethod string
BootMethod defines the node boot method
const ( // BootMethodFList booted from an flist BootMethodFList BootMethod = "flist" // BootMethodOther booted with other methods BootMethodOther BootMethod = "other" )
type FListInfo ¶ added in v0.4.9
type FListInfo struct { Name string `json:"name"` Target string `json:"target"` Type string `json:"type"` Updated uint64 `json:"updated"` Repository string `json:"-"` }
FListInfo is information of flist as returned by repo list operation
func (*FListInfo) TryVersion ¶ added in v0.5.5
type FListRepo ¶ added in v0.5.5
type FListRepo struct { Repo string Current map[string]FListInfo // contains filtered or unexported fields }
FListRepo type
type FullFListInfo ¶ added in v0.4.9
FullFListInfo reflects node boot information (flist + version)
func (*FullFListInfo) Commit ¶ added in v0.4.9
func (b *FullFListInfo) Commit(path string) error
Commit write version to version file
type HubClient ¶ added in v0.4.9
type HubClient struct{}
HubClient API for f-list
func (*HubClient) Download ¶ added in v0.4.9
Download downloads an flist (fqn: repo/name) to cache and return the full path to the extraced meta data directory. the returned path is in format {cache}/{hash}/
func (*HubClient) Info ¶ added in v0.4.9
func (h *HubClient) Info(flist string) (info FullFListInfo, err error)
Info gets flist info from hub
func (*HubClient) StorageURL ¶ added in v0.4.9
StorageURL return hub storage url
type Upgrader ¶
type Upgrader struct {
// contains filtered or unexported fields
}
Upgrader is the component that is responsible to keep 0-OS up to date
func NewUpgrader ¶ added in v0.4.9
func NewUpgrader(cache string, opts ...UpgraderOption) (*Upgrader, error)
NewUpgrader creates a new upgrader instance
func (*Upgrader) InstallBinary ¶
InstallBinary from a single flist.
func (*Upgrader) UninstallBinary ¶
UninstallBinary from a single flist.
func (*Upgrader) Upgrade ¶
func (u *Upgrader) Upgrade(from, to FullFListInfo) error
Upgrade is the method that does a full upgrade flow first check if a new version is available if yes, applies the upgrade on a successfully update, upgrade WILL NOT RETURN instead the upgraded daemon will be completely stopped
type UpgraderOption ¶ added in v0.4.9
UpgraderOption interface