api

package
v0.9.104 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: AGPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CRIU_DUMP_LOG_FILE  = "cedana-dump.log"
	CRIU_DUMP_LOG_LEVEL = 4
	GHOST_LIMIT         = 10000000
	DUMP_FOLDER_PERMS   = 0o777

	K8S_RUNC_ROOT    = "/run/containerd/runc/k8s.io"
	DOCKER_RUNC_ROOT = "/run/docker/runtime-runc/moby"
)
View Source
const (
	OUTPUT_FILE_PATH  string      = "/var/log/cedana-output.log"
	OUTPUT_FILE_PERMS os.FileMode = 0o777
	OUTPUT_FILE_FLAGS int         = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
)
View Source
const (
	CRIU_RESTORE_LOG_FILE   = "cedana-dump.log"
	CRIU_RESTORE_LOG_LEVEL  = 4
	RESTORE_TEMPDIR         = "/tmp/cedana_restore"
	RESTORE_TEMPDIR_PERMS   = 0o755
	RESTORE_OUTPUT_LOG_PATH = "/var/log/cedana-output-%s.log"
)
View Source
const (
	ADDRESS               = "localhost:8080"
	PROTOCOL              = "tcp"
	CEDANA_CONTAINER_NAME = "binary-container"
	SERVER_LOG_PATH       = "/var/log/cedana-daemon.log"
	SERVER_LOG_MODE       = os.O_APPEND | os.O_CREATE | os.O_WRONLY
	SERVER_LOG_PERMS      = 0o644
	SERVER_DB_PATH        = "/tmp/cedana.db"
)
View Source
const (
	PROCESS_STREAMING_RATE_SECONDS = 30
	LOG_STREAMING_RATE_SECONDS     = 10
)
View Source
const CHECKPOINT_STATE_FILE = "checkpoint_state.json"
View Source
const MaxNameLen = 4096

Variables

View Source
var DB_BUCKET_JOBS = []byte("jobs")

Functions

func SendFile added in v0.9.5

func SendFile(socket *os.File, file *os.File) error

SendFile sends a file over the given AF_UNIX socket. file.Name() is also included so that if the other end uses RecvFile, the file will have the same name information.

func SendRawFd added in v0.9.5

func SendRawFd(socket *os.File, msg string, fd uintptr) error

SendRawFd sends a specific file descriptor over the given AF_UNIX socket.

func StartGPUController added in v0.9.5

func StartGPUController(uid, gid uint32, logger *zerolog.Logger) (*exec.Cmd, error)

func StartServer added in v0.9.104

func StartServer(cmdCtx context.Context) error

Takes in a context that allows for cancellation from the cmdline

func WriteJSON added in v0.9.5

func WriteJSON(w io.Writer, v interface{}) error

WriteJSON writes the provided struct v to w using standard json marshaling without a trailing newline. This is used instead of json.Encoder because there might be a problem in json decoder in some cases, see: https://github.com/docker/docker/issues/14203#issuecomment-174177790

Types

type Bundle

type Bundle struct {
	ContainerID string
	Bundle      string
}

The bundle includes path to bundle and the runc/podman container id of the bundle. The bundle is a folder that includes the oci spec config.json as well as the rootfs used for setting up the container. Sometimes rootfs can be defined elsewhere. Podman adds extra directories and files in their bundle including a file called attach which is a unix socket for attaching stdin, stdout to the terminal

type Criu added in v0.9.5

type Criu struct {
}

Code for interfacing with CRIU. We could use go-criu, but there are certain limitations in the abstractions presented. Most of the code found here is lifted from https://github.com/checkpoint-restore/go-criu/blob/master/main.go.

func (*Criu) Dump added in v0.9.5

func (c *Criu) Dump(opts *rpc.CriuOpts, nfy *Notify) (*rpc.CriuResp, error)

Dump dumps a process

func (*Criu) GetCriuVersion added in v0.9.5

func (c *Criu) GetCriuVersion() (int, error)

func (*Criu) IsCriuAtLeast added in v0.9.5

func (c *Criu) IsCriuAtLeast(version int) (bool, error)

IsCriuAtLeast checks if the version is at least the same as the parameter version

func (*Criu) Restore added in v0.9.5

func (c *Criu) Restore(opts *rpc.CriuOpts, nfy *Notify, extraFiles []*os.File) (*rpc.CriuResp, error)

Restore restores a process

type Notify added in v0.9.5

type Notify struct {
	Logger         *zerolog.Logger
	PreDumpFunc    NotifyFunc
	PostDumpFunc   NotifyFunc
	PreRestoreFunc NotifyFunc
	PreResumeFunc  NotifyFunc
}

func (Notify) NetworkLock added in v0.9.5

func (n Notify) NetworkLock() error

NetworkLock NoNotify

func (Notify) NetworkUnlock added in v0.9.5

func (n Notify) NetworkUnlock() error

NetworkUnlock NoNotify

func (Notify) PostDump added in v0.9.5

func (n Notify) PostDump() error

func (Notify) PostRestore added in v0.9.5

func (n Notify) PostRestore(pid int32) error

PostRestore NoNotify

func (Notify) PostResume added in v0.9.5

func (n Notify) PostResume() error

PostResume NoNotify

func (Notify) PostSetupNamespaces added in v0.9.5

func (n Notify) PostSetupNamespaces() error

PostSetupNamespaces NoNotify

func (Notify) PreDump added in v0.9.5

func (n Notify) PreDump() error

func (Notify) PreRestore added in v0.9.5

func (n Notify) PreRestore() error

func (Notify) PreResume added in v0.9.5

func (n Notify) PreResume() error

func (Notify) SetupNamespaces added in v0.9.5

func (n Notify) SetupNamespaces(pid int32) error

SetupNamespaces NoNotify

type NotifyFunc added in v0.9.5

type NotifyFunc struct {
	Avail    bool
	Callback func() error
}

type OCIBundle added in v0.9.5

type OCIBundle struct {
	// ID of the bundle
	ID string
	// Path to the bundle
	Path string
	// Namespace of the bundle
	Namespace string
}

Bundle represents an OCI bundle

func NewBundle added in v0.9.5

func NewBundle(ctx context.Context, root, state, id string, spec typeurl.Any) (b *OCIBundle, err error)

NewBundle returns a new bundle on disk

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer added in v0.9.104

func NewServer(ctx context.Context) (*Server, error)

Directories

Path Synopsis
gpu

Jump to

Keyboard shortcuts

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