filemanager

package
v0.60.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package filemanager implement interfaces to run install-script tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileManager added in v0.52.0

type FileManager interface {
	ReadFile(path string) ([]byte, error)
	ReadDir(path string) ([]fs.DirEntry, error)
	FileExists(path string) (bool, error)
	WriteFile(path string, content []byte) (int64, error)
}

FileManager generic interface

type RemoteHost added in v0.52.0

type RemoteHost struct {
	// contains filtered or unexported fields
}

RemoteHost implement filemanager interface using components.RemoteHost

func NewRemoteHost added in v0.52.0

func NewRemoteHost(host *components.RemoteHost) *RemoteHost

NewRemoteHost create a new file manager using components.RemoteHost Note: The file operations will be restricted to the permissions of the client connection user

func (*RemoteHost) FileExists added in v0.52.0

func (u *RemoteHost) FileExists(path string) (bool, error)

FileExists check if the file exists, return an error if it does not

func (*RemoteHost) ReadDir added in v0.52.0

func (u *RemoteHost) ReadDir(path string) ([]fs.DirEntry, error)

ReadDir returns list of directory entries in path

func (*RemoteHost) ReadFile added in v0.52.0

func (u *RemoteHost) ReadFile(path string) ([]byte, error)

ReadFile read the content of the file, return error if the file do not exists

func (*RemoteHost) WriteFile added in v0.52.0

func (u *RemoteHost) WriteFile(path string, content []byte) (int64, error)

WriteFile write content to the file

type Unix

type Unix struct {
	// contains filtered or unexported fields
}

Unix implement filemanager interface for Unix distributions

func NewUnix added in v0.52.0

func NewUnix(host *components.RemoteHost) *Unix

NewUnix create a new unix file manager

func (*Unix) FileExists

func (u *Unix) FileExists(path string) (bool, error)

FileExists check if the file exists, return an error if it does not

func (*Unix) ReadDir added in v0.52.0

func (u *Unix) ReadDir(path string) ([]fs.DirEntry, error)

ReadDir only returns the Name of files in path, not stat modes TODO: Return a real DirEntry

func (*Unix) ReadFile

func (u *Unix) ReadFile(path string) ([]byte, error)

ReadFile read the content of the file, return error if the file do not exists

func (*Unix) WriteFile

func (u *Unix) WriteFile(path string, content []byte) (int64, error)

WriteFile write content to the file, does not return number of bytes written TODO: return number of bytes written

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL