workspacemanagerv2

package
v0.6.271 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	ID     string
	Status ContainerStatus
}

type ContainerManager

type ContainerManager interface {
	GetContainer(ctx context.Context, containerID string) (*Container, error)
	StopContainer(ctx context.Context, containerID string) error
	DeleteContainer(ctx context.Context, containerID string) error
	CreateContainer(ctx context.Context, options CreateContainerOptions, image string) (string, error)
	StartContainer(ctx context.Context, containerID string) error
	DeleteVolume(ctx context.Context, volumeName string) error
}

ContainerManager Interface for docker, podman etc.

type ContainerStatus

type ContainerStatus string
const (
	ContainerRunning ContainerStatus = "running"
	ContainerStopped ContainerStatus = "stopped"
)

func DockerStatusToContainerStatus

func DockerStatusToContainerStatus(status string) ContainerStatus

type ContainerWorkspace

type ContainerWorkspace struct {
	ContainerManager ContainerManager
	Identifier       string
	Image            string
	Volumes          []Volume
}

func NewContainerWorkspace

func NewContainerWorkspace(cm ContainerManager, identifier string, image string, volumes []Volume) *ContainerWorkspace

func (ContainerWorkspace) CreateNew

func (c ContainerWorkspace) CreateNew(ctx context.Context) error

func (ContainerWorkspace) CreateVolumes

func (c ContainerWorkspace) CreateVolumes(ctx context.Context) error

func (ContainerWorkspace) DeleteVolumes

func (c ContainerWorkspace) DeleteVolumes(ctx context.Context) error

func (ContainerWorkspace) Rebuild

func (c ContainerWorkspace) Rebuild(ctx context.Context) error

func (ContainerWorkspace) Reset

func (c ContainerWorkspace) Reset(ctx context.Context) error

func (ContainerWorkspace) Start

func (c ContainerWorkspace) Start(ctx context.Context) error

func (ContainerWorkspace) StartFromStopped

func (c ContainerWorkspace) StartFromStopped(ctx context.Context) error

func (ContainerWorkspace) Stop

type CreateContainerOptions

type CreateContainerOptions struct {
	Name    string
	Volumes []Volume
	Ports   []string

	Command     string
	CommandArgs []string
}

type DockerContainerManager

type DockerContainerManager struct{}

func (DockerContainerManager) CreateContainer

func (c DockerContainerManager) CreateContainer(ctx context.Context, options CreateContainerOptions, image string) (string, error)

func (DockerContainerManager) DeleteContainer

func (c DockerContainerManager) DeleteContainer(ctx context.Context, containerIdentifier string) error

func (DockerContainerManager) DeleteVolume

func (c DockerContainerManager) DeleteVolume(ctx context.Context, volumeName string) error

func (DockerContainerManager) GetContainer

func (c DockerContainerManager) GetContainer(ctx context.Context, containerIdentifier string) (*Container, error)

func (DockerContainerManager) StartContainer

func (c DockerContainerManager) StartContainer(ctx context.Context, containerIdentifier string) error

func (DockerContainerManager) StopContainer

func (c DockerContainerManager) StopContainer(ctx context.Context, containerIdentifier string) error

type DynamicVolume

type DynamicVolume struct {
	FromMountPathPrefix string
	ToMountPath         string
	FileMap             map[string]func(string)
}

func NewDynamicVolume

func NewDynamicVolume(path string, fileMap map[string]func(string)) *DynamicVolume

func (DynamicVolume) GetIdentifier

func (s DynamicVolume) GetIdentifier() string

func (DynamicVolume) GetMountFromPath

func (s DynamicVolume) GetMountFromPath() string

func (DynamicVolume) GetMountToPath

func (s DynamicVolume) GetMountToPath() string

func (DynamicVolume) Setup

func (s DynamicVolume) Setup(_ context.Context) error

func (DynamicVolume) Teardown

func (s DynamicVolume) Teardown(_ context.Context) error

func (DynamicVolume) WithPathPrefix

func (s DynamicVolume) WithPathPrefix(prefix string) DynamicVolume

type SimpleVolume

type SimpleVolume struct {
	Identifier  string
	MountToPath string
}

func (SimpleVolume) GetIdentifier

func (s SimpleVolume) GetIdentifier() string

func (SimpleVolume) GetMountToPath

func (s SimpleVolume) GetMountToPath() string

func (SimpleVolume) Setup

func (s SimpleVolume) Setup(_ context.Context) error

func (SimpleVolume) Teardown

func (s SimpleVolume) Teardown(_ context.Context) error

type StaticFiles

type StaticFiles struct {
	FromMountPathPrefix string
	ToMountPath         string
	FileMap             map[string]io.Reader
}

func NewStaticFiles

func NewStaticFiles(path string, fileMap map[string]io.Reader) StaticFiles

func (StaticFiles) GetIdentifier

func (s StaticFiles) GetIdentifier() string

func (StaticFiles) GetMountFromPath

func (s StaticFiles) GetMountFromPath() string

func (StaticFiles) GetMountToPath

func (s StaticFiles) GetMountToPath() string

func (StaticFiles) Setup

func (s StaticFiles) Setup(_ context.Context) error

func (StaticFiles) Teardown

func (s StaticFiles) Teardown(_ context.Context) error

func (StaticFiles) WithPathPrefix

func (s StaticFiles) WithPathPrefix(prefix string) StaticFiles

type SymLinkVolume

type SymLinkVolume struct {
	FromSymLinkPath string
	LocalVolumePath string
	MountToPath     string
}

func NewSymLinkVolume

func NewSymLinkVolume(fromSymLinkPath string, localVolumePath string, mountToPath string) *SymLinkVolume

func (SymLinkVolume) GetIdentifier

func (s SymLinkVolume) GetIdentifier() string

func (SymLinkVolume) GetMountToPath

func (s SymLinkVolume) GetMountToPath() string

func (SymLinkVolume) Setup

func (s SymLinkVolume) Setup(_ context.Context) error

func (SymLinkVolume) Teardown

func (s SymLinkVolume) Teardown(_ context.Context) error

type Volume

type Volume interface {
	GetIdentifier() string // this may be a name or path to external mount
	GetMountToPath() string
	Setup(ctx context.Context) error
	Teardown(ctx context.Context) error // should also clear/delete
}

type WorkspaceManager

type WorkspaceManager struct {
	ContainerManager ContainerManager
	Store            WorkspaceManagerStore
}

func (WorkspaceManager) MakeContainerWorkspace

func (w WorkspaceManager) MakeContainerWorkspace(workspaceID string) (*ContainerWorkspace, error)

func (WorkspaceManager) Reset

func (w WorkspaceManager) Reset(ctx context.Context, workspaceID string) error

func (WorkspaceManager) Start

func (w WorkspaceManager) Start(ctx context.Context, workspaceID string) error

func (WorkspaceManager) Stop

func (w WorkspaceManager) Stop(ctx context.Context, workspaceID string) error

type WorkspaceManagerStore

type WorkspaceManagerStore interface {
	GetWorkspace(id string) (*entity.Workspace, error)
	GetWorkspaceMeta(id string) (*store.WorkspaceMeta, error)
	GetWorkspaceSetupParams(id string) (*store.SetupParamsV0, error)
	GetWorkspaceSecretsConfig(id string) (string, error)
}

Jump to

Keyboard shortcuts

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