utils

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PodmanMachineErrorMessage = `` /* 202-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func FileExists

func FileExists(path string) (bool, error)

func GetFreeLocalTcpPort

func GetFreeLocalTcpPort() (int, error)

func IsPortOpen

func IsPortOpen(port int) bool

func IsProcessAlive

func IsProcessAlive(pid int) bool

func PullAndInspect

func PullAndInspect(ctx context.Context, imageNameOrId string) (*types.ImageInspectReport, error)

PullAndInspect inpects the image, pulling in if the image if required

func ReadPidFile

func ReadPidFile(pidFile string) (int, error)

func SendInterrupt

func SendInterrupt(pid int) error

SendInterrupt sends SIGINT to pid

func WaitForFileWithBackoffs

func WaitForFileWithBackoffs(maxBackoffs int, backoff time.Duration, path string) error

WaitForFileWithBackoffs attempts to discover a file in maxBackoffs attempts

func WithExitCode

func WithExitCode(err error) (int, error)

SetExitCode set the exit code for exec.ExitError errors, and no error is returned

func WritePidFile

func WritePidFile(pidFile string, pid int) error

Types

type AccessMode

type AccessMode uint
const (
	Exclusive AccessMode = iota
	Shared
)

type CacheLock

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

func NewCacheLock

func NewCacheLock(lockDir, cacheDir string) CacheLock

NewCacheLock returns a new instance of *CacheLock. It takes the path to the VM cache dir.

func (CacheLock) TryLock

func (l CacheLock) TryLock(mode AccessMode) (bool, error)

TryLock takes an exclusive or shared lock, based on the parameter mode. The lock is non-blocking, if we are unable to lock the cache directory, the function will return false instead of waiting for the lock.

func (CacheLock) Unlock

func (l CacheLock) Unlock() error

Unlock unlocks the cache lock.

type ConnectionInfo

type ConnectionInfo struct {
	PodmanSocket PodmanSocket `json:"PodmanSocket"`
}

type MachineContext

type MachineContext struct {
	Ctx             context.Context
	SSHIdentityPath string
}

func GetMachineContext

func GetMachineContext() (*MachineContext, error)

type MachineInspect

type MachineInspect struct {
	ConnectionInfo ConnectionInfo `json:"ConnectionInfo"`
	SSHConfig      SSHConfig      `json:"SSHConfig"`
	Rootful        bool           `json:"Rootful"`
}

type MachineList

type MachineList struct {
	Name    string `json:"Name"`
	Running bool   `json:"Running"`
	Default bool   `json:"Default"`
}

type PodmanSocket

type PodmanSocket struct {
	Path string `json:"Path"`
}

type SSHConfig

type SSHConfig struct {
	IdentityPath string `json:"IdentityPath"`
}

Jump to

Keyboard shortcuts

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