extruntime

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Overview

Package extruntime provides easy to ues wrapper for runtime extension development

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(
	logger log.Interface,
	maxSingleMessagePayloadSize int,
	impl RuntimeEngine,
) types.Handler

Types

type Handler

type Handler struct {
	*extutil.BaseHandler
	// contains filtered or unexported fields
}

func (*Handler) HandleCmd

func (h *Handler) HandleCmd(
	ctx context.Context,
	sid, seq uint64,
	kind arhatgopb.CmdType,
	payload []byte,
) (arhatgopb.MsgType, interface{}, error)

type RuntimeEngine

type RuntimeEngine interface {
	// Name of the runtime engine
	Name() string

	// Version of the runtime engine
	Version() string

	// OS the kernel name of the runtime environment
	OS() string

	// OSImage the os distro name
	OSImage() string

	// Arch the cpu arch of the runtime environment
	Arch() string

	// KernelVersion of the OS
	KernelVersion() string

	// Exec execute a command in a running container
	Exec(
		ctx context.Context,
		podUID, container string,
		stdin io.Reader,
		stdout, stderr io.Writer,
		command []string,
		tty bool,
	) (
		doResize types.ResizeHandleFunc,
		errCh <-chan *aranyagopb.ErrorMsg,
		err error,
	)

	// Attach a running container's stdin/stdout/stderr
	Attach(
		ctx context.Context,
		podUID, container string,
		stdin io.Reader,
		stdout, stderr io.Writer,
	) (
		doResize types.ResizeHandleFunc,
		errCh <-chan *aranyagopb.ErrorMsg,
		err error,
	)

	// Logs retrieve
	Logs(
		ctx context.Context,
		options *aranyagopb.LogsCmd,
		stdout, stderr io.Writer,
	) error

	// PortForward establishes a temporary reverse proxy to cloud
	PortForward(
		ctx context.Context,
		podUID string,
		protocol string,
		port int32,
		upstream io.Reader,
	) (
		downstream io.ReadCloser,
		closeWrite func(),
		readErrCh <-chan error,
		err error,
	)

	// EnsurePod creates containers
	EnsurePod(ctx context.Context, options *runtimepb.PodEnsureCmd) (*runtimepb.PodStatusMsg, error)

	// DeletePod kills all containers and delete pod related volume data
	DeletePod(ctx context.Context, options *runtimepb.PodDeleteCmd) (*runtimepb.PodStatusMsg, error)

	// ListPods show (all) pods we are managing
	ListPods(ctx context.Context, options *runtimepb.PodListCmd) (*runtimepb.PodStatusListMsg, error)

	// EnsureImages ensure container images
	EnsureImages(ctx context.Context, options *runtimepb.ImageEnsureCmd) (*runtimepb.ImageStatusListMsg, error)

	// DeleteImages deletes images with specified references
	DeleteImages(ctx context.Context, options *runtimepb.ImageDeleteCmd) (*runtimepb.ImageStatusListMsg, error)

	// DeleteImages lists images with specified references or all images
	ListImages(ctx context.Context, options *runtimepb.ImageListCmd) (*runtimepb.ImageStatusListMsg, error)
}

Jump to

Keyboard shortcuts

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