Documentation ¶
Overview ¶
Copyright 2022 The ChromiumOS Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- type ExecCmder
- type ServoHostAdapter
- func (s ServoHostAdapter) CopyData(ctx context.Context, sourceUrl string, destPath string) error
- func (s ServoHostAdapter) CreateDirectories(ctx context.Context, dirs []string) error
- func (s ServoHostAdapter) DeleteDirectory(ctx context.Context, dir string) error
- func (s *ServoHostAdapter) FetchFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (s ServoHostAdapter) ForceReconnectWithBackoff(ctx context.Context) error
- func (s *ServoHostAdapter) GetBoard(ctx context.Context) string
- func (s *ServoHostAdapter) GetModel(ctx context.Context) string
- func (s *ServoHostAdapter) GetVariable(ctx context.Context, varName string) (string, error)
- func (s ServoHostAdapter) PathExists(ctx context.Context, path string) (bool, error)
- func (s ServoHostAdapter) PipeData(ctx context.Context, sourceUrl string, pipeCommand string) error
- func (s *ServoHostAdapter) Restart(ctx context.Context) error
- func (s *ServoHostAdapter) RunAllDutControls(ctx context.Context, cmdFragments [][]string) error
- func (s *ServoHostAdapter) RunCmd(ctx context.Context, cmd string, args []string) (string, error)
- func (s *ServoHostAdapter) RunDutControl(ctx context.Context, args []string) error
- type ServoHostInterface
Constants ¶
const CurlWithRetriesArgs = "-S -s -v -# -C - --retry 3 --retry-delay 60"
Variables ¶
var ErrNotImplemented = errors.New("LocalAdapter: not implemented")
Functions ¶
This section is empty.
Types ¶
type ExecCmder ¶
type ExecCmder interface { // ExecCmd executes a system command that is provided through the command // parameter in the request. It allows the user to execute arbitrary commands // that can't be handled by calling servod (e.g. update firmware through // "futility", remote file copy through "scp"). ExecCmd(ctx context.Context, in *api.ExecCmdRequest, opts ...grpc.CallOption) (*api.ExecCmdResponse, error) }
ServodServiceClient minus unused functionality.
type ServoHostAdapter ¶
type ServoHostAdapter struct {
// contains filtered or unexported fields
}
func (ServoHostAdapter) CreateDirectories ¶
func (s ServoHostAdapter) CreateDirectories(ctx context.Context, dirs []string) error
Create directories is a thin wrapper around an mkdir command. Done here as it is expected to be reused often by many services.
func (ServoHostAdapter) DeleteDirectory ¶
func (s ServoHostAdapter) DeleteDirectory(ctx context.Context, dir string) error
DeleteDirectory is a thin wrapper around an rm command. Done here as it is expected to be reused often by many services.
func (*ServoHostAdapter) FetchFile ¶
func (s *ServoHostAdapter) FetchFile(ctx context.Context, path string) (io.ReadCloser, error)
FetchFile downloads a file from the servo host.
func (ServoHostAdapter) ForceReconnectWithBackoff ¶
func (s ServoHostAdapter) ForceReconnectWithBackoff(ctx context.Context) error
func (*ServoHostAdapter) GetVariable ¶
GetVariable reads value of varName from servo.
func (ServoHostAdapter) PathExists ¶
PathExists determines if a path exists in a DUT
func (ServoHostAdapter) PipeData ¶
PipeData uses the caching infrastructure to bring a file locally, allowing a user to pipe the result to any desired application.
func (*ServoHostAdapter) RunAllDutControls ¶
func (s *ServoHostAdapter) RunAllDutControls(ctx context.Context, cmdFragments [][]string) error
RunAllCmd sequentially runs all cmdFragments as dut-control commands.
func (*ServoHostAdapter) RunCmd ¶
RunCmd takes a command and argument and executes it remotely on the ServoHost by transforming the request to api.ExecCmdRequest, sending the request out, and transforming the response from api.ExecCmdResponse to (string, error). Returns the stdout as the string result and any execution error as the error.
func (*ServoHostAdapter) RunDutControl ¶
func (s *ServoHostAdapter) RunDutControl(ctx context.Context, args []string) error
RunDutControl runs a dut-control command with provided arguments.
type ServoHostInterface ¶
type ServoHostInterface interface { services.ServiceAdapterInterface // Returns value of a variable, requested with dut-control. GetVariable(ctx context.Context, varName string) (string, error) // Runs a single dut-control command with |args| as its arguments. RunDutControl(ctx context.Context, args []string) error // Runs an array of dut-control commands. RunAllDutControls(ctx context.Context, cmdFragments [][]string) error GetBoard(ctx context.Context) string GetModel(ctx context.Context) string // FetchFile downloads a file from the servo host. Not implemented. FetchFile(ctx context.Context, path string) (io.ReadCloser, error) }
ServoHostInterface is used to interface with a ServoHost
func NewServoHostAdapterFromExecCmder ¶
func NewServoHostAdapterFromExecCmder(board, model string, port int, execCmder ExecCmder) ServoHostInterface
NewServoHostAdapterFromExecCmder adds extra functions to the ExecCmder.