Package extruntime provides easy to ues wrapper for runtime extension development



    This section is empty.


    This section is empty.


    func NewHandler

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


    type Handler

    type Handler struct {
    	// 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
    		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
    		ctx context.Context,
    		podUID, container string,
    		stdin io.Reader,
    		stdout, stderr io.Writer,
    	) (
    		doResize types.ResizeHandleFunc,
    		errCh <-chan *aranyagopb.ErrorMsg,
    		err error,
    	// Logs retrieve
    		ctx context.Context,
    		options *aranyagopb.LogsCmd,
    		stdout, stderr io.Writer,
    	) error
    	// PortForward establishes a temporary reverse proxy to cloud
    		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)