blob: bc0da24e149958b032192b3268d231f47cfc0b16 [file] [log] [blame]
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package dbus
import "policy_manager/policymanagerproto"
// UpdateEngineClient is the generic interface for interacting with update-engine.
type UpdateEngineClient interface {
// SetChannel Sets the target channel for update.
SetChannel(targetChannel string) error
// AttemptUpdate sends a request to update-engine to check for update.
AttemptUpdate() error
// GetStatus returns the update status.
GetStatus() (*policymanagerproto.StatusResult, error)
// SubscribeStatusUpdate subscribes the status update of update-engine.
// It returns a channel so that any udpate status change of udpate-engine
// will be sent to the channel.
SubscribeStatusUpdate() (out <-chan UEGetStatusResponse, err error)
}
type UEGetStatusResponse struct {
LastCheckedTime int64
Progress float64
UpdateStatus string
NewVersion string
NewSize int64
}