server

package
v0.0.0-...-a31c79d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContainerServer

func NewContainerServer() (*grpc.Server, func())

NewContainerServer returns a new gRPC server for container services.

func StartServer

func StartServer(port int, exportTo string) int

StartServer starts server on the requested port.

Types

type CommandExecutor

type CommandExecutor interface {
	// Execute returns the same output as the original command.
	Execute(context.Context, commands.Command) (string, string, error)
}

CommandExecutor proxies command execution to provide an abstraction layer for interception.

type ContainerServerImpl

type ContainerServerImpl struct {
	api.UnimplementedCrosToolRunnerContainerServiceServer
	// contains filtered or unexported fields
}

ContainerServerImpl implements the gRPC services by running commands and mapping errors to proper gRPC status codes.

func (*ContainerServerImpl) CreateNetwork

CreateNetwork creates a new docker network with the given name.

func (*ContainerServerImpl) GetContainer

GetContainer retrieves information of a container.

func (*ContainerServerImpl) GetNetwork

GetNetwork retrieves information of given docker network.

func (*ContainerServerImpl) LoginRegistry

LoginRegistry logs in a docker image registry server

func (*ContainerServerImpl) Shutdown

Shutdown signals to shut down the CTRv2 gRPC server.

func (*ContainerServerImpl) StackCommands

StackCommands provides a scripting mechanism to execute a series of commands in order.

func (*ContainerServerImpl) StartContainer

StartContainer pulls image and then calls docker run to start a container.

func (*ContainerServerImpl) StartTemplatedContainer

StartTemplatedContainer delegates to template processors to populate templates into valid StartContainerRequest, and then passes over to the generic endpoint.

type DefaultCommandExecutor

type DefaultCommandExecutor struct{}

DefaultCommandExecutor enforces rules on stdout so that the commands can only be used in a granular way: retrieve one piece of information at a time. The motivation is to make it easier to support both docker and podman commands which have subtle differences in stdout and data model.

func (*DefaultCommandExecutor) Execute

Execute of DefaultCommandExecutor executes the command as is and processes the stdout to extract only the first line (without the newline character).

Jump to

Keyboard shortcuts

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