Documentation ¶
Index ¶
- func GetGitHubDownloadURL(ctx context.Context, gh *github.Client, pkg *neco.DebianPackage) (string, error)
- func InstallDebianPackage(ctx context.Context, client *http.Client, ghClient *http.Client, ...) error
- func UpdateAborted(version string, mylrn int, statuses map[int]*neco.UpdateStatus) bool
- type Barrier
- type Operator
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGitHubDownloadURL ¶
func GetGitHubDownloadURL(ctx context.Context, gh *github.Client, pkg *neco.DebianPackage) (string, error)
GetGitHubDownloadURL returns URL of specified Debian package hosted in GitHub releases.
func InstallDebianPackage ¶
func InstallDebianPackage(ctx context.Context, client *http.Client, ghClient *http.Client, pkg *neco.DebianPackage, background bool) error
InstallDebianPackage installs a debian package client uses for downloading a debian package. ghClient uses for getting download URL by GitHub API.
func UpdateAborted ¶
UpdateAborted returns true if the current update process was aborted.
The condition is checked as follows: 1. If the status is not for the current version, it is ignored. 2. If the status has Cond==CondComplete, it is ignored. 3. If the status has Cond==CondAbort, this returns true. 4. If the status has Step==1 for other workers, it is ignored. 5. Otherwise, the process was aborted.
Types ¶
type Barrier ¶
type Barrier map[int]struct{}
Barrier is used for barrier synchronization between boot servers.
func NewBarrier ¶
NewBarrier returns Barrier to synchronize boot servers listed in lrns.
type Operator ¶
type Operator interface { // UpdateNeco updates neco package. UpdateNeco(ctx context.Context, req *neco.UpdateRequest) error // FinalStep is the step number of the final operation. FinalStep() int // RunStep executes operations for given step. RunStep(ctx context.Context, req *neco.UpdateRequest, step int) error // RestoreServices starts installed services at startup. StartServices(ctx context.Context) error // RestartEtcd restarts etcd. RestartEtcd(index int, req *neco.UpdateRequest) error }
Operator installs or updates programs
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker implements Neco auto update worker process. This is a state machine.
func (*Worker) Run ¶
Run waits for update request from neco-updater, then executes update process with other workers. To communicate with neco-updater and other workers, etcd objects are used.
Run works as follows:
1. Check the current request. If the request is not found, go to 5.
- If locally installed neco package is older than the requested version, neco-worker updates the package, then exits to be restarted by systemd.
- Check the status of request and workers; if the update process was aborted, or if the update process has completed successfully, also go to 5.
4. Update programs for the requested version.
- Wait for the new request. If there is a new one, neco-worker updates the package and exits to be restarted by systemd.