ctr

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package ctr represents function and interfaces to communitae with CTR CIPD.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUp

func IsUp(ctx context.Context) bool

IsUp tells if CTR service is up or not.

Types

type BaseContainer

type BaseContainer interface {
	Name() string
	Exec(ctx context.Context, cmd string) (outstd, errstd string, err error)
	Close(ctx context.Context) error
	IsClosed() bool
	GetClient(ctx context.Context) (*grpc.ClientConn, error)
	ServiceAddress(ctx context.Context) (string, error)
}

BaseContainer describe API to work with containers.

type Network

type Network interface {
	Name() string
}

Network describe API to work with networks.

type ServiceInfo

type ServiceInfo interface {
	Stop(ctx context.Context) error
	GetNetwork(ctx context.Context, name string) (Network, error)
	CreateContainer(ctx context.Context, req *api.StartTemplatedContainerRequest) (BaseContainer, error)
	GetContainer(ctx context.Context, name string) (BaseContainer, error)
	StopContainer(ctx context.Context, name string) error
	GenerateContainerImagePath(ctx context.Context, imageName, tag string) (string, error)
	IsUp() bool
}

ServiceInfo describes abilities of CTR service.

func Get

func Get(ctx context.Context) (i ServiceInfo, ok bool)

Get returns ctr ServiceInfo from context.

func Init

func Init(ctx context.Context, rootDir string) (ServiceInfo, error)

Init initializes the CTR service and does all the preparation for its use. If it fails to start or authorize then it will be closed.

Jump to

Keyboard shortcuts

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